[SOLVED] Help with A_Overlay In an inventory item

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.

[SOLVED] Help with A_Overlay In an inventory item

Postby Ashat Maself » Sun May 30, 2021 10:26 am

So I'm trying to make an inventory item that plays a short animation on pickup, Here's my code so far:
ACTOR Jumpscare2 : CustomInventory
Code: Select allExpand view
{
+INVENTORY.KEEPDEPLETED
+INVENTORY.ALWAYSPICKUP
  -COUNTITEM
   +Inventory.Autoactivate
  States
  {
  Spawn:
    TNT1 A 1
    Loop
  Pickup:
   TNT1 A 0  A_playsound ("JSCARE")
   TNT1 A 200 A_Overlay (100, "Overlay")
    Stop
Overlay:
    JSCR A 1
   JSCR B 1
   JSCR C 1
   JSCR D 15
    Stop
  }
}


But the overlay never appears, does anybody know what I'm doing wrong?
Last edited by Ashat Maself on Sun May 30, 2021 10:58 am, edited 2 times in total.
Ashat Maself
 
Joined: 02 Apr 2021

Re: [DECORATE] Help with A_Overlay In an inventory item

Postby Jarewill » Sun May 30, 2021 10:38 am

CustomInventory items aren't taken into the inventory without a Use state.
The overlays don't appear because the item is not even given to the player's inventory.
Possible fix:
Code: Select allExpand view
  Pickup:
   TNT1 A 0 A_RailWait
   Stop
  Use
:
   TNT1 A 0 
   TNT1 A 0 A_Overlay 
(100, "Overlay")
    Fail
Overlay
:
    JSCR A 1 
   JSCR A 1 A_PlaySound
("JSCARE")
   JSCR A 1
   JSCR A 15
   TNT1 A 0 A_TakeInventory
("Jumpscare2",1)
    Stop
  

Because of the +AUTOACTIVATE flag it will enter it's Use state when it's given to the player.
Also remove the +KEEPDEPLETED flag from it to make it repeatable.
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: [DECORATE] Help with A_Overlay In an inventory item

Postby Ashat Maself » Sun May 30, 2021 10:47 am

Jarewill wrote:CustomInventory items aren't taken into the inventory without a Use state.
The overlays don't appear because the item is not even given to the player's inventory.
Possible fix:
Code: Select allExpand view
  Pickup:
   TNT1 A 0 A_RailWait
   Stop
  Use
:
   TNT1 A 0 
   TNT1 A 0 A_Overlay 
(100, "Overlay")
    Fail
Overlay
:
    JSCR A 1 
   JSCR A 1 A_PlaySound
("JSCARE")
   JSCR A 1
   JSCR A 15
   TNT1 A 0 A_TakeInventory
("Jumpscare2",1)
    Stop
  

Because of the +AUTOACTIVATE flag it will enter it's Use state when it's given to the player.
Also remove the +KEEPDEPLETED flag from it to make it repeatable.


sadly it still doesnt show up

EDIT: Solved, it was a sprite issue
Ashat Maself
 
Joined: 02 Apr 2021


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest