PDA

View Full Version : AiJump



DogSRoOL
04-15-2003, 10:15 AM
Woohoo. The forums are back!

I am creating a cutscene in JK. After executing the AIJump command, the actor will stop at the jump pos and not move anymore. How do I fix this?

------------------
May the forks be with you.
AOL - providing excellent internet connection until you leave their domain.
There is a great disturbance in my shorts...

[SF]pjb
04-15-2003, 12:06 PM
thats new to me, whats it ment to do after?

------------------
I am pjb.
Another post......
another moment of my life wasted.....

DogSRoOL
04-15-2003, 02:44 PM
After he jumps onto a large window ledge, he's supposed to move to the next frame (10) and play a key to break the window, but instead backs up to the jump point and stays there. I have the cog print the frame each time the actor arrives at it, and it never reaches 10.

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 15, 2003).]

[SF]pjb
04-16-2003, 12:50 AM
sounds liek the errors in the cog, youd better post it

------------------
I am pjb.
Another post......
another moment of my life wasted.....

DogSRoOL
04-16-2003, 11:45 AM
Ok, you asked for it...


symbols
Message Startup
Message Arrived
Message Pulse
Message User0

Thing Camera1
Thing Camera2
Thing Camera3
Thing CentralFocusGhost
Thing Jane
Thing Zorb
Thing Kat
Thing ZorbSpawn
Thing ZorbLand
Thing UFO
Thing Player local
Thing SparkyGhost
Thing FocalObject local

Template ZorbTmpl=Zorb
Template Sparks=+sparks2
#Template SmoothSailor=GhostAI

int Status=0 local
int ZorbCurFrame local
int CurAnim local

keyframe ShipAnim0=00UFOFLY.key
keyframe ShipLand=UFO_LnO.key
keyframe Anim1=ZorbInfl.key
Keyframe Anim3=ZorbKill.key
Keyframe Anim5=ZorbKick.key
Keyframe Anim6=ZrbStmbl.key
# Keyframe JaneAnim=Janejolt.key

cog AccessCog=01_CastleAccess.cog
cog JanesRoom=00_door.cog
cog LightingCog=AdvancedLighting.cog

end

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

code
Startup:
AiClearMode(Zorb, AiGetMode(Zorb)); // clear current AI mode
AiSetMode(Zorb, 0x1);
jkBeginCutscene();
FocalObject = UFO;
SetPulse(0.01); // about 100 pps (pulses per second)
Player=GetLocalPlayerThing();
SetActorFlags(player, 0xa00008); // invulnerable, immobilized, no HUD.
SetThingFlags(player, 0x10); // invisible.
SetCurrentCamera(0);
SetCameraFocus(0, Camera1);
SendMessageEX(LightingCog, User0, Camera1, 0, 0, 0);
CurAnim = PlayKey(UFO, ShipAnim0, 1, 0x4);
Sleep(GetKeyLen(ShipAnim0));
StopKey(UFO, ShipAnim0, 0);
JumpToFrame(UFO, 1, GetThingSector(UFO));
PlayKey(UFO, ShipLand, 1, 0x4);
Sleep(GetKeyLen(ShipLand));
TeleportThing(Zorb, ZorbSpawn); // Appear to jump from ship
Sleep(0.05);
StopThing(Zorb);
Sleep(1.05);
FocalObject = Zorb;
ZorbCurFrame=0;
AiSetMoveSpeed(Zorb, 1.0);
AiSetLookFrame(Zorb, 0);
AiSetMoveFrame(Zorb, 0);
Return;

Arrived:
if(GetSenderRef() == Transitioner)
{
FocalObject=CentralFocusGhost;
Return;
}

