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

[New system] Normal EXP

Status
Not open for further replies.

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
sorry I have to remove these..

  • Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- initial level for all units when they are firstly registered --------
      • Set EXP_Conf_InitialLevel = 1
      • -------- command string to register unit(s) --------
      • Set EXP_Conf_RegisterString = -reg
      • -------- maximum non-computer player number in your game that can manually register unit(s) --------
      • Set EXP_Conf_TotalPlayer = 7
      • -------- true = exp gained by a buildings will be shared, anyway, buildings do not accept exp --------
      • Set EXP_Conf_BuldingKillsGrantExp = True
      • -------- true = share gained exp with non-neutral allied units --------
      • Set EXP_Conf_ShareWithAllies = False
      • -------- true = share exp with other owner's units --------
      • Set EXP_Conf_ShareWithPlyrUnits = True
      • -------- true = all exp gained when hitting enemy will be shared --------
      • Set EXP_Conf_ExpOnHitShare = False
      • -------- distance can affects shared exp amount. set to "0" for constant shared exp --------
      • Set EXP_Conf_ExpGainDistanceFctr = 0.15
      • -------- factor of gained exp that will be shared. as example: factor = 0.50 then shared exp = gained exp * 0.50 --------
      • Set EXP_Conf_ShareExpFact = 1.00
      • -------- maximum range for units to get shared exp --------
      • Set EXP_Conf_ExpShareRange = 800.00
      • -------- base exp gained from killing buildings --------
      • Set EXP_Conf_BaseExpGainBuilding = 0
      • -------- base exp gained from killing heroes --------
      • Set EXP_Conf_BaseExpGainHero = 200
      • -------- base exp gained from killing normal unit --------
      • Set EXP_Conf_BaseExpGainNormal = 100
      • -------- exp gain factor by level (level at object editor) of the attacked normal unit --------
      • Set EXP_Conf_ExpGainNormalLvlFctr = 0.50
      • -------- base exp gained from killing neutrals --------
      • Set EXP_Conf_BaseExpGainNeutral = 50
      • -------- exp gain factor by level (level at object editor) of the attacked neutral unit --------
      • Set EXP_Conf_ExpGainNeutralLvlFctr = 1.25
      • -------- exp gain factor by the level of attacked hero --------
      • Set EXP_Conf_ExpGainHeroLvlFctr = 0.50
      • -------- factor of full gained exp (exp gained on kill). exp on hit will be gained on each hit --------
      • Set EXP_Conf_ExpGainOnHitFact = 0.05
      • -------- next target exp when gains a level. 1,00 = 100% increment = 2x --------
      • Set EXP_Conf_ExpReqLevelUpFact = 0.25
      • -------- initial required exp when unit's level is 1 --------
      • Set EXP_Conf_ExpReqInitial = 500
      • -------- base required exp increment per level. when level up, the current target exp will be multiplied with factors first then this increment value will be added --------
      • Set EXP_Conf_ExpReqBaseIncrmnt = 250
      • -------- maximum level for each unit --------
      • Set EXP_Conf_LevelMax = 30
      • -------- default normal unit's ability level skip requirement --------
      • Set EXP_Conf_DfltAbilityLvlSkipReq = 2
      • For each (Integer A) from 1 to EXP_Conf_TotalPlayer, do (Actions)
        • Loop - Actions
          • Trigger - Add to Manual Register <gen> the event (Player - (Player((Integer A))) types a chat message containing <Empty String> as A substring)
      • Trigger - Run Initialize Library <gen> (checking conditions)
  • Initialize Library
    • Events
    • Conditions
    • Actions
      • -------- initialize unit data --------
      • -------- call RegisterUnitData( unit's rawcode, damage per level, atk speed per level, armor per level, hpmax per level, mpmax per level, hpregen per level, mpregen per level, sight range per level) --------
      • -------- this is data for footman ( 'hfoo' ) --------
      • Custom script: call RegisterUnitData( 'hfoo', 7, 3, 2, 60, 0, 0, 0, 0 )
      • -------- this is data for knight ( 'hkni' ) --------
      • Custom script: call RegisterUnitData( 'hkni', 9, 2, 4, 115, 0, 0, 0, 0 )
      • -------- this is data for rifleman ( 'hrif' ) --------
      • Custom script: call RegisterUnitData( 'hrif', 8, 9, 1, 50, 0, 0, 0, 0 )
      • -------- this is data for gryphon rider ( 'hgry' ) --------
      • Custom script: call RegisterUnitData( 'hgry', 5, 2, 3, 0, 40, 0, 11, 0 )
      • -------- this is data for priest ( 'hmpr' ) --------
      • Custom script: call RegisterUnitData( 'hmpr', 0, 0, 0, 50, 75, 0, 10, 0 )
      • -------- this is data for sorceress ( 'hsor' ) --------
      • Custom script: call RegisterUnitData( 'hsor', 5, 1, 2, 15, 15, 0, 0, 0 )
      • -------- this is data for spell breaker ( 'hspt' ) --------
      • Custom script: call RegisterUnitData( 'hspt', 3, 2, 4, 38, 1, 0, 1, 0 )
      • -------- this is data for dragonhawk rider ( 'hdhw' ) --------
      • Custom script: call RegisterUnitData( 'hdhw', 8, 2, 1, 40, 10, 0, 1, 0 )
      • -------- -------------- --------
      • -------- initialize ability data --------
      • -------- call RegisterAbilityData( rawcode, unit's rawcode that has the ability, maximum level, level skip requirement(use 0 for default) ) --------
      • -------- critical strike for footman (10 level maks) --------
      • Custom script: call RegisterAbilityData( 'A001', 'hfoo', 10, 0 )
      • -------- cleaving attack for footman (10 level maks) --------
      • Custom script: call RegisterAbilityData( 'A002', 'hfoo', 10, 3 )
      • -------- devotion aura for knight (10 level maks) --------
      • Custom script: call RegisterAbilityData( 'A003', 'hkni', 10, 0 )
      • -------- evasion for rifleman (10 level maks) --------
      • Custom script: call RegisterAbilityData( 'A000', 'hrif', 10, 0 )
      • -------- evasion for priest (10 level maks) --------
      • Custom script: call RegisterAbilityData( 'A000', 'hmpr', 10, 0 )
      • -------- cleaving attack for spell breaker (10 level maks) --------
      • Custom script: call RegisterAbilityData( 'A002', 'hspt', 10, 0 )
      • -------- -------------- --------
      • Trigger - Run Initial Register <gen> (checking conditions)
  • EXP On Damage
    • Events
    • Conditions
    • Actions
      • Set EXP_DamageSource = (Damage source)
      • Set EXP_DamageTarget = (Triggering unit)
      • Set EXP_Owner = (Owner of EXP_DamageSource)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (EXP_DamageTarget belongs to an enemy of EXP_Owner) Equal to True
          • ((Life of EXP_DamageTarget) - (Damage taken)) Greater than 0.00
        • Then - Actions
          • For each (Integer EXP_Loop) from 1 to EXP_TotalUnit, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EXP_DamageSource Equal to EXP_Unit[EXP_Loop]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • EXP_ExperiencePtsCurrent[EXP_Loop] Less than EXP_ExperiencePtsTarget[EXP_Loop]
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of EXP_DamageTarget) Equal to Neutral Hostile
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (EXP_DamageTarget is A Hero) Equal to False
                              • (EXP_DamageTarget is A structure) Equal to False
                            • Then - Actions
                              • Set EXP_Gained = (Integer((EXP_Conf_ExpGainOnHitFact x (Real(EXP_Conf_BaseExpGainNeutral)))))
                              • Set EXP_Gained = (EXP_Gained + (Integer(((EXP_Conf_ExpGainNeutralLvlFctr x (Real((Level of EXP_DamageTarget)))) x (Real(EXP_Gained))))))
                            • Else - Actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (EXP_DamageTarget is A Hero) Equal to True
                            • Then - Actions
                              • Set EXP_Gained = (Integer((EXP_Conf_ExpGainOnHitFact x (Real(EXP_Conf_BaseExpGainHero)))))
                              • Set EXP_Gained = (EXP_Gained + (Integer(((EXP_Conf_ExpGainHeroLvlFctr x (Real((Hero level of EXP_DamageTarget)))) x (Real(EXP_Gained))))))
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (EXP_DamageTarget is A structure) Equal to True
                            • Then - Actions
                              • Set EXP_Gained = (Integer((EXP_Conf_ExpGainOnHitFact x (Real(EXP_Conf_BaseExpGainBuilding)))))
                            • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (EXP_DamageTarget is A Hero) Equal to False
                              • (EXP_DamageTarget is A structure) Equal to False
                            • Then - Actions
                              • Set EXP_Gained = (Integer((EXP_Conf_ExpGainOnHitFact x (Real(EXP_Conf_BaseExpGainNormal)))))
                              • Set EXP_Gained = (EXP_Gained + (Integer(((EXP_Conf_ExpGainNormalLvlFctr x (Real((Level of EXP_DamageTarget)))) x (Real(EXP_Gained))))))
                            • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • EXP_Level[EXP_Loop] Less than EXP_Conf_LevelMax
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • EXP_Gained Greater than 0
                            • Then - Actions
                              • Set EXP_ExperiencePtsCurrent[EXP_Loop] = (EXP_ExperiencePtsCurrent[EXP_Loop] + EXP_Gained)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • EXP_ExperiencePtsCurrent[EXP_Loop] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop]
                                • Then - Actions
                                  • Set EXP_Event_LevelGained = 0
                                  • For each (Integer EXP_Repeater) from 0 to 2, do (Actions)
                                    • Loop - Actions
                                      • Set EXP_Repeater = 0
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • EXP_Level[EXP_Loop] Less than EXP_Conf_LevelMax
                                        • Then - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • EXP_ExperiencePtsCurrent[EXP_Loop] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop]
                                            • Then - Actions
                                              • Set EXP_Level[EXP_Loop] = (EXP_Level[EXP_Loop] + 1)
                                              • Set EXP_Event_LevelGained = (EXP_Event_LevelGained + 1)
                                              • Set EXP_ExperiencePtsDifference[EXP_Loop] = (EXP_ExperiencePtsCurrent[EXP_Loop] - EXP_ExperiencePtsTarget[EXP_Loop])
                                              • Set EXP_ExperiencePtsCurrent[EXP_Loop] = EXP_ExperiencePtsDifference[EXP_Loop]
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • EXP_Level[EXP_Loop] Less than EXP_Conf_LevelMax
                                                • Then - Actions
                                                  • Set EXP_ExperiencePtsTarget[EXP_Loop] = (EXP_ExperiencePtsTarget[EXP_Loop] + (Integer((EXP_Conf_ExpReqLevelUpFact x (Real(EXP_ExperiencePtsTarget[EXP_Loop]))))))
                                                  • Set EXP_ExperiencePtsTarget[EXP_Loop] = (EXP_ExperiencePtsTarget[EXP_Loop] + EXP_Conf_ExpReqBaseIncrmnt)
                                                • Else - Actions
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_Damage[udg_EXP_Index[udg_EXP_Loop]], 2)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_Aspd[udg_EXP_Index[udg_EXP_Loop]], 1)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_Armor[udg_EXP_Index[udg_EXP_Loop]], 0)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_HPMax[udg_EXP_Index[udg_EXP_Loop]], 8)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_MPMax[udg_EXP_Index[udg_EXP_Loop]], 9)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_HPRegen[udg_EXP_Index[udg_EXP_Loop]], 6)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_MPRegen[udg_EXP_Index[udg_EXP_Loop]], 7)
                                              • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop], udg_EXP_Lib_SightRange[udg_EXP_Index[udg_EXP_Loop]], 10)
                                              • For each (Integer EXP_Loop2) from 1 to EXP_Lib_AbilityCounter, do (Actions)
                                                • Loop - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • EXP_Lib_AbilityIndex[EXP_Loop2] Equal to EXP_Index[EXP_Loop]
                                                      • (Level of EXP_Lib_Ability[EXP_Loop2] for EXP_Unit[EXP_Loop]) Less than EXP_Lib_AbilityLevelMax[EXP_Loop2]
                                                      • EXP_Level[EXP_Loop] Equal to (((Level of EXP_Lib_Ability[EXP_Loop2] for EXP_Unit[EXP_Loop]) x EXP_Lib_AbilityLevelSkipReq[EXP_Loop2]) + 1)
                                                    • Then - Actions
                                                      • Unit - Increase level of EXP_Lib_Ability[EXP_Loop2] for EXP_Unit[EXP_Loop]
                                                    • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • EXP_ExperiencePtsCurrent[EXP_Loop] Less than EXP_ExperiencePtsTarget[EXP_Loop]
                                                • Then - Actions
                                                  • Set EXP_Repeater = 3
                                                • Else - Actions
                                            • Else - Actions
                                        • Else - Actions
                                          • Set EXP_Repeater = 3
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • EXP_Level[EXP_Loop] Greater than or equal to EXP_Conf_LevelMax
                                    • Then - Actions
                                      • Set EXP_ExperiencePtsCurrent[EXP_Loop] = EXP_ExperiencePtsTarget[EXP_Loop]
                                    • Else - Actions
                                  • Set EXP_Event_LevelCurrent = EXP_Level[EXP_Loop]
                                  • Set EXP_Event_TriggerUnit = EXP_Unit[EXP_Loop]
                                  • Set EXP_Event_LevelUpEvent = 1.00
                                  • Set EXP_Event_LevelUpEvent = 0.00
                                • Else - Actions
                              • Set EXP_Event_ExpGained = EXP_Gained
                              • Set EXP_Event_TriggerUnit = EXP_Unit[EXP_Loop]
                              • Set EXP_Event_GainExpEvent = 1.00
                              • Set EXP_Event_GainExpEvent = 0.00
                            • Else - Actions
                        • Else - Actions
                          • Set EXP_ExperiencePtsCurrent[EXP_Loop] = EXP_ExperiencePtsTarget[EXP_Loop]
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • EXP_Conf_ExpOnHitShare Equal to True
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • EXP_Conf_ShareWithAllies Equal to True
                            • Then - Actions
                              • Set EXP_Point[1] = (Position of EXP_DamageTarget)
                              • For each (Integer EXP_Loop2) from 1 to EXP_TotalUnit, do (Actions)
                                • Loop - Actions
                                  • Set EXP_Point[2] = (Position of EXP_Unit[EXP_Loop2])
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (EXP_Unit[EXP_Loop2] is alive) Equal to True
                                      • (EXP_Unit[EXP_Loop2] belongs to an ally of EXP_Owner) Equal to True
                                      • (Distance between EXP_Point[1] and EXP_Point[2]) Less than or equal to EXP_Conf_ExpShareRange
                                      • EXP_Unit[EXP_Loop2] Not equal to EXP_Unit[EXP_Loop]
                                    • Then - Actions
                                      • Set EXP_Shared = (Integer((EXP_Conf_ShareExpFact x (Real(EXP_Gained)))))
                                      • Set EXP_Shared = (Integer(((Real(EXP_Shared)) - ((Real(EXP_Shared)) x (EXP_Conf_ExpGainDistanceFctr x ((Distance between EXP_Point[1] and EXP_Point[2]) / EXP_Conf_ExpShareRange))))))
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • EXP_Shared Greater than 0
                                        • Then - Actions
                                          • Set EXP_ExperiencePtsCurrent[EXP_Loop2] = (EXP_ExperiencePtsCurrent[EXP_Loop2] + EXP_Shared)
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • EXP_ExperiencePtsCurrent[EXP_Loop2] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop2]
                                            • Then - Actions
                                              • Set EXP_Event_LevelGained = 0
                                              • For each (Integer EXP_Repeater) from 0 to 2, do (Actions)
                                                • Loop - Actions
                                                  • Set EXP_Repeater = 0
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • EXP_Level[EXP_Loop] Less than EXP_Conf_LevelMax
                                                    • Then - Actions
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • EXP_ExperiencePtsCurrent[EXP_Loop2] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop2]
                                                        • Then - Actions
                                                          • Set EXP_Level[EXP_Loop2] = (EXP_Level[EXP_Loop2] + 1)
                                                          • Set EXP_Event_LevelGained = (EXP_Event_LevelGained + 1)
                                                          • Set EXP_ExperiencePtsDifference[EXP_Loop2] = (EXP_ExperiencePtsCurrent[EXP_Loop2] - EXP_ExperiencePtsTarget[EXP_Loop2])
                                                          • Set EXP_ExperiencePtsCurrent[EXP_Loop2] = EXP_ExperiencePtsDifference[EXP_Loop2]
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • EXP_Level[EXP_Loop2] Less than EXP_Conf_LevelMax
                                                            • Then - Actions
                                                              • Set EXP_ExperiencePtsTarget[EXP_Loop2] = (EXP_ExperiencePtsTarget[EXP_Loop2] + (Integer((EXP_Conf_ExpReqLevelUpFact x (Real(EXP_ExperiencePtsTarget[EXP_Loop2]))))))
                                                              • Set EXP_ExperiencePtsTarget[EXP_Loop2] = (EXP_ExperiencePtsTarget[EXP_Loop2] + EXP_Conf_ExpReqBaseIncrmnt)
                                                            • Else - Actions
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_Damage[udg_EXP_Index[udg_EXP_Loop2]], 2)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_Aspd[udg_EXP_Index[udg_EXP_Loop2]], 1)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_Armor[udg_EXP_Index[udg_EXP_Loop2]], 0)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_HPMax[udg_EXP_Index[udg_EXP_Loop2]], 8)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_MPMax[udg_EXP_Index[udg_EXP_Loop2]], 9)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_HPRegen[udg_EXP_Index[udg_EXP_Loop2]], 6)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_MPRegen[udg_EXP_Index[udg_EXP_Loop2]], 7)
                                                          • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_SightRange[udg_EXP_Index[udg_EXP_Loop2]], 10)
                                                          • For each (Integer EXP_Loop3) from 1 to EXP_Lib_AbilityCounter, do (Actions)
                                                            • Loop - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • EXP_Lib_AbilityIndex[EXP_Loop3] Equal to EXP_Index[EXP_Loop2]
                                                                  • (Level of EXP_Lib_Ability[EXP_Loop3] for EXP_Unit[EXP_Loop2]) Less than EXP_Lib_AbilityLevelMax[EXP_Loop3]
                                                                  • EXP_Level[EXP_Loop2] Equal to (((Level of EXP_Lib_Ability[EXP_Loop3] for EXP_Unit[EXP_Loop2]) x EXP_Lib_AbilityLevelSkipReq[EXP_Loop3]) + 1)
                                                                • Then - Actions
                                                                  • Unit - Increase level of EXP_Lib_Ability[EXP_Loop3] for EXP_Unit[EXP_Loop2]
                                                                • Else - Actions
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • EXP_ExperiencePtsCurrent[EXP_Loop2] Less than EXP_ExperiencePtsTarget[EXP_Loop2]
                                                            • Then - Actions
                                                              • Set EXP_Repeater = 3
                                                            • Else - Actions
                                                        • Else - Actions
                                                    • Else - Actions
                                                      • Set EXP_Repeater = 3
                                              • Set EXP_Event_ExpGained = EXP_Shared
                                              • Set EXP_Event_TriggerUnit = EXP_Unit[EXP_Loop2]
                                              • Set EXP_Event_GainExpEvent = 1.00
                                              • Set EXP_Event_GainExpEvent = 0.00
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • EXP_Level[EXP_Loop2] Greater than or equal to EXP_Conf_LevelMax
                                                • Then - Actions
                                                  • Set EXP_ExperiencePtsCurrent[EXP_Loop2] = EXP_ExperiencePtsTarget[EXP_Loop2]
                                                • Else - Actions
                                              • Set EXP_Event_LevelCurrent = EXP_Level[EXP_Loop2]
                                              • Set EXP_Event_TriggerUnit = EXP_Unit[EXP_Loop2]
                                              • Set EXP_Event_LevelUpEvent = 1.00
                                              • Set EXP_Event_LevelUpEvent = 0.00
                                            • Else - Actions
                                        • Else - Actions
                                    • Else - Actions
                                  • Custom script: call RemoveLocation(udg_EXP_Point[2])
                              • Custom script: call RemoveLocation(udg_EXP_Point[1])
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • EXP_Conf_ShareWithPlyrUnits Equal to True
                                • Then - Actions
                                  • Set EXP_Point[1] = (Position of EXP_DamageTarget)
                                  • For each (Integer EXP_Loop2) from 1 to EXP_TotalUnit, do (Actions)
                                    • Loop - Actions
                                      • Set EXP_Point[2] = (Position of EXP_Unit[EXP_Loop2])
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (EXP_Unit[EXP_Loop2] is alive) Equal to True
                                          • (Owner of EXP_Unit[EXP_Loop2]) Equal to EXP_Owner
                                          • (Distance between EXP_Point[1] and EXP_Point[2]) Less than or equal to EXP_Conf_ExpShareRange
                                          • EXP_Unit[EXP_Loop2] Not equal to EXP_Unit[EXP_Loop]
                                        • Then - Actions
                                          • Set EXP_Shared = (Integer((EXP_Conf_ShareExpFact x (Real(EXP_Gained)))))
                                          • Set EXP_Shared = (Integer(((Real(EXP_Shared)) - ((Real(EXP_Shared)) x (EXP_Conf_ExpGainDistanceFctr x ((Distance between EXP_Point[1] and EXP_Point[2]) / EXP_Conf_ExpShareRange))))))
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • EXP_Shared Greater than 0
                                            • Then - Actions
                                              • Set EXP_ExperiencePtsCurrent[EXP_Loop2] = (EXP_ExperiencePtsCurrent[EXP_Loop2] + EXP_Shared)
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • EXP_ExperiencePtsCurrent[EXP_Loop2] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop2]
                                                • Then - Actions
                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • EXP_ExperiencePtsCurrent[EXP_Loop2] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop2]
                                                    • Then - Actions
                                                      • Set EXP_Event_LevelGained = 0
                                                      • For each (Integer EXP_Repeater) from 0 to 2, do (Actions)
                                                        • Loop - Actions
                                                          • Set EXP_Repeater = 0
                                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • EXP_Level[EXP_Loop2] Less than EXP_Conf_LevelMax
                                                            • Then - Actions
                                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • EXP_ExperiencePtsCurrent[EXP_Loop2] Greater than or equal to EXP_ExperiencePtsTarget[EXP_Loop2]
                                                                • Then - Actions
                                                                  • Set EXP_Level[EXP_Loop2] = (EXP_Level[EXP_Loop2] + 1)
                                                                  • Set EXP_Event_LevelGained = (EXP_Event_LevelGained + 1)
                                                                  • Set EXP_ExperiencePtsDifference[EXP_Loop2] = (EXP_ExperiencePtsCurrent[EXP_Loop2] - EXP_ExperiencePtsTarget[EXP_Loop2])
                                                                  • Set EXP_ExperiencePtsCurrent[EXP_Loop2] = EXP_ExperiencePtsDifference[EXP_Loop2]
                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                    • If - Conditions
                                                                      • EXP_Level[EXP_Loop2] Less than EXP_Conf_LevelMax
                                                                    • Then - Actions
                                                                      • Set EXP_ExperiencePtsTarget[EXP_Loop2] = (EXP_ExperiencePtsTarget[EXP_Loop2] + (Integer((EXP_Conf_ExpReqLevelUpFact x (Real(EXP_ExperiencePtsTarget[EXP_Loop2]))))))
                                                                      • Set EXP_ExperiencePtsTarget[EXP_Loop2] = (EXP_ExperiencePtsTarget[EXP_Loop2] + EXP_Conf_ExpReqBaseIncrmnt)
                                                                    • Else - Actions
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_Damage[udg_EXP_Index[udg_EXP_Loop2]], 2)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_Aspd[udg_EXP_Index[udg_EXP_Loop2]], 1)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_Armor[udg_EXP_Index[udg_EXP_Loop2]], 0)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_HPMax[udg_EXP_Index[udg_EXP_Loop2]], 8)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_MPMax[udg_EXP_Index[udg_EXP_Loop2]], 9)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_HPRegen[udg_EXP_Index[udg_EXP_Loop2]], 6)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_MPRegen[udg_EXP_Index[udg_EXP_Loop2]], 7)
                                                                  • Custom script: call CSS_AddBonus (udg_EXP_Unit[udg_EXP_Loop2], udg_EXP_Lib_SightRange[udg_EXP_Index[udg_EXP_Loop2]], 10)
                                                                  • For each (Integer EXP_Loop3) from 1 to EXP_Lib_AbilityCounter, do (Actions)
                                                                    • Loop - Actions
                                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                        • If - Conditions
                                                                          • EXP_Lib_AbilityIndex[EXP_Loop3] Equal to EXP_Index[EXP_Loop2]
                                                                          • (Level of EXP_Lib_Ability[EXP_Loop3] for EXP_Unit[EXP_Loop2]) Less than EXP_Lib_AbilityLevelMax[EXP_Loop3]
                                                                          • EXP_Level[EXP_Loop2] Equal to (((Level of EXP_Lib_Ability[EXP_Loop3] for EXP_Unit[EXP_Loop2]) x EXP_Lib_AbilityLevelSkipReq[EXP_Loop3]) + 1)
                                                                        • Then - Actions
                                                                          • Unit - Increase level of EXP_Lib_Ability[EXP_Loop3] for EXP_Unit[EXP_Loop2]
                                                                        • Else - Actions
                                                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                    • If - Conditions
                                                                      • EXP_ExperiencePtsCurrent[EXP_Loop2] Less than EXP_ExperiencePtsTarget[EXP_Loop2]
                                                                    • Then - Actions
                                                                      • Set EXP_Repeater = 3
                                                                    • Else - Actions
                                                                • Else - Actions
                                                            • Else - Actions
                                                              • Set EXP_Repeater = 3
                                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • EXP_Level[EXP_Loop2] Greater than or equal to EXP_Conf_LevelMax
                                                        • Then - Actions
                                                          • Set EXP_ExperiencePtsCurrent[EXP_Loop2] = EXP_ExperiencePtsTarget[EXP_Loop2]
                                                        • Else - Actions
                                                      • Set EXP_Event_LevelCurrent = EXP_Level[EXP_Loop2]
                                                      • Set EXP_Event_TriggerUnit = EXP_Unit[EXP_Loop2]
                                                      • Set EXP_Event_LevelUpEvent = 1.00
                                                      • Set EXP_Event_LevelUpEvent = 0.00
                                                    • Else - Actions
                                                • Else - Actions
                                              • Set EXP_Event_ExpGained = EXP_Shared
                                              • Set EXP_Event_TriggerUnit = EXP_Unit[EXP_Loop2]
                                              • Set EXP_Event_GainExpEvent = 1.00
                                              • Set EXP_Event_GainExpEvent = 0.00
                                            • Else - Actions
                                        • Else - Actions
                                      • Custom script: call RemoveLocation(udg_EXP_Point[2])
                                  • Custom script: call RemoveLocation(udg_EXP_Point[1])
                                • Else - Actions
                        • Else - Actions
                    • Else - Actions
                  • Set EXP_Loop = (EXP_TotalUnit + 1)
                • Else - Actions
        • Else - Actions

