Why can't I collect this red coin?

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.

Why can't I collect this red coin?

Postby Qrtr » Tue Mar 30, 2021 2:43 am

I've been trying to code a project for a few days now, and I made this red coin, intended to be hidden in areas hard to get to. However, for some reason, I'm unable to collect it.
Does anyone know what I've been doing wrong? I've been scanning through the forums for an hour or two by this point.
Code: Select allExpand view
actor redcoin : Health 20001
{
   Height 15
   Radius 7
   +BUMPSPECIAL
   +NOGRAVITY
   +FORCEXYBILLBOARD
   +VISIBILITYPULSE
   Activation THINGSPEC_Activate
   Inventory.PickupMessage "collected a red coin." // "Picked up a health bonus."
   States
   {
      Spawn:
         RDCN ABCB 10
         Loop
      Active:
         RDCN D 5 A_PlaySound("collectable/get", 0 | 8 | 32 | 64)
         RDCN EF 5
         Stop
   }
}

EDIT: SOLVED
You do not have the required permissions to view the files attached to this post.
Last edited by Qrtr on Tue Mar 30, 2021 3:25 am, edited 1 time in total.
User avatar
Qrtr
 
Joined: 24 Apr 2020
Discord: QrtrQrtrQrtrQrtr#3254
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)

Re: Why can't I collect this red coin?

Postby Jarewill » Tue Mar 30, 2021 3:00 am

To use activation specials, you have to inherit from SwitchableDecoration and make it SOLID for the player to bump into it.
For example:
Spoiler:
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Why can't I collect this red coin?

Postby Player701 » Tue Mar 30, 2021 3:06 am

If the coin is actually supposed to go into the player's inventory instead of just being a decoration, a pickup animation can also be implemented by defining a separate actor class that plays the animation and setting the value of Inventory.PickupFlash to the name of that actor class. A_PlaySound does not have to be called explicitly to play a pickup sound, Inventory.PickupSound can be used for that.

Note that if the coin is not supposed to give health, it should be subclassed from Inventory and not Health. Optionally, set the MaxAmount property to control the amount of coins that the player can pick up. If the item is intended to be usable, subclass it from CustomInventory, add the INVENTORY.INVBAR flag and a Use state sequence so that something can happen when the player uses the item.
User avatar
Player701
 
 
 
Joined: 13 May 2009
Location: Russia
Discord: Player701#8214
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Why can't I collect this red coin?

Postby Qrtr » Tue Mar 30, 2021 3:24 am

Player701 wrote:If the coin is actually supposed to go into the player's inventory instead of just being a decoration, a pickup animation can also be implemented by defining a separate actor class that plays the animation and setting the value of Inventory.PickupFlash to the name of that actor class. A_PlaySound does not have to be called explicitly to play a pickup sound, Inventory.PickupSound can be used for that.

Note that if the coin is not supposed to give health, it should be subclassed from Inventory and not Health. Optionally, set the MaxAmount property to control the amount of coins that the player can pick up. If the item is intended to be usable, subclass it from CustomInventory, add the INVENTORY.INVBAR flag and a Use state sequence so that something can happen when the player uses the item.


hey, that worked! thanks, man
i've been chipping away on this for a good while and i'm glad to get this working
User avatar
Qrtr
 
Joined: 24 Apr 2020
Discord: QrtrQrtrQrtrQrtr#3254
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)


Return to Scripting

Who is online

Users browsing this forum: No registered users and 2 guests