Thing_SpawnAlways

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Thing_SpawnAlways

Re: Thing_SpawnAlways

by XutaWoo » Sat Dec 27, 2008 12:35 pm

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.
You could always spawn an actor that uses that A_SpawnItemEx flag to force spawning to spawn that Candelabra.

Horray for hacks I suppose.

Re: Thing_SpawnAlways

by Xaser » Sat Dec 27, 2008 12:48 am

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.

Re: Thing_SpawnAlways

by Zippy » Sun Dec 14, 2008 5:22 pm

Seems like that would work.

Re: Thing_SpawnAlways

by HotWax » Sun Dec 14, 2008 2:37 pm

Couldn't you also do this by creating an actor that periodically attempts to spawn a child which kills its parent as soon as it appears?

That wouldn't require any TIDs and could be used entirely from Decorate.

Re: Thing_SpawnAlways

by Zippy » Fri Dec 12, 2008 3:25 pm

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?
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.

So if you have 5 spots with the same tid and use SpawnSpot, the return value for spawning EVERYTHING should be 5. If you get less, not everything was spawned. Your problem now becomes: at which spots were things spawned? And more problematically, if you only spawned some of them (say it returned 3. You're missing 2) how do you spawn the rest at the appropriate spots? You really can't. One thing you can try is if you don't get them all, remove the ones that were spawned and try again:

Code: Select all

// Keep trying to spawn all 5 at once...
while( SpawnSpot("whatever",1,2) != 5 ) {
   Thing_Remove(2);
   delay(1);
}
I think the system has enough for clever mappers to work within the confines. If you want to do something like "it spawned only 3, so spawn the other 2 later at the correct spots" you're going to have to accept the reality that in order to have full control over the individual, unique spawn points then you to assign them unique tid identifiers. Working with a different number of spots on different difficulties shouldn't be much more than using [wiki]ThingCount[/wiki] and [wiki]GameSkill[/wiki] to determine the appropriate number to spawn.

Re: Thing_SpawnAlways

by Enjay » Fri Dec 12, 2008 12:44 pm

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?

Re: Thing_SpawnAlways

by skadoomer » Fri Dec 12, 2008 11:26 am

Good to know. I'll have to modify some code in light of this, as spawning an object and then checking the object's tid with thing count isn't always successful)

Re: Thing_SpawnAlways

by Zippy » Fri Dec 12, 2008 11:25 am

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?
Multiple ways. Some examples:

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);
}

Re: Thing_SpawnAlways

by Tormentor667 » Fri Dec 12, 2008 4:07 am

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?

Re: Thing_SpawnAlways

by Graf Zahl » Thu Dec 11, 2008 12:02 pm

Spawnspot even returns whether it was successful so you don't need such a hack. Just check the return value. It's true if something was spawned.

Re: Thing_SpawnAlways

by skadoomer » Thu Dec 11, 2008 10:18 am

You know, I've always used a LWM trick in situation. Basically it goes something like this:

Code: Select all

amusing your tid is 300
int tries;
While(thingcount(0, 300) == 0 && tries < 10)
{
Spawnspot("My guy", ...)
Delay(1);
tries++;
}
The time in between tries can be tweaked with a delay.

Thing_SpawnAlways

by Tormentor667 » Thu Dec 11, 2008 6:14 am

A little suggestion that would make many difficult and complicated script solutions obsolete and many other things even possible: A "Thing_Spawn" variant, that always spawns and if it can't get spawned, it tries unlimited times until it can get spawned or the amount of retries is through. Something like this might work:

Code: Select all

Thing_SpawnAlways (tid, type, angle, new tid, retries, timebetweenretriesintics)
Possible?

Top