Okay, i made a stormtrooper squad cog for jk. It's supposed to make four stormtroopers attack your target, just not you. Now there's a lil problem: Sometimes when the stormies have killed the enemy and see no one else, they attack you. This is pretty weird... Oh, and if anyone can be bothered, (i couldn't) make it so that the stormies attack their own target, just not each others or the player.
------------------
Life is like... skating... yeah, skating is a good example. You see someone skating and think "Hey, that looks like fun and easy!". You go and buy a skateboard and try, you get a few broken bones, asphalt-face and stuff... But hey, i'm not the one who gets hurt!
Code:
# Jedi Knight Cog Script # # strike_main.COG # # Description # # # This Cog is Not supported by LucasArts Entertainment Co symbols int player local thing storm1 thing storm2 thing storm3 thing storm4 thing victim local message startup message pulse message killed end # ======================================================================================== code startup: player = GetLocalPlayerThing(); AIClearMode(storm1, 0x1206); AIClearMode(storm2, 0x1206); AIClearMode(storm3, 0x1206); AIClearMode(storm4, 0x1206); AISetMoveThing(storm1, player); AISetLookPos(storm1, GetThingPos(player)); AISetMode(storm1, 0x1); AISetMoveThing(storm2, player); AISetLookPos(storm2, GetThingPos(player)); AISetMode(storm2, 0x1); AISetMoveThing(storm3, player); AISetLookPos(storm3, GetThingPos(player)); AISetMode(storm3, 0x1); AISetMoveThing(storm4, player); AISetLookPos(storm4, GetThingPos(player)); AISetMode(storm4, 0x1); victim = FirstThingInView(player, 170, 12, 0x004); if( victim == storm1) { victim = -1; } else if( victim == storm2) { victim = -1; } else if( victim == storm3) { victim = -1; } else if( victim == storm4) { victim = -1; } else if( victim == player) { victim = -1; } SetPulse(1); Return; pulse: victim = FirstThingInView(player, 170, 12, 0x004); if( victim == player) { victim = -1; } if(victim == storm1 || victim == storm2 || victim == storm3 || victim == storm4 || victim == player) { call follow; } AISetMoveThing(storm1, player); AISetLookPos(storm1, GetThingPos(player)); AISetMode(storm1, 0x1); AISetMoveThing(storm2, player); AISetLookPos(storm2, GetThingPos(player)); AISetMode(storm2, 0x1); AISetMoveThing(storm3, player); AISetLookPos(storm3, GetThingPos(player)); AISetMode(storm3, 0x1); AISetMoveThing(storm4, player); AISetLookPos(storm4, GetThingPos(player)); AISetMode(storm4, 0x1); if( victim != -1 && victim != storm1 && victim != storm2 && victim != storm3 && victim != storm4 && victim != player) { call strike; } if(IsThingMoving(player) == 0) { AiSetMovePos(storm1, GetThingPos(storm1)); AiSetMovePos(storm2, GetThingPos(storm2)); AiSetMovePos(storm3, GetThingPos(storm3)); AiSetMovePos(storm4, GetThingPos(storm4)); } Return; killed: if(GetSenderRef() == victim) { SetPulse(0.005); } Return; strike: SetPulse(0); if( GetThingTemplate(victim) == GetThingTemplate(player) || GetThingTemplate(victim) == GetThingTemplate(storm1) ) { victim = -1; SetPulse(0.005); } else if( GetThingTemplate(victim) != GetThingTemplate(player) && GetThingTemplate(victim) != GetThingTemplate(storm1) ) { CaptureThing(victim); AISetFireTarget(storm1, victim); AISetMoveThing(storm1, victim); AISetLookPos(storm1, GetThingPos(victim)); AISetMode(storm1, 0x202); AIClearMode(storm1, 0x1000); CaptureThing(victim); AISetFireTarget(storm2, victim); AISetMoveThing(storm2, victim); AISetLookPos(storm2, GetThingPos(victim)); AISetMode(storm2, 0x202); AIClearMode(storm2, 0x1000); CaptureThing(victim); AISetFireTarget(storm3, victim); AISetMoveThing(storm3, victim); AISetLookPos(storm3, GetThingPos(victim)); AISetMode(storm3, 0x202); AIClearMode(storm3, 0x1000); CaptureThing(victim); AISetFireTarget(storm4, victim); AISetMoveThing(storm4, victim); AISetLookPos(storm4, GetThingPos(victim)); AISetMode(storm4, 0x202); AIClearMode(storm4, 0x1000); } Return; follow: AIClearMode(storm1, 0x1206); AIClearMode(storm2, 0x1206); AIClearMode(storm3, 0x1206); AIClearMode(storm4, 0x1206); AISetMoveThing(storm1, player); AISetLookPos(storm1, GetThingPos(player)); AISetMode(storm1, 0x1); AISetMoveThing(storm2, player); AISetLookPos(storm2, GetThingPos(player)); AISetMode(storm2, 0x1); AISetMoveThing(storm3, player); AISetLookPos(storm3, GetThingPos(player)); AISetMode(storm3, 0x1); AISetMoveThing(storm4, player); AISetLookPos(storm4, GetThingPos(player)); AISetMode(storm4, 0x1); Return; # ........................................................................................ end
------------------
Life is like... skating... yeah, skating is a good example. You see someone skating and think "Hey, that looks like fun and easy!". You go and buy a skateboard and try, you get a few broken bones, asphalt-face and stuff... But hey, i'm not the one who gets hurt!
Last edited by mb; today at 10:55 AM.