if(GetSenderRef() == Zorb)
{
Print("Arrived at frame:");
PrintInt(ZorbCurFrame);
if(ZorbCurFrame == 0)
{
AiSetLookFrame(Zorb, 1);
AiSetMoveFrame(Zorb, 1);
ZorbCurFrame=1;
Return;
}
else if(ZorbCurFrame==1)
{
// Zorb breaks in.
MoveToFrame(Camera1, 1, 1);
AiSetLookFrame(Zorb, 2);
CurAnim = PlayKey(Zorb, Anim1, 1, 0x4);
Sleep(5.5275);
SendMessageEX(AccessCog, User0, GetSelfCog(), 0, 0, 0);
CreateThing(Sparks, SparkyGhost);
Sleep(GetKeyLen(Anim1)-5.5275);
MoveToFrame(Camera1, 3, 0.85);
StopKey(Zorb, CurAnim, 0); // apparently, I have to use a new variable instead of the one...
Return; // ...actually representing the key file.
}
else if(ZorbCurFrame==2) // this doesn't happen until the sent message is returned (in User0 below)
{
// inside the fortress now
SetPulse(0.01);
SendMessageEX(LightingCog, User0, -1, 0, 0, 0);
SetCameraFocus(0, Camera2);
AiSetMoveSpeed(0.75);
AiSetLookFrame(Zorb, 3);
AiSetMoveFrame(Zorb, 3);
ZorbCurFrame=3;
Return;
}
else if(ZorbCurFrame==3)
{
AiSetLookFrame(Zorb, 4);
AiSetMoveFrame(Zorb, 4);
ZorbCurFrame=4;
MoveToFrame(Camera2, 1, 2.7);
Return;
}
else if(ZorbCurFrame==4)
{
AiSetLookFrame(Zorb, 5);
AiSetMoveFrame(Zorb, 5);
ZorbCurFrame=5;
Return;
}
else if(ZorbCurFrame==5)
{
SetCameraFocus(0, Camera3);
SendMessageEX(LightingCog, User0, Camera3, 0, 0, 0);
SendMessage(JanesRoom, Activated);
Sleep(0.2);
// now going into Jane's Room.
AiSetMoveSpeed(Zorb, 0.6);
AiSetLookFrame(Zorb, 6);
AiSetMoveFrame(Zorb, 6);
ZorbCurFrame=6;
Sleep(1.0);
MoveToFrame(Camera3, 4, 2.0);
Return;
}
else if(ZorbCurFrame==6)
{
FocalObject=CentralFocusGhost;
AiSetLookFrame(Zorb, 7);
AiSetMoveFrame(Zorb, 7);
ZorbCurFrame=7;
Return;
}
else if(ZorbCurFrame==7)
{
// now at Jane's bedside about to kill her.
AiSetLookThing(Zorb, Jane);
// kill jane.
CurAnim = PlayKey(Zorb, Anim3, 1, 0x4);
Sleep(3.5);
FocalObject = Zorb; // *****change this to Kat later*****
Sleep(GetKeyLen(Anim3)-3.5);
StopKey(Zorb, CurAnim, 0);
AiSetMoveSpeed(Zorb, 1.5);
AiSetLookFrame(Zorb, 8);
AiSetMoveFrame(Zorb, 8);
ZorbCurFrame=8;
Return;
}
else if(ZorbCurFrame==8)
{
AiSetMoveSpeed(Zorb, 1.25);
AiSetLookFrame(Zorb, 9);
AiSetMoveFrame(Zorb, 9);
ZorbCurFrame=9;
MoveToFrame(Camera3, 2, 2.25);
Return;
}
else if(ZorbCurFrame==9)
{
// Zorb jumps onto the window ledge
AiJump(Zorb, ZorbLand, 0.15);
AiSetMoveSpeed(Zorb, 1.0);
AiSetLookFrame(Zorb, 10);
AiSetMoveFrame(Zorb, 10);
ZorbCurFrame=10;
Return;
}
else if(ZorbCurFrame==10)
{
CurAnim = PlayKey(Zorb, Anim5, 1, 0x4);
Sleep(GetKeyLen(Anim5));
StopKey(Zorb, CurAnim, 0);
AiSetMoveSpeed(Zorb, 0.75);
AiSetLookFrame(Zorb, 11);
AiSetMoveFrame(Zorb, 11);
ZorbCurFrame=11;
Return;
}
else if(ZorbCurFrame==11)
{
PlayKey(Zorb, Anim6, 1, 0x4);
Return;
}
Return;
}
else return;

