Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Mad Dal 85

Money Not Working Properly

Question

Money is not working properly in my Doom Mod. Instead of it all adding up together, it keeps appearing in another inventory slot instead. Anyone know what I am doing wrong? Here is the script (DECORATE)

Actor GoldCoin : CustomInventory
{

  Game Doom

  +FloorClip

  +Inventory.InvBar
  Inventory.Amount 1

  Inventory.MaxAmount 5000000

  Inventory.InterHubAmount 5000000

  Inventory.PickupMessage "Picked up a gold coin."

  Inventory.Icon "COINA0"

  Tag "Coins for shopping"

  States

  {

  Spawn:

    COIN A -1

    Stop

  }

}

 

Actor GoldCoin2 : GoldCoin

{

  Inventory.PickupMessage "Picked up 10 gold coins."

  States

  {

  Spawn:

    COIN B -1

    Stop

  Pickup:

    TNT1 A 1 A_GiveInventory("GoldCoin", 10)

    Stop

  }

}

 

I have also tried this method too but it's the same result, just appears in another inventory slot instead of adding on to the current slot.

 

Actor GoldCoin2 : GoldCoin

{

  Game Doom

  +FloorClip

  +Inventory.InvBar
  Inventory.Amount 10

  Inventory.MaxAmount 5000000

  Inventory.InterHubAmount 5000000

  Inventory.PickupMessage "Picked up 10 gold coin."

  States

  {

  Spawn:

    COIN B -1

    Stop

  }

}

 

Also tried this too but it's still the same result.

 

Actor GoldCoin : Inventory
{

  Game Doom

  +FloorClip

  +Inventory.InvBar
  Inventory.Amount 1

  Inventory.MaxAmount 5000000

  Inventory.InterHubAmount 5000000

  Inventory.PickupMessage "Picked up a gold coin."

  Inventory.Icon "COINA0"

  Tag "Coins for shopping"

  States

  {

  Spawn:

    COIN A -1

    Stop

  }

}

 

Actor GoldCoin2 : GoldCoin

{

  Inventory.PickupMessage "Picked up 10 gold coins."

  States

  {

  Spawn:

    COIN B -1

    Stop

  Pickup:

    TNT1 A 1 A_GiveInventory("GoldCoin", 10)

    Stop

  }

}

Share this post


Link to post

9 answers to this question

Recommended Posts

  • 1

Patience usually goes a long way when it comes to this sort of thing.

 

From what it looks like to me, you're inheriting each coin from your first class, which means that each coin pickup itself would be classified as its own inventory pickup and not the same one. It has been a hot minute since I've touched DECORATE, though, so take this with a grain of salt. However, since this seems to have the same purpose as Strife's coins, why not just apply your sprites to the preexisting coin pickups? Any differing amounts of coin you'd want to give could be given by defining new Coin classes which would add up whatever value you specify within them.

Share this post


Link to post
  • 1

The basic item should be derived from Inventory, not CustomInventory because it has no Pickup/Use action.

The "big" item should be derived from CustomInventory (not from the basic item), since it is just a pickup that gives "something else not itself", like Megasphere is not derived from health items...

 

Don't try to directly copy strife money coding as it has quite complex logic and it will not work without ZScript (Using existing classes or deriving from them should work though).

 

This works for me:

Actor GoldCoin : Inventory
{
  +FloorClip
  +Inventory.InvBar
  Inventory.Amount 1
  Inventory.MaxAmount 5000000
  Inventory.InterHubAmount 5000000
  Inventory.PickupMessage "Picked up a gold coin."
  Inventory.Icon "COINA0"
  Tag "Coins for shopping"

  States
  {
  Spawn:
    COIN A -1
    Stop
  }
}

Actor GoldCoin2 : CustomInventory
{
  +FloorClip
  Inventory.Icon "COINA0"
  
  Inventory.PickupMessage "Picked up 10 gold coins."
  States
  {
  Spawn:
    COIN B -1
    Stop
  Pickup:
    TNT1 A 1 A_GiveInventory("GoldCoin", 10)
    Stop
  }
}

 

 

Share this post


Link to post
  • 0

i'm seriously at my wits end now! i've tried everything i can think of to solve this but nothing. no currency in the mod means the rest of the mod is pointless and no one gets to see it. 

 

Look at the inventory bar (bottom) and you'll see my problem. i cannot work out where i am going wrong. even copying Strife's coding doesn't work. please help.

Screenshot_Doom_20230222_222934.png

Edited by Mad Dal 85

Share this post


Link to post
  • 0

Please! Surely someone must know what is wrong here? I've been stuck on this for hours now and it's really stressing me out BIG TIME!!! 

 

Screenshot 2023-02-23 15.39.29.png

Share this post


Link to post
  • 0

i have tried everything in every way i can think of. nothing seems to work. Parent item, each one as an inventory/custominventory and more nothing seems to work. i'll gladly send it to someone via DM/PM to fix it or at least properly show me the how it should be done, because i do not know what to do anymore. this is my first time i have been modding doom in two years as i have been without a computer since early 2021 so i do not remember much. 

Share this post


Link to post
  • 0
1 hour ago, JustAthel said:

Patience usually goes a long way when it comes to this sort of thing.

 

From what it looks like to me, you're inheriting each coin from your first class, which means that each coin pickup itself would be classified as its own inventory pickup and not the same one. It has been a hot minute since I've touched DECORATE, though, so take this with a grain of salt. However, since this seems to have the same purpose as Strife's coins, why not just apply your sprites to the preexisting coin pickups? Any differing amounts of coin you'd want to give could be given by defining new Coin classes which would add up whatever value you specify within them.

sorry but i don't understand what you mean by any of that (short and simple please) my brain is just exhausted from all this stress of trying to get these coins to work over the last 24hours 

Edited by Mad Dal 85

Share this post


Link to post
  • 0
17 minutes ago, jaeden said:

The basic item should be derived from Inventory, not CustomInventory because it has no Pickup/Use action.

The "big" item should be derived from CustomInventory (not from the basic item), since it is just a pickup that gives "something else not itself", like Megasphere is not derived from health items...

 

Don't try to directly copy strife money coding as it has quite complex logic and it will not work without ZScript (Using existing classes or deriving from them should work though).

 

This works for me:


Actor GoldCoin : Inventory
{
  +FloorClip
  +Inventory.InvBar
  Inventory.Amount 1
  Inventory.MaxAmount 5000000
  Inventory.InterHubAmount 5000000
  Inventory.PickupMessage "Picked up a gold coin."
  Inventory.Icon "COINA0"
  Tag "Coins for shopping"

  States
  {
  Spawn:
    COIN A -1
    Stop
  }
}

Actor GoldCoin2 : CustomInventory
{
  +FloorClip
  Inventory.Icon "COINA0"
  
  Inventory.PickupMessage "Picked up 10 gold coins."
  States
  {
  Spawn:
    COIN B -1
    Stop
  Pickup:
    TNT1 A 1 A_GiveInventory("GoldCoin", 10)
    Stop
  }
}

 

 

i'll give this a try. i'll let you know how it goes.

Share this post


Link to post
  • 0
21 hours ago, Mad Dal 85 said:

sorry but i don't understand what you mean by any of that (short and simple please) my brain is just exhausted from all this stress of trying to get these coins to work over the last 24hours 

 

Sometimes it helps to step away from a problem and clear your mind for a day or two. Personally, as a software engineer, I tend to get worked up over code that does not work correctly and that makes it worse. Taking a break and clearing my mind often means I come back to the problem from a different angle, and sometimes, that makes the difference. At worst my stress level goes down anyway.

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
×