#ifndef TAI #define TAI #include "script/tdm_ai_base.script" #include "script/grabable_torch.script" object torch_ai : ai_darkmod_base { float stim_number; void getTorch(entity e,float f); void Torso_Use_lefthand(); }; void torch_ai::init() { stim_number=$worldspawn.getFloatKey("torch_stim"); if (!stim_number) stim_number=1000; ResponseAdd(stim_number); ResponseSetAction(stim_number,"getTorch"); ResponseEnable(stim_number,1); } void torch_ai::getTorch(entity e,float f) { grabable_torch inflictor=e; float al=AI_AlertIndex; if (al>=3 && al<=4) { if (!inflictor.mark())return; ResponseEnable(stim_number,0); vector pos=inflictor.getOrigin(); moveToPosition(pos); waitMove(); if (distanceTo(inflictor)>160) { ResponseEnable(stim_number,1); inflictor.reactivate(); return; } inflictor.receiveTorch(self); waitFrame(); } } void torch_ai::Torso_Use_lefthand() { PlayAnimationOnce(ANIMCHANNEL_TORSO, "bottle_pickup", 4, "Torso_Idle"); } #endif