Negative gold resource

rogers

You can change this now in User CP.
Reaction score
1
I know I can use an integer for this, but I'm not quite sure how to make it work. I'm trying to set a player's gold to negative. And to check every .50 seconds that if they have any money, take it from them and apply it to the negative integer amount.

I've tried all sorts of things and can't get it to work. How should I do this?
 

rogers

You can change this now in User CP.
Reaction score
1
Players gold can never go into the negatives.
Incorrect. You can set an integer to a negative value and when they don't have enough gold for something, subtract it from that integer then when they gain money (current gold > 0), take it from that.
Trigger:
  • Gold Negative
    • Events
    • Time - Every .50 seconds of game time
    • Conditions
    • Actions
    • Set UserPlayers = (All players controlled by a User player)
    • Set AllPlayers = (All players matching (((Matching player) slot status) Equal to Is playing))
    • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • ((Picked player) is in AllPlayers) Equal to True
    • ((Picked player) is in UserPlayers) Equal to True
    • Then - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • NegativeGold[(Player number of (Picked player))] Less than ((Picked player) Current gold)
    • NegativeGold[(Player number of (Picked player))] Less than 0
    • ((Picked player) Current gold) Greater than 0
    • Then - Actions
    • Quest - Display to (Player group((Picked player))) the Hint message: (MessageType[2] + (You have negative gold and |cffFFCC00 + ((String((((Picked player) Current gold) - NegativeGold[(Player number of (Picked player))]))) + |r has been removed from your gold.)))
    • Set NegativeGold[(Player number of (Picked player))] = (NegativeGold[(Player number of (Picked player))] - ((Picked player) Current gold))
    • Player - Set (Picked player) Current gold to (((Picked player) Current gold) - NegativeGold[(Player number of (Picked player))])
    • Else - Actions
    • Else - Actions

For some reason though, I'm missing something and I can't spot it. It keeps adding the difference instead of subtracting it.

I'm basically wanting it to subtract from their gold and notify them that it was done. If they don't have enough gold but still have some, it will take what they have, set their current gold to 0, and notify them. It will repeat this process constantly as they gain gold until they no longer have a negative.
 

Solu9

You can change this now in User CP.
Reaction score
216
Ehm. That is still not making the gold amount negative.
You are triggering it so it will seem like it can, be it really can't. So Accname is right.
 

rogers

You can change this now in User CP.
Reaction score
1
Ehm. That is still not making the gold amount negative.
You are triggering it so it will seem like it can, be it really can't. So Accname is right.

Thanks for the useless response. Appreciate the lack of usable input. It was incorrect the first time, and it is incorrect now.
 

afisakov

You can change this now in User CP.
Reaction score
37
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NegativeGold[(Player number of (Picked player))] Less than ((Picked player) Current gold)
NegativeGold[(Player number of (Picked player))] Less than 0
((Picked player) Current gold) Greater than 0
Then - Actions
Quest - Display to (Player group((Picked player))) the Hint message: (MessageType[2] + (You have negative gold and |cffFFCC00 + ((String((((Picked player) Current gold) - NegativeGold[(Player number of (Picked player))]))) + |r has been removed from your gold.)))
Set NegativeGold[(Player number of (Picked player))] = (NegativeGold[(Player number of (Picked player))] - ((Picked player) Current gold))
Player - Set (Picked player) Current gold to (((Picked player) Current gold) - NegativeGold[(Player number of (Picked player))])
Else - Actions
Else - Actions
this does not seem to be adding up right
1) Why check both neg_gold<0 and neg_gold<currentgold? currentgold cannot be negative
2) is the value of negative gold positive or negative, aka do u set the integer=-38, or only positive numbers like 52 and its name remembers it as negative>, ths affects the math
3) you set neg gold=neggold-currentgold, this only makes sense is neggold is a positive integer, otherwise u would be increasing the debt by paying, however before this you check if neggold<0. If I am reading this correctly, then the debt can never be paid off because it keeps growing every time game tries to pay it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top