Something didnt work...variables

  • Thread starter Thread starter heyimnotnoob
  • Start date Start date
H

heyimnotnoob

Guest
I wanted to make a trigger that made it so every level you would get a certain precentage of your current gold given to you...

Unfortunatly, this did not work and at 100 gold, i still got none of this extra gold..help me...

EDIT: oh, here are the actions

Event: Player 12s food becomes 0 or less

Condition: Defeat Equal to false

Actions: set Gold(variable) = (player1 current gold) x (14/100)

I dont get ANY extra gold no matter how much gold i have...

What did i do wrong>??

oh and i added an action that says:

Add Gold(variable) to Player 1's current gold

and i made the gold variable an intiger.

what happend
 
Don't even bother with the variable. Just put the calculation part in to the "add X to player's current gold" part (put it where X is).
 
but i want it to add a precentage of whats already owned by the player.
 
I know. Put the whole calculation there. That is, put (player1 current gold) x (14/100) there.
 
The problem is that, when you do "14/100", you are deviding integers. 14/100 will result in 1, and if you multiply your gold by one, you get the same gold. Try doing something like:

Code:
Game - Set Player Gold (To Value): Set to Integer(Real(Gold of (Picked Player)) * 1.14)
 
Korolen said:
The problem is that, when you do "14/100", you are deviding integers. 14/100 will result in 1, and if you multiply your gold by one, you get the same gold. Try doing something like:

Code:
Game - Set Player Gold (To Value): Set to Integer(Real(Gold of (Picked Player)) * 1.14)

uh...

feel free to call me a noob, but i dont quite understand that, can you type that again but with how i would add that to the trigger in the form of actions and events and conditions, not codes...or tell me how to add that to the trigger

and if i put this code thing in there, would i have to delete the stuff that i put in that was false?

and sargon i put that thing that you said, in there
 
Make Korolen's action the only action your trigger has.
 
look, can you put that as actions and events in a trigger in a blank map for me, and copy it as text, into a post, so that i can read it without going :confused: :confused: :(
 
Step-by-step instructions
  1. Press the 'New Action' button.
  2. Select 'Player' in the first drop-down box.
  3. Select 'Add Property' in the second drop-down box.
  4. Click the underlined number '1000'.
  5. In the function drop-down box, select 'Conversion - Convert Real to Integer'.
  6. Click '(Life of (Triggering Unit))'.
  7. Select 'Arithmatic'.
  8. Click the first '1.00'.
  9. Select 'Conversion - Convert Integer to Real'.
  10. Click '(Point-value of Footman)'.
  11. Select 'Player - Player Property'.
  12. Click 'Player 1 (Red)'
  13. Select 'Event Response - Triggering Player' from the function drop-down box.
  14. Click 'OK'.
  15. Click 'OK'.
  16. Click the '+'.
  17. Select 'x'.
  18. Click the '1.00'.
  19. Type '.14'. (<-- or whatever percent you want)
  20. Click 'OK'.
  21. Click 'OK'.
  22. Click 'OK'.
  23. Click 'Player 1 (Red)'.
  24. Select 'Event Response - Triggering Player'.
  25. Click 'OK'.
  26. Click 'OK'.
:D
 
heyimnotnoob said:
look, can you put that as actions and events in a trigger in a blank map for me, and copy it as text, into a post, so that i can read it without going :confused: :confused: :(
Sorry, but I don't have Warcraft installed on the computer I am currently using. I will try to explain it to the best of my ability.

A whole number is a number like 1, 2, 5, 10, 17, 95, 1024, or 819203. A decimal number can be like 1.5, 1.9, 86.2, 1.14, 3.1415, 9283.9182, ect. In Warcraft, Whole numbers are called "Integers", and a decimal number is called a "Real". If you divide 10 by 2 (Both integers), then you will get five. If you divide 10 by 4, instead of getting 2.5, you would get 2, because the result is an Integer, and Integers can't be inbetween two numbers. Note that the result is not rounded, but is instead floored (rounded down). If you wanted to get 2.5 as the result, you would have to divide Real numbers.

In your Gold problem, when you divide 14/100, the answer is 0, because they are Integers, which are rounded down. To get the result .14, you will need to divide Reals. Note that this step can be totally bypassed by putting in ".14" into the Real box.

Now, we have a problem. You cannot do arithmitic on two numbers of different types. IE: You can't multiply a player's current gold by .14, because the player's gold is an Integer, and .14 is a Real. In order to get around this, you would have to convert the gold value to a real. If you converted .14 to an Integer, it would become 0, because Integers can't be in-between.

After you succesfully calculate how much to add, you want to add it to the player's current gold. This can be done by putting the calculated value into the "Game - Modify Player Recource". However, I't won't accept it! The reson is, is that the gold has to be an Integer, and the calculated value is a Real! How inconvienent. To convert the Real to an Integer, you can use the "Conversion - Convert Real to Integer" function. Note that you may want to round the real value with "Math - Round Number".

After you put it all together, you get something like this:
Code:
Game - Add to Player's Gold: Add Integer(Real(Gold of (Picked Player)) * 0.14) to (Picked Player)'s gold.

I hope this helps!
-- Korolen
 
the Lumpy said:
Step-by-step instructions
  1. Press the 'New Action' button.
  2. Select 'Player' in the first drop-down box.
  3. Select 'Add Property' in the second drop-down box.
  4. Click the underlined number '1000'.
  5. In the function drop-down box, select 'Conversion - Convert Real to Integer'.
  6. Click '(Life of (Triggering Unit))'.
  7. Select 'Arithmatic'.
  8. Click the first '1.00'.
  9. Select 'Conversion - Convert Integer to Real'.
  10. Click '(Point-value of Footman)'.
  11. Select 'Player - Player Property'.
  12. Click 'Player 1 (Red)'
  13. Select 'Event Response - Triggering Player' from the function drop-down box.
  14. Click 'OK'.
  15. Click 'OK'.
  16. Click the '+'.
  17. Select 'x'.
  18. Click the '1.00'.
  19. Type '.14'. (<-- or whatever percent you want)
  20. Click 'OK'.
  21. Click 'OK'.
  22. Click 'OK'.
  23. Click 'Player 1 (Red)'.
  24. Select 'Event Response - Triggering Player'.
  25. Click 'OK'.
  26. Click 'OK'.
:D

never mind, this works fine...thanks
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper
  • Stephen Stephen:
    Oh no - please don't lose the Nuon content
    +1
  • The Helper The Helper:
    Someone email AtariAge and see if they want me to transfer the forum data over to it
  • Ghan Ghan:
    Could probably keep NUON stuff around here if we wanted.
  • Ghan Ghan:
    Hmm what to do about the World Editor site though?
  • Stephen Stephen:
    I'd rather personally just own a backup of the Nuon data than see it go to AtariAge honestly. If it gets enshittified as per usual, or if some of the "regular" Jaguar folks get there, it's not gonna be fun
  • The Helper The Helper:
    There will be a github of the forum data so the NUON Forum Data I guess would be available there
  • The Helper The Helper:
    World Editor is technically Ryoko stuff not mine you guys can keep that I am not in that even
  • jonas jonas:
    :( end of an era :(
  • The Helper The Helper:
    Dont think of it as an end jonas - think of it as a beginning, because really my friend that is what it is.
  • A Andyoyo:
    Thank you for the hard work over the years. It did not go unnoticed.

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top