# sariss.cog # symbols message startup message newplayer message user0 message touched message activated message killed message damaged message pulse message timer thing sariss mask=0xfff material tip_mat=saberred0.mat local material side_mat=saberred1.mat local template tpl_wall=+ssparks_wall local template tpl_blood=+ssparks_blood local template tpl_saber=+ssparks_saber local template lightning=+force_lightning local sound lightningSound=ForceLightnin01.wav local flex autoAimFOV=10 local flex autoAimMaxDist=5 local # FORCE BLINDING template cone_tpl=+force_blind local sound blindingSound=ForceBlind01.WAV local int effectHandle=-1 local ##### thing player local thing victim local thing nextvictim local sector cursector local int forcepulse local int type local flex beat local flex x local flex y local flex z local vector v local sound say_please=cw50014.wav local end # ======================================================================================== code startup: newplayer: # what her saber looks like jkSetSaberInfo(sariss, side_mat, tip_mat, 0.003, 0.001, 0.101, tpl_wall, tpl_blood, tpl_saber); jkSetFlags(sariss, 0x5); AIClearMode(sariss, 0x1206); player = GetLocalPlayerThing(); nextvictim = FirstThingInView(sariss, 170, 12, 0x004); if( nextvictim==sariss ) nextvictim = NextThingInView(); victim = -1; beat = 1.0; # control of what she does now resides with pulse SetPulse(beat); call pulse; return; getem: victim = -1; nextvictim = NextThingInView(); if( nextvictim==-1 ) { nextvictim = FirstThingInView(sariss, 170, 12, 0x004); if( nextvictim==sariss ) { nextvictim = NextThingInView(); } } if( nextvictim==-1 ) return; if( nextvictim==player ) return; if( GetThingType(nextvictim)!=2 ) return; if( AIGetAlignment(nextvictim)>=0 ) return; if( GetActorWeapon(nextvictim,1)<0 ) return; type = GetPhysicsFlags(nextvictim); if( BitTest(type,0x2000) ) return; victim = nextvictim; CaptureThing(victim); AiSetMoveSpeed(sariss,2); AISetLookPos(sariss, GetThingPos(victim)); AISetFireTarget(sariss, victim); AISetMoveThing(sariss, victim); AISetMode(sariss, 0x202); AIClearMode(sariss, 0x1000); return; findme: AIClearMode(sariss, 0x1000); AISetLookPos(sariss, GetThingPos(player)); if( VectorDist(GetThingPos(sariss),GetThingPos(player))<0.5 ) { AiSetMoveSpeed(sariss,0.1); AISetLookPos(sariss, GetThingPos(player)); v = GetThingVel(player); x = VectorLen(v); // my speed if( x==0 ) AISetDistractor(sariss, player); } else if( VectorDist(GetThingPos(sariss),GetThingPos(player))<1.0 ) { AiSetMoveSpeed(sariss,2); AISetLookPos(sariss, GetThingPos(player)); AISetMoveThing(sariss, player); } else { AISetLookPos(sariss, GetThingPos(player)); AISetMoveThing(sariss, player); v = GetThingVel(player); x = VectorLen(v); // my speed if( x<4 ) x = 4; AISetMoveSpeed(sariss,x); AISetLookPos(sariss, GetThingPos(player)); AISetMoveThing(sariss, player); # make sure not frozen! # ClearActorFlags(sariss, 0x40000); # TeleportThing(); } return; touched: activated: if( GetSenderRef()==sariss ) { if( GetSourceRef()==player ) { AIClearMode(sariss, 0x1206); } } return; timer: return; pulse: type = AIGetMode(sariss); if( BitTest(type,0x2) ) { AISetLookPos(sariss, GetThingPos(victim)); AISetFireTarget(sariss, victim); AISetMoveThing(sariss, victim); AISetMode(sariss, 0x202); return; } SetPulse(0); call getem; if( victim<0 ) call findme; SetPulse(beat); return; user0: if( victim>=0 ) { forcepower = GetParam(1); if( forcepower==1 ) { // Print("Force Power 1 : FORCE LIGHTNING..."); FireProjectile(sariss, lightning, lightningSound, 35, '0 0 0', '0 0 0', 1.0, 0, autoAimFOV, autoAimMaxDist); } else if( forcepower==2 ) { FireProjectile(sariss, lightning, lightningSound, 35, '0 0 0', '0 0 0', 1.0, 0, autoAimFOV, autoAimMaxDist); } } return; damaged: if( GetSenderRef()==sariss ) { if( GetSourceRef()==player ) PlaySoundLocal(say_please,1,0,0x100); } return; killed: if( GetSenderRef()==sariss ) { jkSetFlags(sariss, 0x8); # send a failure message back to the master cog } else { victim = -1; AIClearMode(sariss, 0x1206); } return; ################################################# end