I was looking at some of my old cogs to see how i did stuff, and I relized that i went from my 473 line spawning system cog for SM HQ, which was rather lame, to this 93 line long cog that controls the spawning in Attack on Theed. (i admit, alot of the lines are due to my spacing organization habbits)
My AoT spawning system automatically randomly spawns you at one of four points in the "spawning area" that is closet to where you died. This keeps the action where I want the action to be taking place, and keeps it happening. In the future I may add more points in each spawning area, but for now 4 is good. Check it out and tell me what you think.
Anothing note: The JK 3do limit was kept in mind when making this cog, very much so. With this cog (modified), you can have unlimited "spawn zones" and unlimited spawn points using only ONE 3do, the ghost "thing" that does all the work.
It serves its purpose very well.
------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.
My AoT spawning system automatically randomly spawns you at one of four points in the "spawning area" that is closet to where you died. This keeps the action where I want the action to be taking place, and keeps it happening. In the future I may add more points in each spawning area, but for now 4 is good. Check it out and tell me what you think.
Code:
# Jedi Knight Cog Script
#
# 1337sp4wn.cog
#
# Controls the player spawning in Attack on Theed: Final Assault.
#
# [SM SIth Lord]
#
# This cog is not made or distributed by LucasArts Entertainment Co.
flags=0x240
symbols
message newplayer
message killed
thing primer_point
thing spawnarea0
thing spawnarea1
thing spawnarea2
thing spawnarea3
thing r0sa0
thing r0sa1
thing r0sa2
thing r0sa3
thing r1sa0
thing r1sa1
thing r1sa2
thing r1sa3
thing r2sa0
thing r2sa1
thing r2sa2
thing r2sa3
thing r3sa0
thing r3sa1
thing r3sa2
thing r3sa3
thing r4sa0
thing r4sa1
thing r4sa2
thing r4sa3
int numspawns=4
int primer_spawn=1 local
int player local
flex magicnum local
end
# ========================================================================================
code
newplayer:
player = GetSourceRef();
CaptureThing(player);
if( primer_spawn ){
primer_spawn = 0;
TeleportThing(player,primer_point);
return;
}
bestdist = VectorDist(playerpos,GetThingPos(spawnarea0));
bestindex = 0;
for(index=0; index < numspawns; index = index + 1){
if( VectorDist(playerpos,GetThingPos(spawnarea0[index])) <= bestdist ){
bestdist = VectorDist(playerpos,GetThingPos(spawnarea0[index]));
bestindex = index;
}
}
magicnum = Rand();
if( magicnum < 0.25 ) JumpToFrame(spawnarea0[bestindex],1,GetThingSector(r1sa0[bestindex]));
else if( magicnum >= 0.25 && magicnum < 0.50 ) JumpToFrame(spawnarea0[bestindex],2,GetThingSector(r2sa0[bestindex]));
else if( magicnum >= 0.50 && magicnum < 0.75 ) JumpToFrame(spawnarea0[bestindex],3,GetThingSector(r3sa0[bestindex]));
else if( magicnum >= 0.75 ) JumpToFrame(spawnarea0[bestindex],4,GetThingSector(r4sa0[bestindex]));
TeleportThing(player,spawnarea0[bestindex]);
JumpToFrame(spawnarea0[bestindex],0,GetThingSector(r0sa0[bestindex]));
return;
killed:
player = GetSourceRef();
playerpos = GetThingPos(player);
return;
# ........................................................................................
endAnothing note: The JK 3do limit was kept in mind when making this cog, very much so. With this cog (modified), you can have unlimited "spawn zones" and unlimited spawn points using only ONE 3do, the ghost "thing" that does all the work.
It serves its purpose very well.------------------
One day, after everybody else quits, I'll be the best.
Sith Mercenaries
^My site.