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 → Anybody got an idea on this cog?
Anybody got an idea on this cog?
2002-06-09, 7:59 AM #1
I'm trying to make the xt battle four remotes. [http://forums.massassi.net/html/smile.gif] Once the remotes are destroyed, xt will attack me. [http://forums.massassi.net/html/eek.gif] (Run for your lives!)
The first part is my problem, the remotes just stand still, they won't get close enough for xt to saber them. Otherwise, they hang near me. [http://forums.massassi.net/html/confused.gif] Here's the cog.
Code:
# Jedi Knight Cog Script
#
# xt_rlx.COG
#
# Controls the xt battling remotes
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

thing		xt
thing		remote
thing		remote1
thing		remote2
thing		remote3
thing		target					local
thing		player					local

int		i						local
int		count=0					local

material	tip_mat=saberred0.mat			local
material	side_mat=saberred1.mat			local
template	tpl_wall=+ssparks_wall			local
template	tpl_blood=+ssparks_blood		local
template	tpl_saber=+ssparks_saber		local

message	startup
message	pulse
message	killed

end                                                                           

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

code
startup:
	jkSetSaberInfo(xt, side_mat, tip_mat, 0.003, 0.001, 0.101, tpl_wall, tpl_blood, tpl_saber);
	jkSetFlags(xt, 0x5);
	count = 0;
	SetPulse(0.1);
	Return;

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

pulse:
	target = FirstThingInView(xt, 170, 12, 0x4);
	
	player = GetLocalPlayerThing();

	if(count >= 4) SetPulse(0);
	if((target == xt) || (target == player) || (!target))
	{
		return;
	}
		
	AISetFireTarget(xt, target);
	AISetMoveThing(xt, GetThingPos(target));
	AISetMode(xt, 0x20a);
	AIClearMode(xt, 0x1000);

	For(i=0; i<=4; i=i+1)
	{
		AISetFireTarget(remote, xt);
		AISetMoveThing(remote, GetThingPos(xt));
		AISetMode(remote, 0x20a);
	}

	Return;

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

killed:
	If(GetSenderRef != xt)
	{
		count = count + 1;
		PrintInt(count);
	}
	SetPulse(0);
	jkSetFlags(darkjedi, 0x8);
	Return;

end

Any ideas, because I'm stumped. [http://forums.massassi.net/html/frown.gif] Both xt and the remotes have new/modified AI files. The AI and Templates check out fine.

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-06-10, 4:49 AM #2
First, your cog won't run because of syntax errors. GetSenderRef() must have a set of parentheses, or it wouldn't be a verb. Parsec would have caught that and one or two other things.

As for your code: using a fast pulse to continually reset your actors' attack settings is not good coding. Also, do you know what those AI mode flags do? If setting or clearing a mode flag doesn't appear to do anything, don't use it.

What I would do is have the xt attack the remotes one by one. When he kills one, the killed message will be called, and the xt can be told to attack the next one. The remotes can be initialized on startup.

The problem with this is that the remotes could start attacking the player, but you might be able to fix this with mode flags or the ai file. Also, the remotes might want to attack from a distance - out of saber range.

Well, perhaps I've given you an idea of how to do what you want. I can't say for sure, because with these type of projects, some unexpected problem usually appears. Good luck. [http://forums.massassi.net/html/wink.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-06-10, 11:36 AM #3
Once agian, thanks SaberMaster. I'll try both ideas and see which works better. I'm not a master like GBK, but I'm better then the average. [http://forums.massassi.net/html/biggrin.gif] You can see how the end of school is getting to me()! [http://forums.massassi.net/html/redface.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!