PDA

View Full Version : Anybody got an idea on this cog?


Descent_pilot
06-09-2002, 10:59 AM
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.
# 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[i], xt);
AISetMoveThing(remote[i], GetThingPos(xt));
AISetMode(remote[i], 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

SaberMaster
06-10-2002, 07:49 AM
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 (http://www.geocities.com/sabersdomain/fileframe.html), Parsec (http://www.geocities.com/sabersdomain/fileframe.html), and the EditPlus Cog Files (http://www.geocities.com/sabersdomain/fileframe.html).
Visit Saber's Domain (http://www.geocities.com/sabersdomain).

Descent_pilot
06-10-2002, 02:36 PM
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