A_SpawnitemEX need help.

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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!)

A_SpawnitemEX need help.

Postby chikokevo » Sat May 21, 2022 12:31 pm

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

So I have this actor candle
Code: Select allExpand view
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 allExpand view
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 allExpand view
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
You do not have the required permissions to view the files attached to this post.
chikokevo
 
Joined: 31 May 2016

Re: A_SpawnitemEX need help.

Postby 22alpha22 » Sun May 22, 2022 8:25 pm

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 allExpand view
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
22alpha22
So lonely...
 
Joined: 21 Feb 2014
Location: Montana, USA
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Re: A_SpawnitemEX need help.

Postby Dan_The_Noob » Mon May 23, 2022 2:59 am

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??
User avatar
Dan_The_Noob
 
Joined: 07 May 2019
Twitch ID: Dan_The_Noob
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests