Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Friendly Stormtroopers
Friendly Stormtroopers
2012-04-27, 6:03 PM #1
I'm having a doozy of a time editing the ai files, etc trying to get stormtroopers to target enemies rather than the player. I've looked in the AI and the COG files and I can't seem to figure out what I'm doing wrong.
Completely Overrated Facebook:http://www.facebook.com/pages/Comple...59732330769611
A community dedicated to discussing all things entertainment.
2012-04-28, 1:14 PM #2
Originally posted by Darth J:
I posted this in the cog forum
No you didn't.

Code:
# Jedi Knight COG Script
#
# 00_friendly.cog
#
# Actor designated by 'friendly' will assist the player once touched.
# Passive_ai is the actor's AI when not attacking.
# Angry_ai is the actor's AI when battling an enemy.
# I'd suggest pednarsh.ai or something of the sort for passive_ai and then
# use one of the actor's original AI files for it's angry_ai.
#
# Example: for a friendly stormtrooper, set the passive_ai to pednarsh.ai and
# the angry_ai to stdefault.ai.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved 
# Scripted 1998 by Zero. Email at: zero@downeast.net


symbols


message startup
message entered
message killed
message pulse

sector sec linkid=1


thing friendly mask=0x408
thing player local
thing enemy local


ai passive_ai
ai angry_ai


end


# ========================================================================================


code


startup:
player = GetLocalPlayerThing();
AISetClass(friendly, passive_ai);
return;

entered:
if(GetSourceRef() != player || GetSenderId() != 1) return;
SetPulse(1.0);
return;


killed:
SetPulse(0.0);
return;


pulse:
enemy = FirstThingInView(friendly, 170, 12, 0x4);

player = GetLocalPlayerThing();


if((enemy == friendly) || (enemy == player) || (!enemy))
{
AISetClass(friendly, passive_ai);
return;
}


AISetClass(friendly, angry_ai); 
AISetFireTarget(friendly, enemy);
AISetMoveThing(friendly, GetThingPos(enemy));
AISetLookPos(friendly, GetThingPos(enemy));
AISetMode(friendly, 0x202);
AIClearMode(friendly, 0x1000);


return;


end


That should work, but I haven't tested it.
2012-05-03, 10:19 AM #3
My rotten memory said about AI parameter to decide which side the character is on, assuming you're only trying to permanently change a character's side.
http://millennium.massassi.net/jkspec/ai.htm#a_header

↑ Up to the top!