Spawn() failure

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
LilWhiteMouse
Posts: 2270
Joined: Tue Jul 15, 2003 7:00 pm
Location: Maine, US
Contact:

Spawn() failure

Post by LilWhiteMouse »

What would cause Spawn() to fail in an open space? I'm using Spawn() to have my ED-209 monster spawn it's parts. It works fine in stock Doom 2 maps, but when I summon the monster in a custom map, it fails.

[EDIT] I did a little testing, and I know Spawn() is getting the right coordinates, it just refuses to spawn the actors in any of the custom maps I've tried.
User avatar
ZDG
Posts: 918
Joined: Sat Jan 02, 2010 12:01 pm
Location: in SlumpEd

Re: Spawn() failure

Post by ZDG »

Does it have enough room to spawn?
User avatar
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA
Contact:

Re: Spawn() failure

Post by Demolisher »

ZDG wrote:Does it have enough room to spawn?
LilWhiteMouse wrote:What would cause Spawn() to fail in an open space?
Do you have the coordinates in fixed point, ie 720.0 instead of 720?
User avatar
LilWhiteMouse
Posts: 2270
Joined: Tue Jul 15, 2003 7:00 pm
Location: Maine, US
Contact:

Re: Spawn() failure

Post by LilWhiteMouse »

A snippet of the ACS that the main actor runs:

Code: Select all

function int GetFreeTID (int start)
{
	//while (ThingCount (0, start) != 0){start++;}
	while (GetActorViewHeight(start) + ThingCount (0, start) != 0){start++;}
	return start;
}

script 500 (void) {
if (ActivatorTID() != 0){terminate;}
if (ActivatorTID() == 0){Thing_ChangeTID(0, GetFreeTID(500));}
int LegL = GetFreeTID(500);
Spawn ("ED209_Leg1", GetActorX(0), GetActorY(0), GetActorZ(0), LegL, 0);
GetFreeTID() works, and the GetActor positions are working, it just refuses to spawn when in any custom map I've tried. I just don't understand why it would work on Doom 2 maps, but not any custom maps. The script itself is executes just fine on custom maps, it's just the spawn()s that fail.

A look at the leg, though none of the actors spawn:
Spoiler:
[EDIT] I tried replacing Spawn ("ED209_Leg1", GetActorX(0), GetActorY(0), GetActorZ(0), LegL, 0) with SpawnSpot("ED209_Leg1", 0, LegL, 0) and SpawnSpot("ED209_Leg1", ActivatorTID(), LegL, 0) but no change. It worked on a stock map, but failed on a custom map.
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: Spawn() failure

Post by Isle »

are you sure it's reaching the spawn line?
User avatar
LilWhiteMouse
Posts: 2270
Joined: Tue Jul 15, 2003 7:00 pm
Location: Maine, US
Contact:

Re: Spawn() failure

Post by LilWhiteMouse »

Isle wrote:are you sure it's reaching the spawn line?
Yes, the whole script runs as expected, it's just the parts won't spawn outside of stock maps. I wrote in printbold()s to check each step of the script.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Spawn() failure

Post by XutaWoo »

Did you remember to declare the script as a library?
User avatar
LilWhiteMouse
Posts: 2270
Joined: Tue Jul 15, 2003 7:00 pm
Location: Maine, US
Contact:

Re: Spawn() failure

Post by LilWhiteMouse »

XutaWoo wrote:Did you remember to declare the script as a library?
YAY! No, I didn't. That fixed it. So why does it work in stock maps? Because they don't have any scripts?
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Spawn() failure

Post by XutaWoo »

LilWhiteMouse wrote:
XutaWoo wrote:Did you remember to declare the script as a library?
YAY! No, I didn't. That fixed it. So why does it work in stock maps? Because they don't have any scripts?
Exactly.
JohnnyGoodTimes
Posts: 8
Joined: Sun May 23, 2010 8:52 pm

Re: Spawn() failure

Post by JohnnyGoodTimes »

Here's a trick I like to use when testing the success of Spawn().

Code: Select all

  int test = Spawn(class, x, y, z, new_tid, angle);
  if (!test)
  {
    //do stuff if Spawn() failed
    PrintBold(s:class, s:" failed to spawn at coordinates ", f:x, s:", ", f:y, s:", ", f:z);
  }
Locked

Return to “Editing (Archive)”