• 0

Having trouble with Sprite change in pickup state.

Question

I have an ACTOR that inherits the Health as seen in the decorate below. What I want to happen is after "picking up" then item, the sprite to change to a different frame and remain that way without the actor deleting itself... Eg drinking a glass and putting the empty one down.

 

Spoiler


ACTOR Dinner2 : Health 32188
{
  Game Doom
  Radius 16
  Height 56
  -SOLID
  +COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.Amount 2
  Inventory.MaxAmount 200
  Inventory.PickupMessage "$GOTHTHBONUS"
 
 
  States
  {
  Spawn:
    ORGS A -1
    Stop
    
  Pickup:
    ORGS B 0
    stop
    
  }
}

 

Edited by DemonusDefunctus

Share this post


Link to post

9 answers to this question

  • 0

You will certainly need 2 separate actors, one for the pickup-able item and one for the decorative-only object that's supposed to appear in the item's place when the item is picked up. As for the transition between them, you can try spawning the decorative-only object via A_SpawnItemEx in the pickup-able item's Pickup state, or you can try spawning it already in the pickup-able item's Spawn state using the SXF_SETMASTER flag in A_SpawnItemEx, and let it be invisible at first and then change state and become visible when the pickup is collected by calling something like A_KillChildren in the pickup-able item's Pickup state.

Edited by scifista42

Share this post


Link to post
  • 0
15 minutes ago, scifista42 said:

 

 

This didn't work:

 

Spoiler

ACTOR Dined 32186
{
  Game Doom
  Radius 16
  Height 56
  -SOLID
  +NOBLOCKMAP
  +THRUACTORS  
 
    States
    {
    Spawn:
        DINE A -1
        Stop
    
    }
}


//Gives +2 health


ACTOR Dinner1 : Health 32189
{
  Game Doom
  Radius 16
  Height 56
  -SOLID
  +COUNTITEM
  +INVENTORY.ALWAYSPICKUP
  Inventory.Amount 2
  Inventory.MaxAmount 200
  Inventory.PickupMessage "$GOTHTHBONUS" // "Picked up a health bonus."
 
     States
     {
        Spawn:
         ORGN B -1
         Stop
     Pickup:
         ORGN B -1 A_SpawnItemEx ("Dined", 0, 0, 0, 0, 0, 0, 0, 0)          
         Stop
     }
}

 

Share this post


Link to post
  • 0

Wait.. How would I get it to become visible after spawning it?

 

 

I set "Dined" to +INVISIBLE , Then Used the A_SpawnItemEx with the SXF_SETMASTER.

But How to make it visible after that?

 

Edited by DemonusDefunctus

Share this post


Link to post
  • 0

If these are placeable items in maps of your own, just make another actor that is the empty version and place once directly over the other in your map. The one that can get picked up and used will, while the empty one will stay in place.

 

I use this method frequently for "dummy" items or copies of items I don't want the player to be able to grab yet, then do a simple Thing_Remove and Thing_Move swap to move the real one where the fake one was when I am ready for it to be taken.

Share this post


Link to post
  • 0

I had already thought of that. Seems like added work and messy, so I am trying to avoid doing that. Also I want to release a Pk3 with some of the things I have made and would like it to be functional for the end user. Starting to lok like I am out of options.

 

Share this post


Link to post
  • 0

Besides when I tried that the "empty" sprite was in front of the "full" sprite and it just looked ugly and I didn't know how to fix it.

Share this post


Link to post
  • 0

Use SXF_NOCHECKPOSITION in A_SpawnItemEx as well. Right now, this thing is trying to spawn, but you're in the way. That flag there will make sure it spawns regardless.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now