Page 1 of 1

A_SpawnitemEX need help.

Posted: Sat May 21, 2022 12:31 pm
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

Re: A_SpawnitemEX need help.

Posted: Sun May 22, 2022 8:25 pm
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

Re: A_SpawnitemEX need help.

Posted: Mon May 23, 2022 2:59 am
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??