User0:
// Sent from 01_CastleAccess.cog (Variable: AccessCog) when cog completes directives.
MoveToFrame(Camera1, 4, 1.25);
AiSetLookFrame(Zorb, 2);
AiSetMoveFrame(Zorb, 2);
ZorbCurFrame=2;
Return;

Pulse:
if(FocalObject > -1)
{
SetThingLook(Camera1, VectorSub(GetThingPos(FocalObject), GetThingPos(Camera1)));
SetThingLook(Camera2, VectorSub(GetThingPos(FocalObject), GetThingPos(Camera2)));
SetThingLook(Camera3, VectorSub(GetThingPos(FocalObject), GetThingPos(Camera3)));
}
Return;
# .................................................. ......................................

end

This cog is still under construction, so I might have variables that I didn't use yet or something.
...And I've already tried adding a pause after jumping, at it doesn't do any good.

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 16, 2003).]

DogSRoOL
04-18-2003, 12:00 PM
I still haven't figured this out!
http://forums.massassi.net/html/confused.gif

------------------
May the forks be with you.
There is a great disturbance in my shorts...

Edward
04-19-2003, 12:52 PM
There might be a problem with the AIJump... Now I don't know how an AIJump is supposed to be implemented but that is my guess. How about a sleep after the jump?

/Edward

DogSRoOL
04-19-2003, 01:32 PM
AiJump(actor, jumpghost, flex_height);
Jumps to a thing, but only seems to work if your ai file has a jump argument. And I tried adding a sleep, but it doesn't seem to make a difference. Thanks anyway, though. http://forums.massassi.net/html/wink.gif
Btw, the AIJump is in the section that starts "else if(ZorbCurFrame==9)". Could it be something with AiMode, or possibly PlayMode? (I don't actually know what that one does).

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 20, 2003).]

[SF]pjb
04-27-2003, 03:17 PM
well i hae the o'l fahioned aproch to stuff, What is that you ask?

"if da cog wont do it, make a key" you cam move the object around, and stuff with keys, so why not make a new key for the actor then use that insted?

------------------
I am pjb.
Another post......
another moment of my life wasted.....

DogSRoOL
04-27-2003, 08:17 PM
That was actually the first thing I tried (because I couldn't figure out AIJump), and when I stop the key (I have to, or the actor won't play the walk key), the actor just goes back to the point from whence he jumped.

------------------
May the forks be with you.
There is a great disturbance in my shorts...

DSLS_DeathSythe
04-27-2003, 08:39 PM
http://forums.massassi.net/html/smile.gif hi me again. i had to test this one too. heres the cog:


# Written By DSLS_DeathSythe
symbols
#=====
message startup
message arrived
thing actor=-1
int cur_frame=0 local
thing land_thng=-1
vector land_pos local
int jumping=0 local
#-----
end
#=====
code
#-----
startup:
Sleep(2.0);
land_pos = GetThingPos(land_thng);
jumping = 0;
cur_frame = 0;
AiSetMoveSpeed(actor, 1.0);
AiSetLookFrame(actor, 0);
AiSetMoveFrame(actor, 0);
return;
#-----
arrived:
Print("arrived at frame...");
if(cur_frame == 0)
{
cur_frame = 1;
AiSetLookFrame(actor, 1);
AiSetMoveFrame(actor, 1);
return;
}
if(cur_frame == 1)
{
cur_frame = 2;
AiSetLookFrame(actor, 2);
AiSetMoveFrame(actor, 2);
return;
}
if(cur_frame == 2)
{
cur_frame = 3;
AiJump(actor, land_pos, 0.15);
jumping = 1;
// AiSetLookFrame(actor, 3);
// AiSetMoveFrame(actor, 3);
return;
}
if(jumping == 1)
{
Print("Landed jump...");
jumping = 0;
AiSetLookFrame(actor, 3);
AiSetMoveFrame(actor, 3);
return;
}
if(cur_frame == 3)
{
cur_frame = 4;
AiSetLookFrame(actor, 4);
AiSetMoveFrame(actor, 4);
return;
}
if(cur_frame == 4)
{
cur_frame = 5;
AiSetLookFrame(actor, 5);
AiSetMoveFrame(actor, 5);
return;
}
return;
#=====
end

