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 enemy help
friendly enemy help
2002-07-30, 6:06 PM #1
i followed the friendly enemies tutorial, and put in both the cogs, 06_max.cog and 06_maxstart.cog. for the mainmax(cog) entry for 06_maxstart.cog, the tutorial says to put in 06_max.cog, the first cog, but Jed says its an invalid entry. whats wrong?
2002-07-31, 1:05 AM #2
Hi, Fin. It sounds like you are typing in the full name of the COG in the maincog box. If you look over at the left hand side of the Placed Cogs box, however, you will see that each of the cogs you add is assigned a number. Put in the number assigned to 06_max.cog, and that should do the trick. Mind you, the enemy will still attack you around 50% of the time! Play around with the Sector that activates the cog, or use the great cogs that Sabermaster/GBK/Descent_pilot are probably working on as I write this! [http://forums.massassi.net/html/smile.gif]
2002-07-31, 11:17 AM #3
I didn't write this now, I wrote it awhile ago (for me). I added in some comments, and made the friend follow you. It is a great system and works very well, and is extremly reliable, execpt when your friend follows you around, he comes to your exact spot, no problem, just move away abit, and he doesn't push you much either. [http://forums.massassi.net/html/wink.gif]
Code:
# Jedi Knight COG Script
#
# A cog for a friendly actor to follow you around.
# Kinda like Max, just better.
#
# [DP]
#

symbols

thing		friend				mask=0x408
thing		player		nolink	local
thing		target				local
int		count					local

message	startup
message	killed
message	pulse

end

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

code

Startup:
	player = GetLocalPlayerThing();
	SetPulse(1);
	AIClearMode(friend, 0x1206);
	Return;

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

Killed:
	If(GetSenderRef() != friend) Return;
	SetPulse(0);
	AIClearMode(friend, 0x1206);
	AISetMode(friend, 0x1);
	Return;

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

Pulse:
	If(AIGetMode(friend) == 0x202) Return;		// So it keeps on the same target
	target = FirstThingInView(friend, 170, 12, 0x4);
	While((target != friend)&&(target != player)&&(target != -1)&&(count > GetThingCount()))
	{
		target = NextThingInView();
		If(count == GetThingCount()) 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		// If not, go to player
	If((VectorDist(GetThingPos(player), GetThingPos(friend))) > .5)
	{
		call followplayer;
		Return;
	}
	return;

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

FollowPlayer:
	AISetMoveThing(friend, player);
	AISetLookPos(friend, GetThingPos(player));
	AISetMode(friend, 0x1);
	AIClearMode(friend, 0x1206);
	return;

end
To make the friend not follow you, remove the parts in bold italic and replace the else statement with this one.
Code:
Else AIClearMode(friend, 0x1206);
Starts working on startup (ex. like MotS rebels). [http://forums.massassi.net/html/biggrin.gif]

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

The Magician Saber System.

[This message has been edited by Descent_pilot (edited July 31, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!