A_SpawnItemEx help

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:

A_SpawnItemEx help

Post by LilWhiteMouse »

I'm doing something wrong and I have no idea what. The first actor is supposed to spawn four of the second, one at each compass point of the parent. Seemed simple enough, but it's not working as expected, they all spawn at the same location. I'm sure I'm making a newb mistake, but I have no idea what. Who wants to point out the obvious?

Code: Select all

ACTOR TekStation
{
	States
	{
	Spawn:
		TEKS A 0
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 32, 0, 0, 0, 0, 0, 0)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", -32, 0, 0, 0, 0, 0, 180)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 0, 32, 0, 0, 0, 0, 90)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 0, -32, 0, 0, 0, 0, 270)
		TEKS AA -1
		Stop
	}
}

ACTOR TekStationConsole
{
	Scale 0.66
	States
	{
	Spawn:
		TEKP AA -1
		Stop
	}
}
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_SpawnItemEx help

Post by NeuralStunner »

The angle is not only passed to the spawned actor, but relative to the spawner. You're specifying both angles and X/Y offsets, so they're sort of cancelling each other out. This should do it:

Code: Select all

		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 32, 0, 0, 0, 0, 0, 0)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 32, 0, 0, 0, 0, 0, 90)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 32, 0, 0, 0, 0, 0, 180)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 32, 0, 0, 0, 0, 0, 270)
(Make the 32s negative if you want hem to face inward.)

Or, if you want them all to face the same angle as the parent (or any angle, so long as it's the same in every call):

Code: Select all

		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 32, 0, 0, 0, 0, 0, 0)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", -32, 0, 0, 0, 0, 0, 0)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 0, 32, 0, 0, 0, 0, 0)
		TEKS A 0 A_SpawnItemEx ("TekStationConsole", 0, -32, 0, 0, 0, 0, 0)
Also, though not earthshaking, this should have only one A:

Code: Select all

		TEKS AA -1
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: A_SpawnItemEx help

Post by DoomRater »

It's slowly becoming customary to provide a blank state of zero length (even though that wasn't the case here!) that was understood as "nothing can happen on this state due to other things occurring in the Thing". The code is likely a remnant of that.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: A_SpawnItemEx help

Post by Gez »

DoomRater wrote:It's slowly becoming customary to provide a blank state of zero length (even though that wasn't the case here!) that was understood as "nothing can happen on this state due to other things occurring in the Thing". The code is likely a remnant of that.
That's only for the first state of the Spawn sequence. And either way, with AA -1, the second state is never reached, since the first A -1 is never left.

It isn't harmful in any way, it cannot provoke bugs or whatever. It's just a state that is never reached but that doesn't need to be reached.
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_SpawnItemEx help

Post by Xaser »

Code: Select all

ACTOR SuperImp : DoomImp replaces DoomImp
{
	Health 120
	Speed 16
	States
	{
	See:
		TROO ABCD 1 A_Chase
		Loop
	Death:
		MISL BCD 4 A_Explode(128,128,0)
		Stop
	WADBloat:
		MISL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Explode(0,0,0)
		SSWV ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ 1 A_SpawnItemEx("SuperImp",0,0,0,0,0,0,0,0,0)
		BEXP A 1 BRIGHT
		BEXP C 1
		BEXP A 1 BRIGHT
		BEXP C 1
		BEXP A 1 BRIGHT
		BEXP C 1
		BEXP A 1 BRIGHT
		BEXP CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC 1
		Goto WADBloat
	}
}
;)
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_SpawnItemEx help

Post by NeuralStunner »

"Super" Imp? Only if he carries an SSG. (Needs 20 lines of [wiki]A_CustomBulletAttack[/wiki]! With [wiki]A_FaceTarget[/wiki] in between each one!)

I left all the zeroes in because, of course, that's the Angle parameter waaaaaaaaaaaaaay over there.
Spoiler:
Locked

Return to “Editing (Archive)”