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 actor cog...
Friendly actor cog...
2002-12-05, 1:36 PM #1
You know how in MotS the rebel guys don't attack you? Well, in JK, how do I make it so that stormtroopers don't attack you, but attack anything besides other stormtroopers?

[This message has been edited by GabrielBlumenthal (edited December 05, 2002).]
"Intelligent people know of what they speak; fools speak of what they know."

- Minchas Shabbos Pirkei Avos 3:18 / Ethics Of The Fathers
2002-12-05, 3:39 PM #2
Like this.
Code:
# Jedi Knight COG Script
#
# FRIEND.COG
#
# A cog for a friendly actor.
# Kinda like Max, just better.
# Class Cog - Guard/Stationary version.
# Modified for GB to attack anything but an ST
#
# [DP]
#

symbols

thing		friend				local
thing		target				local
int		count=0				local

message	created
message	killed
message	pulse

end

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

code

Created:
	SetThingPulse(GetSenderRef(), 1);
	AIClearMode(GetSenderRef(), 0x1206);
	Return;

# ........................................................................................

Killed:
	If(GetThingClassCog(GetSenderRef()) != GetSelfCog()) Return;
	SetThingPulse(GetSenderRef(), 0);
	AIClearMode(GetSenderRef(), 0x1206);
	AISetMode(GetSenderRef(), 0x1);
	Return;

# ........................................................................................

Pulse:
      count = 0;
	friend = GetSenderRef();
	If(AIGetMode(friend) == 0x202) Return;		// So it keeps on the same target
	target = FirstThingInView(friend, 170, 12, 0x4);
	If(GetThingClassCog(target) == GetSelfCog()) target = -1;
	While((target == -1)&&(count < GetThingCount()))
	{
		target = NextThingInView();
		If(count == GetThingCount()) target = -1;
		If(GetThingClassCog(target) == GetSelfCog()) target = -1;
		count = count + 1;		// Incase there isn't anything in view
	}
	If(target != -1)		// If there's a target
	{
		CaptureThing(target);
		AISetFireTarget(friend, target);
		AISetMoveThing(friend, target);
		AISetLookPos(friend, GetThingPos(target));
		AISetMode(friend, 0x202);
		AIClearMode(friend, 0x1000);
	}
	Else AIClearMode(friend, 0x1206);
	Return;

end
That should work, just make sure all stormies have this class cog. Credit me for this.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-12-05, 3:54 PM #3
How do I implement this? and what's a class cog?
"Intelligent people know of what they speak; fools speak of what they know."

- Minchas Shabbos Pirkei Avos 3:18 / Ethics Of The Fathers
2002-12-06, 4:29 AM #4
Oh boy. Class cog = actor cog. So, open up the template, and change the cog=actor_whatever.cog to cog=actor_stdp.cog or whatever you called it. There is another way, just rename the cog to the st actor's origanal cog. That will overwrite it. But if this is for a custom level, don't rename.

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!