its a little simplar than yours but works. in my cog 'if(cur_frame==2)' is where it does the jump. from what i learned it seems that the AiJump sends the arrived message, and some how that is messing things up when you try to do AiJump and AiSetMoveFrame at the same time.
try to divide it like how i did and see if that fixes it for you.

------------------


[This message has been edited by DSLS_DeathSythe (edited April 28, 2003).]

[SF]pjb
04-28-2003, 04:34 AM
well at least my idea was partly corect.

------------------
I am pjb.
Another post......
another moment of my life wasted.....

DogSRoOL
04-28-2003, 09:25 AM
Actually, he jumps at frame 9 (I think) but I'll add something like that in a few minutes. Thanks.

------------------
May the forks be with you.
There is a great disturbance in my shorts...

DogSRoOL
04-28-2003, 02:06 PM
That didn't work, either. The "arrived" message just isn't being sent after he jumps. Here's something else that might be useful: I tried using a pulse to keep telling him to go to the next frame, and it worked, but when he reached frame 11, he went back to frame 10 and kept going between the 2 (though I haven't really finished that part of the cog, yet because of this jump problem).

------------------
May the forks be with you.
There is a great disturbance in my shorts...

DSLS_DeathSythe
04-28-2003, 02:07 PM
it did in my cog. post your cog with the changes.

------------------
Famous last words - "It seemed like a good idea at the time."

DogSRoOL
04-28-2003, 02:09 PM
symbols
Message Startup
Message Arrived
Message Pulse
Message User0

Thing Camera1
Thing Camera2
Thing Camera3
Thing CentralFocusGhost
Thing Jane
Thing Zorb
Thing Kat
Thing ZorbSpawn
Thing ZorbLand
Thing UFO
Thing Player local
Thing SparkyGhost
Thing FocalObject local

Template Sparks=+sparks2

int ZorbCurFrame local
int ZorbJumping=0 local
int CurAnim local
int debug=0

keyframe ShipAnim0=00UFOFLY.key
keyframe ShipLand=UFO_LnO.key
keyframe Anim1=ZorbInfl.key
Keyframe Anim3=ZorbKill.key
Keyframe Anim5=ZorbKick.key
Keyframe Anim6=ZrbStmbl.key
Keyframe JaneAnim=Janejolt.key

cog AccessCog
cog JanesRoom
cog LightingCog

end

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

code
Startup:
AiClearMode(Zorb, AiGetMode(Zorb)); // clear current AI mode
AiSetMode(Zorb, 0x1);
jkBeginCutscene();
SetPulse(0.01); // about 100 pps (pulses per second)
FocalObject = UFO;
Player=GetLocalPlayerThing();
SetActorFlags(player, 0xa00008); // invulnerable, immobilized, no HUD.
SetThingFlags(player, 0x10); // invisible.
SetCurrentCamera(0);
SetCameraFocus(0, Camera1);
SendMessageEX(LightingCog, User0, Camera1, 0, 0, 0);
CurAnim = PlayKey(UFO, ShipAnim0, 1, 0x4);
Sleep(GetKeyLen(ShipAnim0));
StopKey(UFO, ShipAnim0, 0);
JumpToFrame(UFO, 1, GetThingSector(UFO));
PlayKey(UFO, ShipLand, 1, 0x4);
Sleep(GetKeyLen(ShipLand));
TeleportThing(Zorb, ZorbSpawn); // Appear to jump from ship
Sleep(0.05);
StopThing(Zorb);
Sleep(1.05);
FocalObject = Zorb;
ZorbCurFrame=0;
AiSetMoveSpeed(Zorb, 1.0);
AiSetLookFrame(Zorb, 0);
AiSetMoveFrame(Zorb, 0);
Return;

