• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Extra Stat Point?! 0 = 1?? (Custom Stat Point System)

Status
Not open for further replies.
Level 12
Joined
Jan 30, 2009
Messages
1,067
Hello, and please excuse the poor title name!

So for today, I need help with what I think might be a simple problem that I just can't see.

When I'm finished adding stats via my stat system, it somehow gives me an extra number of points.

For instance, if I level three times, I am granted with 15 APs (Attribute Points). That's 5 per level. Now, when I go in and actually spend the points via the system, when I get down to 0 points, it does what it is supposed to do, and not allow you to add anymore points (It's not...perfect, unfortunately, but basically, it simply won't add more to your stats when you click the buttons). The problem is after that, when I check the APs remaining, after I have spent all 15 of them, it comes up saying I have 1 remaining. When I open the menu back up, it indeed says I have 1, and I can spend that 1 point indefinitely this way.

I'm not sure where this comes from. Anyway, I know this is probably the most fucked up attempt at making triggers you've about ever seen, but I'm not claiming to be any good with these stupid things. Here's the system. You'll notice there's a lot of unused/unnecessary stuff in there, cause I haven't finished cleaning it up yet (Since it's not working perfectly, and this is the result of many different experiments to get this right). Couple of things will be changed later on, some of which I'll explain as I post the triggers.

Please do be nice. I'm absolutely terrible with this. I HATE triggers, but since I don't have any trigger help, I'm having to do this myself. :sad:

EDIT: Somehow in a 11 hour period of time, without being touched, the system fucked up and other things simply aren't working now, that weren't causing problems last night.

In this first trigger, you'll note the Unit-type variables, they're uncleaned experiments. You'll see them throughout the system as well. Ignore those.
  • Ability Points
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set AP_Hero[1] = (Units of type 1)
      • Set AP_Hero[2] = (Units of type 2)
      • Set AP_Hero[3] = (Units of type 3)
      • Set AP_Hero[4] = (Units of type 4)
      • Set AP_Hero[5] = (Units of type 5)
      • Set AP_Counter[1] = 0
      • Set AP_Counter[2] = 0
      • Set AP_Counter[3] = 0
      • Set AP_Counter[4] = 0
      • Set AP_Counter[5] = 0
      • -------- vvv --- This is a test function. Don't forget to remove. --- vvv --------
      • Set Player_Heroes[1] = Blademaster 0040 <gen>
So, what this does is give each hero a corresponding Counter for their APs. Player_Heroes[1] is my test :D

  • Receive AP
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Triggering unit) is A Hero) Equal to (==) True
    • Actions
      • -------- --- --------
      • -------- vvv --- THIS IS FOR TESTING ONLY. REMOVE BEFORE RELEASE. --- vvv --------
      • -------- --- --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to (==) Player_Heroes[1]
          • Then - Actions
            • Set AP_Counter[1] = (AP_Counter[1] + 5)
          • Else - Actions
      • -------- --- --------
      • -------- ^^^ --- Above is for testing purposes. --- ^^^ --------
      • -------- --- --------
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to (==) (Random unit from AP_Hero[1])
          • Then - Actions
            • Set AP_Counter[1] = (AP_Counter[1] + 5)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to (==) (Random unit from AP_Hero[2])
          • Then - Actions
            • Set AP_Counter[2] = (AP_Counter[2] + 5)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to (==) (Random unit from AP_Hero[3])
          • Then - Actions
            • Set AP_Counter[3] = (AP_Counter[3] + 5)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to (==) (Random unit from AP_Hero[4])
          • Then - Actions
            • Set AP_Counter[4] = (AP_Counter[4] + 5)
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to (==) (Random unit from AP_Hero[5])
          • Then - Actions
            • Set AP_Counter[5] = (AP_Counter[5] + 5)
          • Else - Actions
I think this is rather straightforward. Awards APs when the hero levels. And yes, I know, Random Units... Ignore those... like I said, placeholders.

