A_SpawnitemEX need help.

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
chikokevo
Posts: 83
Joined: Tue May 31, 2016 9:42 am

A_SpawnitemEX need help.

Post by chikokevo »

Hello! So I am trying to make flying candles as decorations..

So I have this actor candle

Code: Select all

actor GhostlyCandleOriginal
{
//$Category Decorations
    Radius 1
    Height 100
    Mass 1
	+SOLID
	+Pushable
	+NoGravity
    States
    {
    Spawn:
       GCNO A -1
       Loop
    }
}
So this works fine.

I am using Egg & Egghatch, to A_SpawnitemEX this candle on a different Z axis with heights of 10, 31, 54, 64, 73, 94 & 106 accordingly. Here is my egg/egghatch code:

Code: Select all

Actor GhostlyCandleOriginalEGG10
{
  Radius 13
  Height 8
  States
  {
  Spawn:
    NoTX A 0
    Goto Death
  Death:
    NoTX A 0 A_SpawnItem("GhostlyCandleOriginalEggHatch10", 1, 0, 0)
    Stop
    }
	}
	
Actor GhostlyCandleOriginalEggHatch10
{
  Radius 13
  Height 8
  States
  {
  Spawn:
    NoTX A 0
    Goto Death
  Death:
    NoTX A 0 A_SpawnItemEX("GhostlyCandleOriginal", 0, 0, 10 )
    Stop
    }
}


And here is my random spawner of these Egg heights, - (I want to spawn candle with random height)

Code: Select all

actor GhostlyCandleOriginalEGGSpawner : RandomSpawner 16661
{
DropItem "GhostlyCandleOriginalEGG10"
DropItem "GhostlyCandleOriginalEGG31"
DropItem "GhostlyCandleOriginalEGG73"
DropItem "GhostlyCandleOriginalEGG52"
DropItem "GhostlyCandleOriginalEGG64"
DropItem "GhostlyCandleOriginalEGG94"
DropItem "GhostlyCandleOriginalEGG106"
}
However, take a look what happens when i test this in game. Seems like anything above 64 just falls to 64... I am attaching this exact .WAD Not sure where I went wrong here..
https://youtu.be/IU7_0sMX-SU
Attachments
Candles.wad
(8.2 KiB) Downloaded 14 times
User avatar
22alpha22
Posts: 308
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: A_SpawnitemEX need help.

Post by 22alpha22 »

Instead of using a random spawner to spawn the eggs at different heights, why not use a single egg with a random function in place of the Zoffset parameter?

Here is an example using RandomPick:

Code: Select all

Actor GhostlyCandleOriginalEggHatch
{
  Radius 13
  Height 8
  States
  {
  Spawn:
    NoTX A 0
    Goto Death
  Death:
    NoTX A 0 A_SpawnItemEX("GhostlyCandleOriginal", 0, 0, RandomPick(10, 31, 52, 64, 73, 94, 106) )
    Stop
    }
}
You can use a variety of expressions and functions in place of many decorate function parameters. Here is a page with more info: https://zdoom.org/wiki/DECORATE_expressions
User avatar
Dan_The_Noob
Posts: 880
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: A_SpawnitemEX need help.

Post by Dan_The_Noob »

I'm so confused by all the different actor names.
why not call one GhostlyCandleSpawner and the other GhostlyCandle?

so it goes Egg -> Hatch -> Candle??
Post Reply

Return to “Scripting”