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 → Annoying cog problem.
Annoying cog problem.
2002-01-28, 3:45 PM #1
I'm getting really annoyed by this problem and I would like to know if anyone could help me. Im trying to get the 00_aisidekick cog to work for the player. What happens in the game, Is that when the entered message gets sent, the AI runs toward the spot where the walkplayer thing is, and not toward the player. Anybody know how I can do this, as it is driving me out of my skin. Thanks.
"The world is neither black nor white but differing shades of gray."
-By me.
2002-01-29, 9:33 AM #2
Post the cog, and we'll take a look.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-29, 2:49 PM #3
It's one of the cogs in Res2.gob. But I'll give ya the code.
Code:
# Jedi Knight Cog Script
#
# 00_Sidekick.cog
#
# Sidekick follows another character around. Sidekick should be a non-combatant. 
#
# [RD]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved     
# ========================================================================================

symbols
message	entered
message	killed
message	pulse

sector	trigger

thing		sidekick	linkid=0
thing		master	linkid=1

flex		followspeed=1
end

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

code

entered:
	SetPulse(1);
	AISetMoveSpeed(sidekick, followspeed);
	AISetMode(sidekick, 0x1);
	return;

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

killed:
	setpulse(0);
	return;

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

damaged:
	setpulse(0);
	return;

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

pulse:
	AISetLookPos(sidekick, masterpos);
	AISetMoveThing(sidekick, GetThingPos(master));
	return;

end

There.
"The world is neither black nor white but differing shades of gray."
-By me.
2002-01-29, 3:10 PM #4
Hmmmmm, well, you could make master local, and have master=GetLocalPlayerThing(); in a startup message. That'll fix it.
-Hell Raiser
2002-01-29, 3:20 PM #5
Well, I tried that already, and the guy moved. but he didnt keep following me...
"The world is neither black nor white but differing shades of gray."
-By me.
2002-01-29, 3:31 PM #6
Could it be that he's getting damaged somehow?
-Hell Raiser
2002-01-30, 9:10 AM #7
I hadn't realized that LEC left bugged cogs in the Res2 gob. RD must have been just getting started.

Try this cog:

Code:
# 00_aisidekick.cog
#
# Made the cog more self-contained, removed the errors, and beautified the code. -SM
#
# [RD + SM]
#===================================================================#
symbols

message	startup
message	entered
message	killed
message	pulse

sector	trigger

thing		sidekick
thing		player	local

flex		followspeed=1

int		begun	local

end
#===================================================================#
code
#----------------------------------------------------------------------
startup:
	begun=0;

Return;
#----------------------------------------------------------------------
entered:
	if(begun) Return;
	begun=1;
	player=GetLocalPlayerThing();
	AISetMoveSpeed(sidekick, followspeed);
	SetPulse(1);

Return;
#----------------------------------------------------------------------
killed:
	SetPulse(0);

Return;
#----------------------------------------------------------------------
pulse:
	AISetLookPos(sidekick, GetThingPos(player));
	AISetMoveThing(sidekick, player);

Return;
#----------------------------------------------------------------------
end


Don't know how it will look ingame, but it should be alright. [http://forums.massassi.net/html/smile.gif] Reply if it doesn't work correctly.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-30, 9:14 AM #8
BTW, damaged never ran because it wasn't listed in the symbols. And the reason the sidekick ran away was because AISetMoveThing() was mistakenly given a position (which wasn't even defined) instead of a thing.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-30, 3:00 PM #9
THANK YOU!!! Thank you ever so much. That has made my day. [http://forums.massassi.net/html/wink.gif] His only problem is that when damaged a little(not enough to kill) he still follows you, but that's not a problem for what I'm going to use the cog for. Thanks. [http://forums.massassi.net/html/smile.gif]
"The world is neither black nor white but differing shades of gray."
-By me.
2002-02-01, 3:25 AM #10
You're welcome. [http://forums.massassi.net/html/wink.gif]

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!