This is just a temp method of checking APs till I set up the multiboard. Added for sake of completion.
  • Check APs
    • Events
      • Player - Player 1 (Red) types a chat message containing -APs as An exact match
    • Conditions
    • Actions
      • Game - Display to (All players) the text: (1's APs: |cffffcc00 + ((String(AP_Counter[1])) + |r.))
      • Game - Display to (All players) the text: (2's APs: |cffffcc00 + ((String(AP_Counter[2])) + |r.))
      • Game - Display to (All players) the text: (3's APs: |cffffcc00 + ((String(AP_Counter[3])) + |r.))
      • Game - Display to (All players) the text: (4's APs: |cffffcc00 + ((String(AP_Counter[4])) + |r.))
      • Game - Display to (All players) the text: (5's APs: |cffffcc00 + ((String(AP_Counter[5])) + |r.))
  • Setup Dialog
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Ability Points
    • Actions
      • Set AP_Caster = (Triggering unit)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • AP_Caster Equal to (==) (Random unit from AP_Hero[1])
          • Then - Actions
            • Set AP_Counter2 = AP_Counter[1]
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • AP_Caster Equal to (==) (Random unit from AP_Hero[2])
              • Then - Actions
                • Set AP_Counter2 = AP_Counter[2]
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • AP_Caster Equal to (==) (Random unit from AP_Hero[3])
                  • Then - Actions
                    • Set AP_Counter2 = AP_Counter[3]
                  • Else - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • AP_Caster Equal to (==) (Random unit from AP_Hero[4])
                      • Then - Actions
                        • Set AP_Counter2 = AP_Counter[4]
                      • Else - Actions
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • AP_Caster Equal to (==) (Random unit from AP_Hero[5])
                          • Then - Actions
                            • Set AP_Counter2 = AP_Counter[5]
                          • Else - Actions
                            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • AP_Caster Equal to (==) Player_Heroes[1]
                              • Then - Actions
                                • -------- This IF/THEN/ELSE is strictly for testing purposes. Remove before release. --------
                                • Set AP_Counter2 = AP_Counter[1]
                              • Else - Actions
      • Dialog - Clear AP_Dialog[1]
      • Dialog - Change the title of AP_Dialog[1] to (APs: |cFFFFCC00 + ((String(AP_Counter2)) + |r. Choose stat to modify.))
      • Dialog - Create a dialog button for AP_Dialog[1] labelled Stamina
      • Set AP_DialogStats[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[1] labelled Strength
      • Set AP_DialogStats[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[1] labelled Intellect
      • Set AP_DialogStats[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[1] labelled Close
      • Set AP_DialogStats[4] = (Last created dialog Button)
      • Dialog - Show AP_Dialog[1] for Player 1 (Red)
This has 2 parts to it. Firstly, it checks which hero is the one who cast the ability, so the AP_Counter2 variable can be set. Secondly, it sets up the first dialog menu.

  • Choose Stat
    • Events
      • Dialog - A dialog button is clicked for AP_Dialog[1]
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to (==) AP_DialogStats[1]
        • Then - Actions
          • Dialog - Clear AP_Dialog[2]
          • Dialog - Change the title of AP_Dialog[2] to (APs: |cFFFFCC00 + ((String(AP_Counter2)) + |r. Increase Stamina by how much?))
          • Dialog - Create a dialog button for AP_Dialog[2] labelled +1
          • Set AP_DialogAdd[1] = (Last created dialog Button)
          • Dialog - Create a dialog button for AP_Dialog[2] labelled +2
          • Set AP_DialogAdd[2] = (Last created dialog Button)
          • Dialog - Create a dialog button for AP_Dialog[2] labelled +3
          • Set AP_DialogAdd[3] = (Last created dialog Button)
          • Dialog - Create a dialog button for AP_Dialog[2] labelled +4
          • Set AP_DialogAdd[4] = (Last created dialog Button)
          • Dialog - Create a dialog button for AP_Dialog[2] labelled +5
          • Set AP_DialogAdd[5] = (Last created dialog Button)
          • Dialog - Create a dialog button for AP_Dialog[2] labelled Return
          • Set AP_DialogAdd[6] = (Last created dialog Button)
          • Dialog - Show AP_Dialog[2] for Player 1 (Red)
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to (==) AP_DialogStats[2]
            • Then - Actions
              • Dialog - Clear AP_Dialog[3]
              • Dialog - Change the title of AP_Dialog[3] to (APs: |cFFFFCC00 + ((String(AP_Counter2)) + |r. Increase Strength by how much?))
              • Dialog - Create a dialog button for AP_Dialog[3] labelled +1
              • Set AP_DialogAdd[1] = (Last created dialog Button)
              • Dialog - Create a dialog button for AP_Dialog[3] labelled +2
              • Set AP_DialogAdd[2] = (Last created dialog Button)
              • Dialog - Create a dialog button for AP_Dialog[3] labelled +3
              • Set AP_DialogAdd[3] = (Last created dialog Button)
              • Dialog - Create a dialog button for AP_Dialog[3] labelled +4
              • Set AP_DialogAdd[4] = (Last created dialog Button)
              • Dialog - Create a dialog button for AP_Dialog[3] labelled +5
              • Set AP_DialogAdd[5] = (Last created dialog Button)
              • Dialog - Create a dialog button for AP_Dialog[3] labelled Return
              • Set AP_DialogAdd[6] = (Last created dialog Button)
              • Dialog - Show AP_Dialog[3] for Player 1 (Red)
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to (==) AP_DialogStats[3]
                • Then - Actions
                  • Dialog - Clear AP_Dialog[4]
                  • Dialog - Change the title of AP_Dialog[4] to (APs: |cFFFFCC00 + ((String(AP_Counter2)) + |r. Increase Intellect by how much?))
                  • Dialog - Create a dialog button for AP_Dialog[4] labelled +1
                  • Set AP_DialogAdd[1] = (Last created dialog Button)
                  • Dialog - Create a dialog button for AP_Dialog[4] labelled +2
                  • Set AP_DialogAdd[2] = (Last created dialog Button)
                  • Dialog - Create a dialog button for AP_Dialog[4] labelled +3
                  • Set AP_DialogAdd[3] = (Last created dialog Button)
                  • Dialog - Create a dialog button for AP_Dialog[4] labelled +4
                  • Set AP_DialogAdd[4] = (Last created dialog Button)
                  • Dialog - Create a dialog button for AP_Dialog[4] labelled +5
                  • Set AP_DialogAdd[5] = (Last created dialog Button)
                  • Dialog - Create a dialog button for AP_Dialog[4] labelled Return
                  • Set AP_DialogAdd[6] = (Last created dialog Button)
                  • Dialog - Show AP_Dialog[4] for Player 1 (Red)
                • Else - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Clicked dialog button) Equal to (==) AP_DialogStats[4]
                    • Then - Actions
                      • Dialog - Hide AP_Dialog[1] for Player 1 (Red)
                    • Else - Actions
      • Dialog - Clear AP_Dialog[1]
This is for setting up the submenu of each button.

This next one I'm only going to show one of them, since they're all the same with the only difference being the different stats.
  • Intellect Increase
    • Events
      • Dialog - A dialog button is clicked for AP_Dialog[4]
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to (==) AP_DialogAdd[1]
          • AP_Counter2 Greater than or equal to (>=) 1
        • Then - Actions
          • Hero - Modify Intelligence of AP_Caster: Add 1
          • Set AP_Counter2 = (AP_Counter2 - 1)
          • Set AP_Counter[AP_Counter2] = AP_Counter2
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to (==) AP_DialogAdd[2]
              • AP_Counter2 Greater than or equal to (>=) 2
            • Then - Actions
              • Hero - Modify Intelligence of AP_Caster: Add 2
              • Set AP_Counter2 = (AP_Counter2 - 2)
              • Set AP_Counter[AP_Counter2] = AP_Counter2
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to (==) AP_DialogAdd[3]
                  • AP_Counter2 Greater than or equal to (>=) 3
                • Then - Actions
                  • Hero - Modify Intelligence of AP_Caster: Add 3
                  • Set AP_Counter2 = (AP_Counter2 - 3)
                  • Set AP_Counter[AP_Counter2] = AP_Counter2
                • Else - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Clicked dialog button) Equal to (==) AP_DialogAdd[4]
                      • AP_Counter2 Greater than or equal to (>=) 4
                    • Then - Actions
                      • Hero - Modify Intelligence of AP_Caster: Add 4
                      • Set AP_Counter2 = (AP_Counter2 - 4)
                      • Set AP_Counter[AP_Counter2] = AP_Counter2
                    • Else - Actions
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Clicked dialog button) Equal to (==) AP_DialogAdd[5]
                          • AP_Counter2 Greater than or equal to (>=) 5
                        • Then - Actions
                          • Hero - Modify Intelligence of AP_Caster: Add 5
                          • Set AP_Counter2 = (AP_Counter2 - 5)
                          • Set AP_Counter[AP_Counter2] = AP_Counter2
                        • Else - Actions
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Clicked dialog button) Equal to (==) AP_DialogAdd[6]
                            • Then - Actions
                              • Dialog - Clear AP_Dialog[1]
                              • Dialog - Change the title of AP_Dialog[1] to (APs: |cFFFFCC00 + ((String(AP_Counter2)) + |r. Choose stat to modify.))
                              • Dialog - Create a dialog button for AP_Dialog[1] labelled Stamina
                              • Set AP_DialogStats[1] = (Last created dialog Button)
                              • Dialog - Create a dialog button for AP_Dialog[1] labelled Strength
                              • Set AP_DialogStats[2] = (Last created dialog Button)
                              • Dialog - Create a dialog button for AP_Dialog[1] labelled Intellect
                              • Set AP_DialogStats[3] = (Last created dialog Button)
                              • Dialog - Create a dialog button for AP_Dialog[1] labelled Close
                              • Set AP_DialogStats[4] = (Last created dialog Button)
                              • Dialog - Hide AP_Dialog[4] for Player 1 (Red)
                              • Dialog - Show AP_Dialog[1] for Player 1 (Red)
                              • Skip remaining actions
                            • Else - Actions
      • Dialog - Clear AP_Dialog[4]
      • Dialog - Change the title of AP_Dialog[4] to (APs: |cFFFFCC00 + ((String(AP_Counter2)) + |r. Increase Intellect by how much?))
      • Dialog - Create a dialog button for AP_Dialog[4] labelled +1
      • Set AP_DialogAdd[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[4] labelled +2
      • Set AP_DialogAdd[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[4] labelled +3
      • Set AP_DialogAdd[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[4] labelled +4
      • Set AP_DialogAdd[4] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[4] labelled +5
      • Set AP_DialogAdd[5] = (Last created dialog Button)
      • Dialog - Create a dialog button for AP_Dialog[4] labelled Return
      • Set AP_DialogAdd[6] = (Last created dialog Button)
      • Dialog - Hide AP_Dialog[4] for Player 1 (Red)
      • Dialog - Show AP_Dialog[4] for Player 1 (Red)
This part is where the points are spent. 1-5 depending on which button you choose. The parts where I set "Set AP_Counter[AP_Counter2] = AP_Counter2" was the only way I could think of setting this up so I didn't have to make the system individually for each hero...


For the record, there's a noticeable lack in tuts for making Dialogs. The one that there is only shows the most basic of dialogs (One menu with 2 simple buttons). And I was quite annoyed when trying to figure out how to get submenus in there!


As I'm sure you'll notice... I write EVERYTHING down so i don't forget what shit is for. I have half a dozen comment triggers in between explaining every aspect of everything so I can pick it up in 6 years if I needed to. If I don't, I'll forget later and I'll be pissed off for not remembering. So, those are simply for my own personal amusement.

Anyway, as per always, I abide by my signature. Also, another shameless advertisement... If I had a Triggerer helping me with my project, these issues wouldn't be happening, and the demo would be released MUCH sooner. More details in the signature. Clicky! <3
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Post a test map.

I recommend you use hashtables:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • Untitled Trigger 026
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Hashtable - Save ((Load (Key points) of (Key (Triggering unit)) from Hash) + 5) as (Key points) of (Key (Triggering unit)) in Hash
  • Untitled Trigger 027
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set i1 = (Load (Key points) of (Key (Triggering unit)) from Hash)
You gain 5 points on level up. When you start the effect of the ability, you can load the points. Saves you a lot of lines.
 
Also, if you want MPI events/conditions/actions, use either Pick Every Player or For Each Integer. An example to replace your events in Trig 2:
  • Receive AP
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • -------- Basically replaces your index with Integer A --------
      • -------- Checks from Player 1 to 12 --------
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • -------- Put in your conditions, .eg. Player(Integer A) slot status Equal to Is Playing --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to (Random unit from AP_Hero[(Integer A)])
            • Then - Actions
              • Set AP_Counter[(Integer A)] = (AP_Counter[(Integer A)] + 1)
            • Else - Actions
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
Hashtables don't seem to work right for me for some reason. This way is just simpler for me and my GameCache.

Also, It's single-player. Doesn't need to be MPI. It's a campaign. I'll make a test map here soon.

EDIT: Okay, so...test map broke everything, and I'm not sure WHY it broke everything. It worked fine in my actual map, which I do NOT want to post here.

And yes, I copied the triggers, and the ability. I have the transfer variables options checked. It just isn't working now, and I don't know why. Clicking the button doesn't do anything but close the dialog now.

EDIT2: Holy shit. This makes no sense. Without editing it at all. Somehow the act of saving my map broke the system in another way. Now I'm utterly befuddled.

EDIT3: Here's the testmap. Every time I fucking test it, it's a different problem. Sometimes things work, sometimes things don't, this is brutal to me. Furthermore, if possible, I'd REALLY like to not use hashtables. Like I said above, they don't seem to work for me for some reason (So I gave up trying to figure them out any further. I'm using NewGen if that makes a difference). It's much easier for me to save the arrays in the GameCache since I know how to do all of that without worrying if it's not gonna actually work.
 

Attachments

  • AP System Test.w3x
    30.6 KB · Views: 85
Last edited:
Level 12
Joined
Jan 30, 2009
Messages
1,067
Bump again.

Guys. Let me reiterate now what I need help with.

At this point, I'm not certain what exactly is wrong with the system. I'd like someone to look over it and see if they can find it. The list of problems that (Randomly) occur is as follows:


  • AP_Counter[1] not being set to 0 after AP_Counter2 is set to 0.
  • The ABILITY that opens up the dialog boxes itself sometimes doesn't open it.
  • When it does open up, most of the time, clicking any of the stat buttons simply closes the dialog box.
  • And lastly, sometimes APs appear where they don't belong. If Hero[1] gains a level, Hero[5] sometimes gains APs as well.
Those are the ones I've encountered thus far. I'd appreciate any help. Once again, I'd rather stay away from hashtables, since for some reason they never seem to work correctly for me (I've given up trying to use them).

Also, the values need to be saved in GameCache, so variable arrays are much simpler for me. :)

And of course, any help will be rewarded, as per usual.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Does evey player only have one hero?

I did it in hastables anyway. But you can repalce hashtables with an integer array quite easily.

+Int works now.

I reworked the dialog thingy a bit. I created one dialog initialization trigger, dialogs don't need to be created/cleared every time you use them. I also use loops to detect the clicked button.
 

Attachments

  • AP System Test.w3x
    29 KB · Views: 46
Level 12
Joined
Jan 30, 2009
Messages
1,067
Maker, it's a Campaign. Single-player.

There's going to be (ATM) 5 heroes that can be used by the player. 1 player 5 heroes to answer your question. Therefore, all of this (Player Number of(whatever)) doesn't quite work, since it's always the same player, if I'm not mistaken? Could you fix that, please, as I'm not sure how to go about doing it myself, especially since you pretty much redid the whole system.

Also, I noticed you did hashtables differently than I was trying to. Do they not work in GUI for some reason? They haven't worked for me, ><

EDIT: One more thing, whilst the system itself can be remade for every map in the campaign (That's not a problem), I do need to be able to save the point values of the heroes in the GameCache. How would I do this with the way you have set it up? I'm assuming my being unable to do it with hashtables previously is linked with the reason you used custom scripts to do hashtables.

EDIT2: Just tested it, and it indeed doesn't work with multiple heroes of same player, just as I thought.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
GUI hashtables don't work with JNGP, thus the custom scripts.

It should now work for multiple heroes for the same player.
You can save the ap points in game cache like this:
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set i2 = 0
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set i2 = (i2 + 1)
          • Custom script: set udg_i1 = LoadInteger( udg_AP_Hash , GetHandleId( GetEnumUnit() ), StringHash("apPoints") )
          • Game Cache - Store i1 as AP_Points of (hero + (String(i2))) in (Last created game cache)
You can use your own category key system too, but this way the keys are hero1, hero2, hero3 and so on.
 

Attachments

  • AP System Test.w3x
    28.4 KB · Views: 56
Level 12
Joined
Jan 30, 2009
Messages
1,067
Okay, that clears up a lot of confusion on hashtables. Thanks a lot. Maybe I'll be able to have a use for them now.

Thanks for fixing it.

And thanks for telling me how to save them.

Extremely helpful as always.
 
Status
Not open for further replies.
Top