Arrived:
if(GetSenderRef() == Zorb)
{
if(debug)
{
Print("Arrived at frame:");
PrintInt(ZorbCurFrame);
}
if(ZorbCurFrame == 0)
{
AiSetLookFrame(Zorb, 1);
AiSetMoveFrame(Zorb, 1);
ZorbCurFrame=1;
Return;
}
else if(ZorbCurFrame==1)
{
// Zorb breaks in.
MoveToFrame(Camera1, 1, 1);
AiSetLookFrame(Zorb, 2);
CurAnim = PlayKey(Zorb, Anim1, 1, 0x4);
Sleep(5.5275);
SendMessageEX(AccessCog, User0, GetSelfCog(), 0, 0, 0);
CreateThing(Sparks, SparkyGhost);
Sleep(GetKeyLen(Anim1)-5.5275);
MoveToFrame(Camera1, 3, 0.85);
StopKey(Zorb, CurAnim, 0); // apparently, I have to use a new variable instead of the one...
Return; // ...actually representing the key file.
}
else if(ZorbCurFrame==2) // this doesn't happen until the sent message is returned (in User0 below)
{
// inside the fortress now
SetPulse(0.01);
SendMessageEX(LightingCog, User0, -1, 0, 0, 0);
SetCameraFocus(0, Camera2);
AiSetMoveSpeed(Zorb, 0.75);
AiSetLookFrame(Zorb, 3);
AiSetMoveFrame(Zorb, 3);
ZorbCurFrame=3;
Return;
}
else if(ZorbCurFrame==3)
{
AiSetLookFrame(Zorb, 4);
AiSetMoveFrame(Zorb, 4);
ZorbCurFrame=4;
MoveToFrame(Camera2, 1, 2.0);
Return;
}
else if(ZorbCurFrame==4)
{
AiSetLookFrame(Zorb, 5);
AiSetMoveFrame(Zorb, 5);
ZorbCurFrame=5;
Return;
}
else if(ZorbCurFrame==5)
{
SetCameraFocus(0, Camera3);
SendMessageEX(LightingCog, User0, Camera3, 0, 0, 0);
SendMessage(JanesRoom, Activated);
Sleep(0.2);
// now going into Jane's Room.
AiSetMoveSpeed(Zorb, 0.6);
AiSetLookFrame(Zorb, 6);
AiSetMoveFrame(Zorb, 6);
ZorbCurFrame=6;
Sleep(1.0);
MoveToFrame(Camera3, 4, 2.0);
Return;
}
else if(ZorbCurFrame==6)
{
FocalObject=CentralFocusGhost;
AiSetLookFrame(Zorb, 7);
AiSetMoveFrame(Zorb, 7);
ZorbCurFrame=7;
Return;
}
else if(ZorbCurFrame==7)
{
// now at Jane's bedside about to kill her.
AiSetLookPos(Zorb, GetThingPos(Jane));
// kill jane.
CurAnim = PlayKey(Zorb, Anim3, 1, 0x4);
Sleep(3.5);
FocalObject = Zorb; // *****change this to Kat later*****
Sleep(GetKeyLen(Anim3)-3.5);
StopKey(Zorb, CurAnim, 0);
AiSetMoveSpeed(Zorb, 1.5);
AiSetLookFrame(Zorb, 8);
AiSetMoveFrame(Zorb, 8);
ZorbCurFrame=8;
Return;
}
else if(ZorbCurFrame==8)
{
AiSetMoveSpeed(Zorb, 1.25);
AiSetLookFrame(Zorb, 9);
AiSetMoveFrame(Zorb, 9);
ZorbCurFrame=9;
MoveToFrame(Camera3, 2, 2.25);
Return;
}
else if(ZorbCurFrame==9)
{
// Zorb jumps onto the window ledge
AiJump(Zorb, GetThingPos(ZorbLand), 0.15);
ZorbJumping=1;
ZorCurFrame=-1;
Return;
}
else if(ZorbCurFrame==10)
{
AiSetMoveSpeed(Zorb, 0.75);
AiSetLookFrame(Zorb, 11);
AiSetMoveFrame(Zorb, 11);
ZorbCurFrame=11;
Return;
}
else if(ZorbCurFrame==11)
{
PlayKey(Zorb, Anim6, 1, 0x4);
Return;
}
if(ZorbJumping == 1)
{
if(debug) Print("Zorb should be moving by now.");
ZorbJumping=0;
AiSetMoveSpeed(Zorb, 1.0);
AiSetLookFrame(Zorb, 10);
AiSetMoveFrame(Zorb, 10);
CurAnim = PlayKey(Zorb, Anim5, 1, 0x4);
Sleep(GetKeyLen(Anim5));
StopKey(Zorb, CurAnim, 0);
ZorbCurFrame=10;
Return;
}
}
return;

