PDA

View Full Version : Cogs, frames, & transport


F-Body
07-11-2004, 08:38 AM
Hi, I am just wondering which is the most efficient/best way of making a troop transport move thru multiple frames. Would it be best if I make a .key? Or how about thingframes? Or even moving to ghost positions, all representing frames?

Here's what I made so far, is there a better way? (There are 3 stops, hence Sleep)
# Jedi Knight Cog Script
#
# myspeeder.cog
#
# The speeder will go to all frames & loop from to 0 when
# a ghost position is activated (ghost pos=near computer screen).
#
# [F-Body]
#
# This cog was not made or supported by LucasArts Entertainment Company


symbols
message activate
message arrived

thing speeder linkid=1
thing ghost_activate linkid=2

flex sleeptime=3.0 local
end

code
activate:
if (IsThingMoving(speeder)) return;
if (GetSenderId() != 2) return;
if (GetCurFrame(speeder) == 0)
{
MoveToFrame(speeder, 1, 8);
}
return;

arrived:
if (GetCurFrame(speeder) == 1)
{
MoveToFrame(speeder, 2, 10);
}
if (GetCurFrame(speeder) == 2)
{
MoveToFrame(speeder, 3, 14);
}
if (GetCurFrame(speeder) == 3)
{
Sleep(sleeptime);
MoveToFrame(speeder, 4, 16);
}
if (GetCurFrame(speeder) == 4)
{
MoveToFrame(speeder, 5, 8);
}
if (GetCurFrame(speeder) == 5)
{
MoveToFrame(speeder, 6, 10);
}
if (GetCurFrame(speeder) == 6)
{
MoveToFrame(speeder, 7, 10);
}
if (GetCurFrame(speeder) == 7)
{
MoveToFrame(speeder, 8, 8);
}
if (GetCurFrame(speeder) == 8)
{
MoveToFrame(speeder, 9, 16);
}
if (GetCurFrame(speeder) == 9)
{
MoveToFrame(speeder, 10, 20);
}
if (GetCurFrame(speeder) == 10)
{
MoveToFrame(speeder, 11, 25);
}
if (GetCurFrame(speeder) == 11)
{
MoveToFrame(speeder, 12, 25);
}
if (GetCurFrame(speeder) == 12)
{
MoveToFrame(speeder, 13, 16);
}
if (GetCurFrame(speeder) == 13)
{
MoveToFrame(speeder, 14, 12);
}
if (GetCurFrame(speeder) == 14)
{
Sleep(sleeptime);
MoveToFrame(speeder, 15, 8);
}
if (GetCurFrame(speeder) == 15)
{
MoveToFrame(speeder, 0, 16);
}
if (GetCurFrame(speeder) == 0)
{
Sleep(sleeptime);
MoveToFrame(speeder, 1, 8);
}
return;


end



------------------
nil nip nada zip zero naught lip zil

[SF]pjb
07-11-2004, 12:23 PM
thats as effichiant as it gets unless you use a keyframe. however if you where to make it so it travled at the same speed all the way you could just use.

symbols
thing van
int numframes
flex speed
message activated
end
code
activated:
movetoframe(van,numframes-1,speed);
waitforstop(van);
skiptoframe(van,0,speed);
return;
end


NOTE: numframes MUST BE the same as the numframes of the thing for that to work perfectly...

to stop it going to the start at the end remove the skiptoframe line..

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

[SF]pjb
07-12-2004, 09:38 AM
also reading your code i realised that your thng when getting to the end will fly backwards to frame 0, to stop that use skiptoframe like i did

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

F-Body
07-14-2004, 01:17 PM
OK thanks, I noticed that too. Is jumptoframe similar to teleportthing?

------------------
nil nip nada zip zero naught lip zil

darthslaw
07-14-2004, 05:21 PM
<font face="Verdana, Arial" size="2">Originally posted by F-Body:
Is jumptoframe similar to teleportthing?</font>
Apparently so (looking at the DM)

------------------
nytfyre m0d (http://www.nightfire.uni.cc/site/page.php) || f33l t3h p0w3r (http://www.geocities.com/qrphome/pwp3/) || t3h l0st c0gz (http://www.tbns.net/GBK/ol/index.htm) || OMF &gt; * (http://www.bkkbazaar.com/omf/)

[SF]pjb
07-15-2004, 11:37 AM
its practicaly identical, except insted of going to the postion taken from thing it gose to a postion allready held in memory, theorteicaly saveng you a microsecond or two of prosessing.

not that thats any use! just thought i'd state it.

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?

LKOH_SniperWolf
07-15-2004, 11:54 AM
Actually, there are some cases where it could be useful, suppose you've got a thing moving around, visible at times, in an sp level. Now player goes out of view, goes further in the level, quickly, and your object is supposed to fly by the sector he's at, but it's still a few frames back. Jumptoframe, just outta sight, then play anim. ... best use I can think of right now...

------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come

darthslaw
07-15-2004, 01:26 PM
First thing I think of is if you have a patrolling enemy that walks through a teleporter...

------------------
nytfyre m0d (http://www.nightfire.uni.cc/site/page.php) || f33l t3h p0w3r (http://www.geocities.com/qrphome/pwp3/) || t3h l0st c0gz (http://www.tbns.net/GBK/ol/index.htm) || OMF &gt; * (http://www.bkkbazaar.com/omf/)