Code: Select all
Thing_SpawnAlways (tid, type, angle, new tid, retries, timebetweenretriesintics)Moderator: GZDoom Developers
Code: Select all
Thing_SpawnAlways (tid, type, angle, new tid, retries, timebetweenretriesintics)Code: Select all
amusing your tid is 300
int tries;
While(thingcount(0, 300) == 0 && tries < 10)
{
Spawnspot("My guy", ...)
Delay(1);
tries++;
}

Multiple ways. Some examples:Tormentor667 wrote:Thanks for the info but how can I check this? I mean how would the script look like that checks if a monster has been spawned or not via Spawnspot?
Code: Select all
// Take a different course of action based on whether the spawning was successful or not
if( SpawnSpot("whatever",1) ) {
// Spawn successful
}
else {
// Spawn failed
}
// ...
// Store the spawn result
int spawnSuccess = SpawnSpot("whatever", 1);
// Do something else if the spawning failed
if( spawnSuccess == FALSE ) { // or if( !spawnSuccess )
// Spawn failed
}
// ...
// Keep trying until you spawn it
while( !SpawnSpot("whatever",1) ) {
delay(1);
}
Things get a bit more complicated, but it's still somewhat workable. To my understanding, SpawnSpot actually won't return TRUE and FALSE, but the number of things spawned. FALSE happens to be 0, so TRUE and FALSE work in cases of spawning a single thing. if (SpawnSpot("whatever",1)) will succeed so long as SOMETHING is spawned.Enjay wrote:Often I might have a number of map spots with the same tid on a map and use a single spawnspot instruction to spawn actors at each one. The situation may be further complicated by having different numbers of map spots at different difficulty levels. Would the spawnsuccess thingy be able to cope with that (ie can it be used to ensure all actors that there were map spots for have spawned (I suspect not)) or would I have to use a different map spot and tid for each actor that I was going to check for?
Code: Select all
// Keep trying to spawn all 5 at once...
while( SpawnSpot("whatever",1,2) != 5 ) {
Thing_Remove(2);
delay(1);
}You could always spawn an actor that uses that A_SpawnItemEx flag to force spawning to spawn that Candelabra.Xaser wrote:But what about a situation where you would want to spawn something inside a wall? I don't mean in a "hey look thars a mancoobus in tehwall!1" joke-y way either. Suppose I wanted to spawn a Candelabra close to a wall in a spot that would normally consitutite it being "stuck." Seeing how it's a static decoration, it wouldn't constitute the usual errors that tend to apply when part of the radius is stuck in the wall.