• 🏆 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!

Custom Experience System Isn't Working?

Status
Not open for further replies.
Level 7
Joined
Aug 11, 2010
Messages
269
Hey there, I invented a custom experience system for my map, Battle Before Armageddon; this experience system kinda allowed me to tweak my own settings and have it more customizable than the default experience system.

However, this backfired. The trigger often bugs meaning alot of units don't give experience, the King doesn't get experience, and if specific (not all) units score the kill on something it doesn't give the experience it should to units around the dying unit.

  • M Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Triggering unit)) is an enemy of (Owner of (Killing unit))) Equal to True
      • (Level of (Triggering unit)) Greater than or equal to 1
    • Actions
      • Set TempUnitArray[1] = (Killing unit)
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempGroup = (Units within 1500.00 of TempPoint)
      • Unit Group - Add TempUnitArray[1] to TempGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than 1
        • Then - Actions
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Triggering unit)) is an enemy of (Owner of (Picked unit))) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • ((Picked unit) is A Hero) Equal to True
                  • (Hero level of (Picked unit)) Less than 25
                  • ((Picked unit) is Summoned) Equal to False
                  • (Unit-type of (Picked unit)) Not equal to Alistair the Younger
                • Then - Actions
                  • Set TempUnit = (Picked unit)
                  • Set TempInteger = (Custom value of TempUnit)
                  • Set TempIntegerArray[1] = (TempIntegerArray[1] + 1)
                  • Set TempIntegerArray[2] = (40 x (Level of (Triggering unit)))
                  • Set TempIntegerArray[2] = ((Integer(MExperienceRate[TempInteger])) x TempIntegerArray[2])
                  • Set TempIntegerArray[2] = (TempIntegerArray[2] / TempIntegerArray[1])
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • ((Triggering unit) is A Hero) Equal to True
                          • ((Triggering unit) is Summoned) Equal to True
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Triggering unit) is A Hero) Equal to True
                          • ((Triggering unit) is Summoned) Equal to True
                        • Then - Actions
                          • Set TempIntegerArray[2] = ((Integer(1.50)) x TempIntegerArray[2])
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Triggering unit) is A Hero) Equal to True
                            • Then - Actions
                              • Set TempIntegerArray[2] = ((Integer(4.00)) x TempIntegerArray[2])
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Triggering unit) is Summoned) Equal to True
                                • Then - Actions
                                  • Set TempIntegerArray[2] = ((Integer(0.25)) x TempIntegerArray[2])
                                • Else - Actions
                    • Else - Actions
                  • Hero - Add TempIntegerArray[2] experience to (Picked unit), Show level-up graphics
                  • Hero - Add TempIntegerArray[2] experience to Alistair the Younger 0080 <gen>, Show level-up graphics
                • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TempUnitArray[1] is A Hero) Equal to True
              • (Hero level of TempUnitArray[1]) Less than 25
              • (TempUnitArray[1] is Summoned) Equal to False
              • (Unit-type of TempUnitArray[1]) Not equal to Alistair the Younger
            • Then - Actions
              • Set TempUnit = TempUnitArray[1]
              • Set TempInteger = (Custom value of TempUnit)
              • Set TempIntegerArray[2] = (40 x (Level of (Triggering unit)))
              • Set TempIntegerArray[2] = ((Integer(MExperienceRate[TempInteger])) x TempIntegerArray[2])
              • Hero - Add TempIntegerArray[2] experience to TempUnitArray[1], Show level-up graphics
              • Hero - Add TempIntegerArray[2] experience to Alistair the Younger 0080 <gen>, Show level-up graphics
            • Else - Actions
      • Set TempIntegerArray[1] = 0
      • Custom script: call DestroyGroup (udg_TempGroup)
      • Custom script: call RemoveLocation (udg_TempPoint)
Does anyone know how I could possibly fix this? Oh, also. The units that AREN'T giving experience are above level 0; just as a bit of a clarification!
 
Level 7
Joined
Aug 11, 2010
Messages
269
Try setting ((Integer(MExperienceRate[TempInteger])) to a value above zero.

Oh darn, I'll admit I had my doubts about this solution but it actually worked. I played the game on the easier difficulty (which grants more experience per unit since theres less units overall) and at 1.50% (MExperienceRate) it gave experience on everything. Awesome! I'll just convert the real variable into a integer and that should solve the problem.


Thanks a bunch!
+REP
 
Level 7
Joined
Aug 11, 2010
Messages
269
Avoid R2I since Warcraft always rounds the real down, this cause the whole system get messy and bugged with exp gain.

I would recommend make the experience in X/100*ExpGain instead of Integer(X.XX)*ExpGain due to R2I issue.

Sorry, I don't quite understand what you mean. Could you explain? the X/100*ExpGain kinda confuses me. What I was thinking of doing is just making the real I used an integer instead.
 
In this line (and similar other ones) :
  • Set TempIntegerArray[2] = ((Integer(4.00)) x TempIntegerArray[2])
Can be replaced with
  • Set TempIntegerArray[2] = ((400/100) x TempIntegerArray[2])
Basically, multiply the converted reals into Integer/100. This will make the 0.25 one works because it's 25/100 which when calculated will pass, not 0.25 which converted into 0 which causes no experience given.
 
Status
Not open for further replies.
Top