User0:
// Sent from 01_CastleAccess.cog (Variable: AccessCog) when cog completes directives.
MoveToFrame(Camera1, 4, 1.25);
AiSetLookFrame(Zorb, 2);
AiSetMoveFrame(Zorb, 2);
ZorbCurFrame=2;
Return;

Pulse:
if(FocalObject > -1)
{
SetThingLook(Camera1, VectorSub(GetThingPos(FocalObject), GetThingPos(Camera1)));
SetThingLook(Camera2, VectorSub(GetThingPos(FocalObject), GetThingPos(Camera2)));
SetThingLook(Camera3, VectorSub(GetThingPos(FocalObject), GetThingPos(Camera3)));
}
Return;

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

end

------------------
May the forks be with you.
There is a great disturbance in my shorts...

DSLS_DeathSythe
04-28-2003, 02:23 PM
try putting it in this way.


if(ZorbCurFrame == 9)
{
if(ZorbJumping == 0)
{
ZorbJumping = 1;
AiJump(Zorb, GetThingPos(ZorbLand), 0.15);
return;
}
else
if(ZorbJumping == 1)
{
Print("Landed jump...");
ZorbJumping = 0;
ZorbCurFrame = 10;
AiSetLookFrame(Zorb, 10);
AiSetMoveFrame(Zorb, 10);
return;
}
}

i just tried it and it worked for me.

------------------
Famous last words - "It seemed like a good idea at the time."

DogSRoOL
04-28-2003, 03:23 PM
I still get nothing after jumping onto the ledge (except the same backwards step to the jump thing). Am I possibly placing the jump thing incorrectly (or need something else besides the jump argument in the ai)?

------------------
May the forks be with you.
There is a great disturbance in my shorts...

DSLS_DeathSythe
04-28-2003, 04:13 PM
http://forums.massassi.net/html/frown.gif dang it all.

the template i used to test my cog was the icommando guy and i used a ghost to mark where i wanted him to land. i put the ghost about 0.15 above the ground that he was to land on and about 0.2 in from the ledge. the ledge was 0.2 tall from the ground where he jumps.
it works for me, why in the world wont it work for you? http://forums.massassi.net/html/confused.gif
i could try to rewrite your cog? but i dont know if that will make a difference. you'd have to test it because i dont have the other keys or stuff.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited April 28, 2003).]

DSLS_DeathSythe
04-28-2003, 08:40 PM
well i was looking through your cog you posted and i found a typo that might have messed things up.
in your cog you have:


else
if(ZorbCurFrame==9)
{
// Zorb jumps onto the window ledge
AiJump(Zorb, GetThingPos(ZorbLand), 0.15);
ZorbJumping=1;
ZorCurFrame=-1; //<--TYPO should be ZorbCurFrame!!!
Return;
}

dont know if you noticed that, if you didnt it may have been the problem.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited April 28, 2003).]

