There's no actual way to test for what's "inside the map" or inside the play area, as those concepts don't actually exist to ZDoom. The closest thing you can do is spawn a "wandering spawn" at the position of something already in the map's play area, and then use it as a spawn point.
Code: Select all
ACTOR WanderingSpawn
{
+CANPASS
+NOTRIGGER
+NOBLOCKMONST
+DONTSPLASH
Speed 1
Radius 16
Height 56
RenderStyle None
States
{
Spawn:
PLAY AAA 0 A_Wander
PLAY A 1 A_Wander
Loop
}
}
This is what I mean by wandering spawn; it should move around randomly, never going anywhere a monster physically shouldn't ( although this instance won't respect monster blocking lines, remove +NOBLOCKMONST if you want your's to ) while not tripping any triggers.
Keep in mind that this example was meant to be spawned by the player and to spawn player-sized actors; if you try to spawn something bigger than the spawn it can either fail to spawn or get stuck in a wall depending on if you used a Forced variant or not. Same with the spawn itself; if you try to spawn it at the player's location but it's made larger than the player, then it can easily fail to spawn or get stuck in a wall itself. To avoid this, you should probably make the wandering spawn the size of what's spawning it, and use a code like this to spawn thing on the wandering spawn
Code: Select all
while(!(SpawnSpot(etc.)) Delay(1);
This'll make sure that the script won't continue until the monster is spawned, giving the wandering spawn time to wander into a proper position.