#ifndef RESPONSESCRIPT #define RESPONSESCRIPT object playertools_flashbomb_stim : playertools_flashbomb { float dummy; }; object playertools_flashmine_stim : playertools_flashmine { float dummy; }; object playertools_mine_stim : playertools_mine { float dummy; }; object ai_stim : ai_darkmod_base { void becomeHostile(entity inflictor,float f); void stillConscious(); }; float alwaysHostile; void setHostile() { $player1.StimEnable(1000,1); } void setNeutral() { $player1.StimEnable(1000,0); } void objectUsed() { setHostile(); sys.wait(3.0); setNeutral(); } float carriesWeapon() { return $player1.getCurrentWeapon()!="atdm:weapon_unarmed"; } float picksLockOrCarriesObject() { return $player1.getImmobilization(""); } void checkStatus() { $player1.StimAdd(1000,512); setNeutral(); alwaysHostile=0; while(true) { if(!alwaysHostile) { if(carriesWeapon() || picksLockOrCarriesObject()) { setHostile(); sys.wait(1.0); } else { setNeutral(); } } else { setHostile(); } sys.wait(0.5); } } void setHostileZone(entity zone) { alwaysHostile=1; setHostile(); } void setNeutralZone(entity zone) { alwaysHostile=0; setNeutral(); } void frobsLoot(entity e) { e.activateTargets($player1); thread objectUsed(); } void playertools_flashbomb_stim::inventoryUseKeyRelease(entity userEntity, entity eFrobbed, float holdTime) { thread objectUsed(); entity projectile = sys.spawn(getKey("def_projectile")); vector angles = $player1.getViewAngles(); vector direction = sys.angToForward(angles); vector velocity = direction; velocity *= getVelocityFactorForHoldTime(holdTime); vector origin = $player1.getEyePos(); origin += direction * 30; projectile.setOrigin(origin); string soundShader = projectile.getKey("snd_throw"); sys.cacheSoundShader(soundShader); // If the soundchannel argument is empty, the float defaults to 0, which is SND_CHANNEL_ANY projectile.startSoundShader(soundShader, SND_CHANNEL_BODY); // Callback to decrease the inventory stack count $player1.changeInvItemCount(getKey("inv_name"), getKey("inv_category"), -1); projectile.launch( origin, direction, velocity ); // Clear the projectile's CONTENT_PROJECTILE flag so that it doesn't collide with the player in the first few hundred msec. float savedClipMask = projectile.getClipMask(); projectile.setClipMask(PROJECTILE_LAUNCH_CLIPMASK); // Reset the clipmask back to normal after a certain amount of time sys.wait(LAUNCH_CLIPMASK_TIMEOUT/1000); projectile.setClipMask(savedClipMask); } void playertools_flashmine_stim::inventoryUseKeyRelease(entity userEntity, entity eFrobbed, float holdTime) { thread objectUsed(); entity projectile = sys.spawn(getKey("def_projectile")); vector viewAngles = $player1.getViewAngles(); vector direction = sys.angToForward(viewAngles); vector velocity = direction; velocity *= getVelocityFactorForHoldTime(holdTime); vector origin = $player1.getEyePos(); origin += direction * 30; projectile.setOrigin(origin); string soundShader = projectile.getKey("snd_throw"); sys.cacheSoundShader(soundShader); // If the soundchannel argument is empty, the float defaults to 0, which is SND_CHANNEL_ANY projectile.startSoundShader(soundShader, SND_CHANNEL_BODY); // Callback to decrease the inventory stack count $player1.changeInvItemCount(getKey("inv_name"), getKey("inv_category"), -1); projectile.launch( origin, direction, velocity ); // Clear the projectile's CONTENT_PROJECTILE flag so that it doesn't collide with the player in the first few hundred msec. float savedClipMask = projectile.getClipMask(); projectile.setClipMask(PROJECTILE_LAUNCH_CLIPMASK); // Reset the clipmask back to normal after the arm time sys.wait(projectile.getFloatKey("delay")); projectile.setClipMask(savedClipMask); } void playertools_mine_stim::inventoryUseKeyRelease(entity userEntity, entity eFrobbed, float holdTime) { thread objectUsed(); entity projectile = sys.spawn(getKey("def_projectile")); vector viewAngles = $player1.getViewAngles(); vector direction = sys.angToForward(viewAngles); vector velocity = direction; velocity *= getVelocityFactorForHoldTime(holdTime); vector origin = $player1.getEyePos(); origin += direction * 30; projectile.setOrigin(origin); string soundShader = projectile.getKey("snd_throw"); sys.cacheSoundShader(soundShader); // If the soundchannel argument is empty, the float defaults to 0, which is SND_CHANNEL_ANY projectile.startSoundShader(soundShader, SND_CHANNEL_BODY); // Callback to decrease the inventory stack count $player1.changeInvItemCount(getKey("inv_name"), getKey("inv_category"), -1); projectile.launch( origin, direction, velocity ); // Clear the projectile's CONTENT_PROJECTILE flag so that it doesn't collide with the player in the first few hundred msec. float savedClipMask = projectile.getClipMask(); projectile.setClipMask(PROJECTILE_LAUNCH_CLIPMASK); // Reset the clipmask back to normal after a certain amount of time sys.wait(projectile.getFloatKey("delay")); projectile.setClipMask(savedClipMask); } void ai_stim::init() { ResponseAdd(1000); ResponseSetAction(1000,"becomeHostile"); ResponseEnable(1000,1); sys.println(getName()); } void ai_stim::becomeHostile(entity inflictor,float f) { if (canSee($player1) && canSee(inflictor)) { setEntityRelation($player1,-1); ResponseEnable(1000,0); StimAdd(1000,512); StimEnable(1000,1); thread stillConscious(); } } void ai_stim::stillConscious() { while(getMoveType()) { sys.wait(0.5); } sys.wait(3.0); StimEnable(1000,0); } #endif