DogSRoOL
04-28-2003, 10:43 PM
Oops. Forgot to remove that section after making changes, and I noticed I forgot a } at the end before a return, too, but it still does the same thing. To me, it seems as though the AiJump verb isn't being completed. Is there a way to cancel it after a sleep command?

------------------
May the forks be with you.
There is a great disturbance in my shorts...
Thank you for reading this post. You owe me $24.95 + S&H.

DogSRoOL
04-28-2003, 11:10 PM
OK, here's some stats on that part of the level. The ledge is .1 from the ground, and the ghost (at the moment) is .12 from the ledge, but I keep moving it up or down to see if it makes a difference, and it only does if I put it way too high.
The Template:
Zorb _humanactor size= size=0.065000 movesize=0.065000 model3d=Zorb.3do staticdrag=0 typeflags=0x2000001 puppet=Zorb.pup aiClass=Zorb.AI soundclass=ky.snd
The AI:

# The Dog Series - AI File
# Written by Brandon Bull
#
# Zorb.AI
#
# Zorb's Generic AI

alignment=-0.95, rank=1.0, fov=170, maxstep=1.0, sightdist=5.0, heardist=6.0, accuracy=0.20

jump 25, 0.5, 0.5
Maybe that'll help?

------------------
May the forks be with you.
There is a great disturbance in my shorts...
Thank you for reading this post. You owe me $24.95 + S&H.

[This message has been edited by DogSRoOL (edited April 28, 2003).]

DSLS_DeathSythe
04-29-2003, 09:14 PM
ok i have something for you to try that ive been playing around with. this is a cog i made:


symbols
#=====
message startup
message arrived
message timer
thing actor=-1
int cur_frame=0 local
vector actor_vel local
vector new_vel local
flex jump=1.3
flex guess=3.15
keyframe jumpanim
int curanim=-1 local
#-----
end
#=====
code
#-----
startup:
Sleep(2.0);
Print("moving actor");
cur_frame = 0;
AiSetMoveSpeed(actor, 1.0);
AiSetLookFrame(actor, 0);
AiSetMoveFrame(actor, 0);
return;
#-----
arrived:
Print("arrived at frame...");
if(cur_frame == 0)
{
cur_frame = 1;
AiSetLookFrame(actor, 1);
AiSetMoveFrame(actor, 1);
return;
}
if(cur_frame == 1)
{
cur_frame = 2;
AiSetLookFrame(actor, 2);
AiSetMoveFrame(actor, 2);
SetTimer(guess);
return;
}
if(cur_frame == 2)
{
Print("Landed jump...");
StopThing(actor);
Sleep(0.25);
cur_frame = 3;
AiSetLookFrame(actor, 3);
AiSetMoveFrame(actor, 3);
return;
}
if(cur_frame == 3)
{
cur_frame = 4;
AiSetLookFrame(actor, 4);
AiSetMoveFrame(actor, 4);
return;
}
if(cur_frame == 4)
{
cur_frame = 5;
AiSetLookFrame(actor, 5);
AiSetMoveFrame(actor, 5);
return;
}
return;
#-----
timer:
//--MAKE THE AI JUMP--//
Print("jumping");
land_pos = VectorSet(0.0, 0.0, jump);
actor_vel = GetThingVel(actor);
new_vel = VectorAdd(land_pos, actor_vel);
DetachThing(actor);
curanim = PlayKey(actor, jumpanim, 3, 0x2);
SetThingVel(actor, new_vel);
return;
#=====
end

if you read through it youll notice thate it doesnt have the AiJump verb in there. since we are having trouble with it i decided to try a different way of making him jump. i made the actor do something like a forcejump.

heres how to set it up in yours. its kind of difficult but ill try to explain it as best i can and trust in your cogging skills the rest of the way.

first the ai file:
i took the icommando's ai file and tagged out all its ai stuff. so its like this:


# Jedi Knight AI File
# ICDEFAULT.AI
# Imperial Commando with Rifle AI
# Medium difficulty
# [CR]
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

alignment=-1.0, rank=0.5, fov=200, maxstep=0.5, sightdist=5.0, heardist=2.0, accuracy=0.25

