Actor does not spawn

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
rico345
Posts: 193
Joined: Mon Sep 08, 2008 5:24 am
Location: Gimhae City, Republic Of Korea

Actor does not spawn

Post by rico345 »

Code: Select all

script 985 (void){
	MarkX=GetActorX(0);
	MarkY=GetActorY(0);
	MarkZ=GetActorZ(0);
	MarkZCeiling=GetActorCeilingZ(0);
	Delay(35*5);
	Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling,0);
}
I want spawn Supply Box in the sky.
Just using GetActorZ(0) is working.
But GetActirCeilingZ(0) is not working.

What is problem?
User avatar
DaMan
Posts: 727
Joined: Fri Jan 01, 2010 7:14 am

Re: Actor does not spawn

Post by DaMan »

Getting stuck in the ceiling? Try GetActorCeilingZ(0)-32*65536.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Actor does not spawn

Post by FDARI »

What value is returned from GetActorCeilingZ(0)?

Are you sure that GetActorCeilingZ is what doesn't work, and that it isn't spawning an actor with the returned value that fails?

I think the Z in Spawn places the lowest point on the actor you're spawning, meaning that you need some room above it if it cannot spawn just anywhere. If it can spawn just anywhere, use [wiki]SpawnForced[/wiki]. Otherwise, subtract the height of the spawned actor, or (height + 1).

Assuming the actor is 10 "units" tall:

Code: Select all

script 985 (void){
   MarkX=GetActorX(0);
   MarkY=GetActorY(0);
   MarkZ=GetActorZ(0);
   MarkZCeiling=GetActorCeilingZ(0);
   Delay(35*5);

  // Then one of the following:

   Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling - 10.0,0); // Option A
   Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling - 11.0,0); // Option B
   SpawnForced("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling,0); // Option C

   Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling - (1+ 10.0),0); // Option D, slightly convoluted
}
rico345
Posts: 193
Joined: Mon Sep 08, 2008 5:24 am
Location: Gimhae City, Republic Of Korea

Re: Actor does not spawn

Post by rico345 »

DaMan wrote:Getting stuck in the ceiling? Try GetActorCeilingZ(0)-32*65536.
Oh my, thank you.
It's work! What is the problem? I don't know what am I wrong.
rico345
Posts: 193
Joined: Mon Sep 08, 2008 5:24 am
Location: Gimhae City, Republic Of Korea

Re: Actor does not spawn

Post by rico345 »

FDARI wrote:What value is returned from GetActorCeilingZ(0)?

Are you sure that GetActorCeilingZ is what doesn't work, and that it isn't spawning an actor with the returned value that fails?

I think the Z in Spawn places the lowest point on the actor you're spawning, meaning that you need some room above it if it cannot spawn just anywhere. If it can spawn just anywhere, use [wiki]SpawnForced[/wiki]. Otherwise, subtract the height of the spawned actor, or (height + 1).

Assuming the actor is 10 "units" tall:

Code: Select all

script 985 (void){
   MarkX=GetActorX(0);
   MarkY=GetActorY(0);
   MarkZ=GetActorZ(0);
   MarkZCeiling=GetActorCeilingZ(0);
   Delay(35*5);

  // Then one of the following:

   Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling - 10.0,0); // Option A
   Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling - 11.0,0); // Option B
   SpawnForced("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling,0); // Option C

   Spawn("AmmoBox_Drop",MarkX,MarkY,MarkZCeiling - (1+ 10.0),0); // Option D, slightly convoluted
}
thank you for answer.
I feel very grateful to you.

One thing, I have forgot to explain.
My mod is based in Skulltag, so can't use SpawnForced.

And I tried all your suggested ways, but nothing work. Sorry.

But thank you for kindness answer.
User avatar
DaMan
Posts: 727
Joined: Fri Jan 01, 2010 7:14 am

Re: Actor does not spawn

Post by DaMan »

"You need some room above it if it cannot spawn just anywhere". GetActorCeilingZ(0)-32*65536 spawns it 32 units below the ceiling (the *65536 converts it to [wiki]Fixed_point[/wiki]).
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Actor does not spawn

Post by FDARI »

The following expressions are all the same:
2097152 (integer notation)
32.0 (fixed point notation)
32 * 65536
32<<16

None of the above values are 32. They are all 32 * 65536. When I want a constant fixed point value, I would use fixed point notation. In this case, 32.0 .
rico345
Posts: 193
Joined: Mon Sep 08, 2008 5:24 am
Location: Gimhae City, Republic Of Korea

Re: Actor does not spawn

Post by rico345 »

FDARI wrote:The following expressions are all the same:
2097152 (integer notation)
32.0 (fixed point notation)
32 * 65536
32<<16

None of the above values are 32. They are all 32 * 65536. When I want a constant fixed point value, I would use fixed point notation. In this case, 32.0 .
Thanks, I understand now.
Locked

Return to “Editing (Archive)”