How can I make this decorate switchable via scripting?

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!)
Post Reply
gunrock
Posts: 26
Joined: Sat May 16, 2020 4:19 am

How can I make this decorate switchable via scripting?

Post by gunrock »

How can I make this decorate code switchable? Meaning I'm able to activate and deactivate using scripting?
Spoiler:
Attachments
PebbleSpawner.zip
(5.11 KiB) Downloaded 17 times
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: How can I make this decorate switchable via scripting?

Post by Jarewill »

This wiki page might help.

Your spawner has to inherit from SwitchableDecoration to enable activation and deactivation.
Then you have to put your Spawn code into the Active state.
Spoiler: Untested
gunrock
Posts: 26
Joined: Sat May 16, 2020 4:19 am

Re: How can I make this decorate switchable via scripting?

Post by gunrock »

Thanks Jarewill!! Also how can I change the RNDR A 1 A_JumpIf(WaterLevel > 0, "Death") so the rocks will not crumble as soon as it hits water?
iBrokeMyAss
Posts: 53
Joined: Fri Jan 08, 2021 6:53 pm
Graphics Processor: Intel (Modern GZDoom)
Location: Ye Olde StinkHole

Re: How can I make this decorate switchable via scripting?

Post by iBrokeMyAss »

gunrock wrote:Thanks Jarewill!! Also how can I change the RNDR A 1 A_JumpIf(WaterLevel > 0, "Death") so the rocks will not crumble as soon as it hits water?
you need to change the state from "Death" to whatever new state where the rocks don't crumble.
So, RNDR A 1 A_JumpIf(WaterLevel > 0, "PLACETHENEWSTATEHERE")
gunrock
Posts: 26
Joined: Sat May 16, 2020 4:19 am

Re: How can I make this decorate switchable via scripting?

Post by gunrock »

Thanks as always
User avatar
Enjay
 
 
Posts: 27115
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: How can I make this decorate switchable via scripting?

Post by Enjay »

Another thing that might be useful for you:

waterlevel — How "submerged" the actor is in a Transfer_Heights or 3D floor water pool:

0: Not submerged at all (e.g. standing on solid ground or on shallow TERRAIN-based water)
1: Less than half submerged ("ankle deep")
2: At least half submerged ("waist deep")
3: Entirely submerged (completely underwater)
gunrock
Posts: 26
Joined: Sat May 16, 2020 4:19 am

Re: How can I make this decorate switchable via scripting?

Post by gunrock »

How can I slow down the speed of the rocks falling? They are falling a little to fast. They need to be just a little bit slower.

Here is my new modified decorate code structure.
Spoiler:
gunrock
Posts: 26
Joined: Sat May 16, 2020 4:19 am

Re: How can I make this decorate switchable via scripting?

Post by gunrock »

Also the rocks seem to be clipping in the ground. They are not crumbling when hitting ground level. They are actually going through the ground:(
Jarewill
 
 
Posts: 1853
Joined: Sun Jul 21, 2019 8:54 am

Re: How can I make this decorate switchable via scripting?

Post by Jarewill »

gunrock wrote:How can I slow down the speed of the rocks falling? They are falling a little to fast. They need to be just a little bit slower.
Add the Gravity property to the RockDrop actor and set it to a value lower than 1.
gunrock wrote:Also the rocks seem to be clipping in the ground. They are not crumbling when hitting ground level. They are actually going through the ground:(
I doubt they are going through the ground, their offsets might be not set properly.
As for making them disappear when they hit the ground, A_CheckFloor might help here.

Code: Select all

Actor RockDrop
{
+Missile
+NoBlockMap
-NoGravity
Height 2
Radius 2
Gravity 0.5
States
{
Spawn:
TNT1 A 0 A_CheckFloor("Death")
RNDR A 1 A_JumpIf(WaterLevel > 0, "Death")
Loop
Death:
RNDR BCDEFGHIJKL 3 A_FadeOut(0.15)
Stop
}
} 
gunrock
Posts: 26
Joined: Sat May 16, 2020 4:19 am

Re: How can I make this decorate switchable via scripting?

Post by gunrock »

Thanks Jarewill!!
Post Reply

Return to “Scripting”