Lord_Grismath
05-24-2005, 12:59 PM
I'm sure I've seen this before, probably in MotS or in many custom levels, and I'm sure the TIE bomber cog from JK could be modified to do the same thing...
Can someone provide a cog that creates ships at ghost points and moves them to others to create an ambient appearance of ship traffic above and around the player?
Ive written this cog before. Many times, for many editors. Surely you could search the forums and find a previous thread... ;)
Lord_Grismath
05-24-2005, 08:09 PM
So you have... I'll try this one for now:
# Yet another generic frame-based flying ship cog.
# But this one has error correction!!
#
# 11/2002 GBK
Symbols
Message Startup
Message Crossed
Message Arrived
Message Timer
Thing Ghost
Template Ship_type
Thing Ship Local
Int Num_frames #Whatever JED reports as your number of frames, put it here. (count from 1)
Flex Speed=4
Sound Hum
Flex Hum_dist=10 #It is now in JKUs
Int Ch=0 Local
Int Destroy_end=1 #Destroy the ship when it reaches the end?
Int Recreate_end=1 #Recreate it? This is unused if the above is 0.
Int Mode=0 #0 - on startup, start ship
#1 - on crossing "Adjoin", start ship.
Surface Adjoin #If your using mode 0, you dont need this.
Int C=0 Local
Int I=0 Local
End
Code
Startup:
Sleep(0.5);
Num_frames = Num_frames - 1;
If(Mode) Stop;
Call Go;
Stop;
Crossed:
If(!Mode) Stop;
Call Go;
Stop;
Go:
Ship = Creatething(Ship_type, Ghost);
If(Ship == -1) { Call Failure; Stop; }
Movetoframe(Ship, Num_frames, Speed);
Capturething(Ship);
Ch = Playsoundthing(Hum, Ship, 1, 0, Hum_dist*10.5, 0x81);
Stop;
Arrived:
If(Getcurframe(Ship) != Num_frames) Stop;
Stopsound(Ch, 0.1);
If(Destroy_end) { Destroything(Ship); Ship = -1;
If(Recreate_end) Call Go; } Stop;
Failure:
For(I=0;I<=640;I=I+1) If(Getthingsignature(I) != -1) C = C + 1;
JKstringclear(); If(Getthingcount() - C <= 10)
JKstringconcatformattedint(Getselfcog(), "Ship creation failure, cog %d. Likely cause: Thing limit.");
Else JKstringconcatformattedint(Getselfcog(), "Ship creation failure, cog %d. Likely cause: Bad template.");
JKstringoutput(-1, -1);
Settimer(0.1);
Stop;
Timer: Call Go; Stop;
End
Thanks.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.