#instinct args
#Jump 4000.0, 0.3, 0.3
#LookForTarget 500.0, 75000.0
#Listen 0.50, 2.0
#PrimaryFire 3000.0, 0.8, 5.0, 0.20, 0.0, 200.0, 0.50, 0.00, 3.0, 500.0
#BlindFire 1500.0, 0.75, 0, 0.8, 0.0, 0.10
#Follow 1.0, 2.0
#OpenDoors
#CircleStrafe 5000.0, 30.0, 2.0, 1000.0, 0.0
#ReturnHome
#Withdraw 5000.0, 1.5
#Retreat 0.50, 0.25, 2000.0, 1.0
#Talk 10000.0, 0.10
#Dodge 0.2, 0.1

for this method it doesnt need the 'jump' in the ai file or anything else.

second the actors frames (Zorb for you):
i had to change the frames a bit. in my cog the actor does the jump while he is heading to frame 3. in other words dont have him stop right before he is to jump. put a frame where you want him to land on the edge. and in the frame before (frame 2 for me) just head him on to the next frame that is up on the ledge. make sense thats an important part. he needs to be moving for this jump to work otherwise he just does a jump straight up.

third the cog:
this is what you will need to add to your cog:


//-Symbols-//
message timer
vector actor_vel local
vector new_vel local
flex jump=1.3
flex guess=3.15
keyframe jumpanim
//-This is the code-//
//--Set guess timer...
SetTimer(guess);
//--Stop the him once he reaches the jump frame...
Print("Landed jump...");
StopThing(actor);
Sleep(0.25);
//--MAKE THE AI JUMP--//
timer:
Print("jumping");
land_pos = VectorSet(0.0, 0.0, jump);
actor_vel = GetThingVel(actor);
new_vel = VectorAdd(land_pos, actor_vel);
DetachThing(actor);
curanim = PlayKey(actor, jumpanim, 3, 0x2);
SetThingVel(actor, new_vel);
return;

ok, now the symbols stuff goes up in the symbols (duh...).
the SetTimer(guess) goes right after you send the actor on to the frame on the ledge. (look at my cog if that doesnt make sense)
the StopThing() and stuff goes in where he reaches the frame on the ledge, put it above anything else so he does it first. (again look at my cog if you dont get it)
the timer: stuff just goes in the timer message place.

the symbols you need to worry about are:
-----
flex jump=1.3
flex guess=3.15
keyframe jumpanim
-----
jump is how high he jumps. (for my testing purposes it was 1.3)
guess is a guess on how long it takes him to get to where you want him to make the jump from when you send him on to the the frame on the ledge.
jumpanim is the keyframe in the 'rising' part of your pup file for the actor. making him jump like this doesnt play this key so we have to do it ourselves when we make him jump.

ok so basically what we are doing is telling him to go straight for the frame on the ledge and at the same time setting a timer that goes off when he gets close to the ledge and we want him to make the jump. the timer goes off, he jumps and lands at the frame on the ledge. then goes on to do what ever else he is supposed to do.

hmmm... i may not have done a very good job explaining that. its alot harder to explain than to make. hopfully it makes some kind of sense to you. try it and see if you can get it to work and if it gets you the results you want.

------------------
Famous last words - "It seemed like a good idea at the time."

[This message has been edited by DSLS_DeathSythe (edited April 29, 2003).]

DogSRoOL
04-29-2003, 11:02 PM
*heavenly chorus*

It WORKED! I just added the part changing the velocity & detaching the actor from the floor to the section when he reaches frame 9. Didn't really need the key to play.

Thanx a heap!!!!!! http://forums.massassi.net/html/biggrin.gif

------------------
May the forks be with you.
There is a great disturbance in my shorts...
Thank you for reading this post. You owe me $24.95 + S&H.

DSLS_DeathSythe
04-30-2003, 01:55 PM
http://forums.massassi.net/html/biggrin.gif what ever works

------------------
Famous last words - "It seemed like a good idea at the time."