spawn activation by script doesn't work


(]UBC[ McNite) #1

Hi,

for some unknown reason my script doesn’t what I want it to do… after a lot of trial only producing ERRORs i hope someone can help me…

situation: Allies repair the tram engine (works fine in the map). This should activate a forward spawn, disable the first allied spawn, and also disable the first axis spawn letting axis spawn at a rear spawn (which they also have in the beginning).

problem: The built_final should activate 2 triggers, of which the one for the spawns doesn’t do its duty… the other one works fine (enabling the use of the tram)… ok works fine apart from giving out the message 3 times instead of just once, but, alas…

these are the parts of my script involved:

tramengine 
{ 
built final 
{ 
setstate tramengine default 
setstate baumaterial invisible 
wm_announce "The tram engine has been repaired!" 
trigger tram tramengine_repaired // enable use of tram 
trigger spawns tramengine_repaired // for the spawn at tram station 
} 
(...) 
} 
tram // objective 1: repairing the tram engine & using the tram 
{ 
(...) 
trigger tramengine_repaired 
{ 
accum 1 set 1 
accum 4 set 1 
wm_announce "The tram can be used USED!" // this message appears 3 times  :???: 
} 
} 

(...) 

spawns // general action starting here 
{ 
spawn 
{ 
} 

trigger tramengine_repaired 
{ 
wait 50 
trigger spawnstation_wobj on 
wm_announce "spawnstation_wobj on" 

wait 50 
trigger spawntunnel_wobj off 
trigger spawntunnel off 
wm_announce "spawntunnel off" 

wait 50 
alertentity spawnstation_wobj 
alertentity spawnstation 
setautospawn "station" 1 
wm_announce "setautospawn station 1" 

wait 50 
trigger spawnroad_wobj off 
alertentity spawncastle 
alertentity spawncastle_wobj 
setautospawn "castle" 0 
wm_announce "setautospawn castle 0" 
} 
}

The "off"s und "on"s only effect a setstate XYZ “invisible” or “default” which should enable or disable the spawns (in radar this is used for the allied command post spawn).
The whole lot of wm_announces within the spawns script were only built in for indicating whether this part of the script has been gone through, but as i said, I don’t even get the first one (wm_announce “spawnstation_wobj on” ).
The other trigger in the built_final starts the trigger tram tramengine_repaired (but giving out the wm_announce 3 times)

The whole rest of my script (blowing up a wall, steal documents, capture a flag, using a lift and a tram) works fine, and i don’t get any error-messages while the map loads.

I hope anybody has any ideas about this… i m pretty desperate after 2 days of messing with this :angry: [/quote]


(Chruker) #2

Try running through the troubling part of it with g_scriptdebug set to 1. That’ll print out the script commands its executing.

Ohh. And use the code tag instead of the quote tag, when you are listing code in the forum. That will preserve the indentation.

Are you sure you have an entity with scriptname set to ‘spawns’?


(]UBC[ McNite) #3

no i don’t have an entity with the scriptname spawns, its just a part of the script where i accumulated those triggers… do i need an entity for every part of my scriptß

seems like i do need… changed the place of the triggers and now they get executed… should solve the probs soon then

Thx for the KITA into the right direction :bump:


(Chruker) #4

Sadly we can’t make up scriptblocks for our own convenience.


(]UBC[ McNite) #5

Ok, I was able to solve the problem…

my mistake: put a wait 4000 into the game_manager, which delayed the execution of the setautospawns until the map was loaded completely, so I spawned before the right spawns were set (omfg stupid mistake)

Second thing that made my spawns not work was something illogical (imo).
The setstate spawnstation_wobj invisible which makes the flag invisible on the command map (e.g. like on radar at the side entrance) needs more wait than 50 on my map (wait 50 is used in radar in the spawn of the alliedcommandpostspawns).
If I only use a wait 50 the “invisible” doesnt get activated which leads to the spawn still being visible in the command map after the start of the game :angry: i have no fucking idea why.
Setting the wait to something like 500 leads to this: in warmup the allied players spawn at the right place, but after the warmup when the game starts they spawn at the spawn that should be invisible… i wager the wait si too long so the spawning happens before the spawn has been set to invisible :banghead:

Well i sorted it out with a wait of 150, but isn’t this a bit weird? I mean, its not quite logical that some lines of the script simply don’t get executed because the wait is too short???


(nUllSkillZ) #6

I’ve read somewhere, that the waits are necessary for the engine to spawn the entities.
If there is no entity it’s impossible to manipulate it with a script.

Try to test your map with


+set logfile 1 +set g_scriptdebug 1

in addition.

I think in such case you should see an error like “entity xyz not there”.


(Chruker) #7

I’ve read somewhere, that the waits are necessary for the engine to spawn the entities.

Thats true. I’ve spend much time debugging something which in the end turned out just needed some wait time.

i wager the wait si too long so the spawning happens before the spawn has been set to invisible

I think you are correct about that one.