Can anyone help me with this COG? When I use it, a ship template appears at the selected ghost position, but the keyframe animation doesn't play. Oh, and thanks again to Descent_pilot for showing me the 'if done' code...:
# Jedi Knight Cog Script
#
# ship_flyby.COG
#
# Description
# Cog for a ship to fly by when player enters a certain sector.
#
# Includes code designed by Descent-pilot in his key_player.cog
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
sector area
template shiptemplate
thing shipthing0
sound shipsound
keyframe flyby0
int done=0 local
message entered
end
# ========================================================================================
code
entered:
if(!done) // So it doesn't play twice
{
done = 1;
creatething(shiptemplate, shipthing0); //Create a ship at ghostthing
PlayKey(shipdummy0, flyby0, 1, 0x4); // This is the line that will play the key
playsoundlocal(shipsound, 1, 0, 0); // This plays engine sounds
destroything(shipthing0); //destroys ship when animation finished
}
return;
# ........................................................................................
end
# Jedi Knight Cog Script
#
# ship_flyby.COG
#
# Description
# Cog for a ship to fly by when player enters a certain sector.
#
# Includes code designed by Descent-pilot in his key_player.cog
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
sector area
template shiptemplate
thing shipthing0
sound shipsound
keyframe flyby0
int done=0 local
message entered
end
# ========================================================================================
code
entered:
if(!done) // So it doesn't play twice
{
done = 1;
creatething(shiptemplate, shipthing0); //Create a ship at ghostthing
PlayKey(shipdummy0, flyby0, 1, 0x4); // This is the line that will play the key
playsoundlocal(shipsound, 1, 0, 0); // This plays engine sounds
destroything(shipthing0); //destroys ship when animation finished
}
return;
# ........................................................................................
end