HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help from a triggerring expert (Possibly JASS?)

11-09-2003, 04:24 PM#1
Dyne
How can I store in a variable how much resources a player has gained through the game? (I assume it's a global variable, or a function)

Also, how can I access all the data stored in the score screen (Gold traded, hero kills...)
11-09-2003, 04:52 PM#2
weaaddar
Jass yeah thats just what you need...
Or Not.

Techincally speaking you may need Jass to access the cache file thats being generated which stores all that information.

As far as an easier way,
Use an event like Player X gold is greater or equal to 0.
It doesn't matter it'll just make the trigger run each time the guy gets a new value of gold.
Then have an integer (GoldA) which stores the gold he has this time around, and a second integer (GoldSum) which will be your accumulator.
Now you check if GoldA is > Current Gold if it is, it means he hasn't gained any gold so do nothing, else add current gold to GoldSum and outside of the ifthen else logic set Your current gold = to GoldA.
This should allow you to check when the person mines gold. it does have one flaw when somebody cancels a building/unit but if you can assure that it won't happen (1 second build time or refund rate =0%) you are set.

So heres what your trigger should look like

Event-Player Gold is greater then or Equal to 0.
Action-
If GoldA<Players Current Gold
Set GoldSum=GoldSum+Players Current Gold
Else Do nothing
Set Players Current Gold=GoldA.
11-09-2003, 04:58 PM#3
Dyne
But this method has problems. Lets say that 2 players trade resources between themself non stop. It will look like the player has gained alot of gold
11-09-2003, 06:02 PM#4
weaaddar
Well actually war3 considers you to be gaining resources if you trade left and right.

You can always disable trading, but this only a quick method.