Sorry, I can't post all the triggers because they are too long
 

Attachments

  • ACE vBeta.w3x
    117.1 KB · Views: 86
  • (2)DemoMelee.w3x
    236.8 KB · Views: 58
Last edited by a moderator:
Don't use integer A or B they are slower and less efficient.

That's not really true.

JASS:
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 10
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
It can cause bugs though in some rare-ish situations so you should still avoid them.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
In the physical loop process it is not slower. But when using it it is.
Look here
Here is the trigger portion
  • Set tempInteger = (Integer A)
Here is the jass equivalent.
JASS:
set udg_tempInteger = GetForLoopIndexA()
And the BJ function it uses.
JASS:
function GetForLoopIndexA takes nothing returns integer
    return bj_forLoopAIndex
endfunction
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,534
I've not taken a look into the system code, yet. But variable names like EXP_Conf_BaseExpGainNeutral must be shortend. A variable should be distinct, but as short as possible. Maybe something like EXP_BaseNeutral or EXP_BaseN.

That's just your opinion. Variables in GUI are generally bad but that doesn't solve the problem.
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
I've not taken a look into the system code, yet. But variable names like EXP_Conf_BaseExpGainNeutral [/s]must should be shortend. A variable should be distinct, but as short as possible. Maybe something like EXP_BaseNeutral or EXP_BaseN.

actually he is right :p

updated..
- name changed
 
Status
Not open for further replies.
Top