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

[Trigger] MUI Charge should work fine, but doesnt

Status
Not open for further replies.
Level 24
Joined
Jun 16, 2008
Messages
1,939
HI!

It's me again. I opened a thread concerning my Charge spell some time ago and since then I and Paladon (you might know him) both worked on the spell, but we couldnt fix it.

Today I made the whole spell MUI/MPI and overworked it completely, trying to find a bug. Apart from that I shortened it from 4 to 3 triggers implementing the fade system into the dummy trigger.

I will post the 3 triggers here with the hoping that some genius scripter @ thehive might be able to fix it...

I will comment on every trigger, what it is suppoesed to do and I will attach the map to this post.

To really understand the problem you will have to take a look at the map!!!!

Plz help me!!!

----Palaslayer----





So, here is the first trigger called ChargeCast. It is activ from the beginning and it detects when the Charge is casted. It sets some points, including the position of the target and the position of the caster.
Point 3 is an offset from the angle of point 1 towards point 2, where the caster will be moved to the first time. In addition this trigger prepars the other ones by hiding the charger and so on.


  • ChargeCast
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to (==) Charge!!
    • Actions
      • Set ChargeInteger[1] = (ChargeInteger[1] + 1)
      • Set CustomValue = (CustomValue + 1)
      • Set Charger[CustomValue] = (Triggering unit)
      • Set Victim[CustomValue] = (Target unit of ability being cast)
      • Set Charge_Point_01[CustomValue] = (Position of Charger[CustomValue])
      • Set Charge_Point_02[CustomValue] = (Position of Victim[CustomValue])
      • Set Charge_Point_03[CustomValue] = (Charge_Point_01[CustomValue] offset by 50.00 towards (Angle from Charge_Point_01[CustomValue] to Charge_Point_02[CustomValue]) degrees)
      • Unit - Turn collision for Charger[CustomValue] Off
      • Unit - Hide Charger[CustomValue]
      • Unit - Move Charger[CustomValue] instantly to Charge_Point_03[CustomValue]
      • Trigger - Turn on ChargeDummy <gen>
      • Custom script: call RemoveLocation(udg_Charge_Point_01[udg_CustomValue])
      • Custom script: call RemoveLocation(udg_Charge_Point_02[udg_CustomValue])
      • Custom script: call RemoveLocation(udg_Charge_Point_03[udg_CustomValue])

Now here is the second trigger which may be the main reason why the charge malfunctions (i will tell you the problem at the end of the post).
It runs every 0.04 seconds of game-time and creates the illusion of very fast movement.
Everytime it runs, the 3 locations which can also be found in the first trigger are set again, using the position of the caster and the target, and the caster is moved to the third location again while he still is hidden as well as a dummy unit is created which has the same model as the charger and faces the position of the target. It has no movementspeed and cannot be selected as a dummy is supposed to be.
The dummy is added to a unitgroup.
Now the dummy's movement animation is played and with the fade part of the trigger, everytime the trigger runs the transperency will be increased up to a certain point (90% transperency). At this point, the dummy unit is removed from the game as well as from the unit group where we added it before.
You may already see how the spell is supposed to work. We create a dummy every second and store it in a variable with an array. Using a loop we pick every dummy which exists at the moment, fade it and when the transperency reaches 90% we remove it.
Now, this only happens when the truth check reurns false.
At the point, where the distance between the caster and the target remains only 200 units or less, it is returned true and no more dummys will be created form this point on.
We run the final ChargeTrigger. The fade process will go on until the unitgroup is empty, then the trigger will be turned off.
Here is the trigger, it is active but not from the beginning:


  • ChargeDummy
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to CustomValue, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • ControlTruth[(Integer A)] Gleich (==) False
            • 'THEN'-Actions
              • Set Charge_Point_01[(Integer A)] = (Position of Charger[(Integer A)])
              • Set Charge_Point_02[(Integer A)] = (Position of Victim[(Integer A)])
              • Set Charge_Point_03[(Integer A)] = (Charge_Point_01[(Integer A)] offset by 45.00 towards (Angle from Charge_Point_01[(Integer A)] to Charge_Point_02[(Integer A)]) degrees)
              • Unit - Create 1 TimeChargeDummy for (Owner of Charger[(Integer A)]) at Charge_Point_03[(Integer A)] facing (Angle from Charge_Point_03[(Integer A)] to Charge_Point_02[(Integer A)]) degrees
              • Unit - Turn collision for (Last created unit) Off
              • Set Dummy[Dummyinteger[(Integer A)]] = (Last created unit)
              • Animation - Play Dummy[Dummyinteger[(Integer A)]]'s walk animation
              • Set DummyGroup[(Integer A)] = (Create Unit Group)
              • Unitgroup - Add Dummy[Dummyinteger[(Integer A)]] to DummyGroup[(Integer A)]
              • Set Dummyinteger[(Integer A)] = (Dummyinteger[(Integer A)] + 1)
              • Unit - Move Charger[(Integer A)] instantly to Charge_Point_03[(Integer A)]
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • 'IF'-Conditions
                    • (Distance between Charge_Point_02[(Integer A)] and Charge_Point_03[(Integer A)]) smaller or equal to (<=) 200.00
                  • 'THEN'-Actions
                    • Set ControlTruth[(Integer A)] = True
                    • Trigger - Run ChargeFinal<gen> (checking conditions)
                  • 'ELSE'-Actions
              • Custom script: call RemoveLocation(udg_Charge_Point_01[bj_forLoopAIndex])
              • Custom script: call RemoveLocation(udg_Charge_Point_02[bj_forLoopAIndex])
              • Custom script: call RemoveLocation(udg_Charge_Point_03[bj_forLoopAIndex])
            • 'ELSE'-Actions
          • Do Multiple ActionsFor each (Integer B) from 1 to Dummyinteger[(Integer A)], do (Actions)
            • Loop - Actions
              • Set fadeinteger[(Integer B)] = (fadeinteger[(Integer B)] + 10.00)
              • Animation - Change Dummy[(Integer B)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with fadeinteger[(Integer B)]% transparency
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • 'IF'-Conditions
                    • fadeinteger[(Integer B)] Größer als (>) 90.00
                  • 'THEN'-Actions
                    • Unitgroup - Remove Dummy[(Integer B)] from DummyGroup[(Integer A)]
                    • Unit - Remove Dummy[(Integer B)] from the game
                    • Custom script: set udg_Dummy[bj_forLoopBIndex] = null
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • 'IF'-Conditions
                          • (DummyGroup[(Integer A)] is empty) equal to (==) True
                        • 'THEN'-Actions
                          • Set Dummyinteger[(Integer A)] = 1
                          • Custom script: call DestroyGroup(udg_DummyGroup[bj_forLoopAIndex])
                          • Trigger - Turn off (This trigger)
                          • Set ControlTruth[(Integer A)] = False
                          • Set ChargeInteger[1] = (ChargeInteger[1] - 1)
                            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • 'IF'-Conditions
                                • ChargeInteger[1] Gleich (==) 0
                              • 'THEN'-Actions
                                • Set CustomValue = 1
                              • 'ELSE'-Actions
                        • 'ELSE'-Actions
                  • 'ELSE'-Actions

Now, this is the final trigger. The charger is moved to point 3 a last time becomes unhidden and some special effects are attached. Damage is dealt and the KnockbackSystem from Paladon is initialized (there can be no fault, it works perfectly). It is active from the beginning but has no event.


  • ChargeFinal
    • Events
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to CustomValue, do (Actions)
        • Loop - Actions
          • Set Charge_Point_01[(Integer A)] = (Position of Charger[(Integer A)])
          • Set Charge_Point_02[(Integer A)] = (Position of Victim[(Integer A)])
          • Set Charge_Point_03[(Integer A)] = (Charge_Point_01[(Integer A)] offset by 45.00 towards (Angle from Charge_Point_01[(Integer A)] to Charge_Point_02[(Integer A)]) degrees)
          • Unit - Move Charger[(Integer A)] instantly to Charge_Point_03[(Integer A)]
          • Unit - Unhide Charger[(Integer A)]
          • Unit - Turn collision for Charger[(Integer A)] Ein
          • Specialeffect - Create a special effect attached to the weapon of Charger[(Integer A)] using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
          • Set SpecialEffect[(Integer A)] = (Last created special effect)
          • Unit - Cause Charger[(Integer A)] to damage Victim[(Integer A)], dealing 100.00 damage of attack type Spells and damage type Unknown
          • Animation - Play Charger[(Integer A)]'s attack slam animation
          • Set KBA_Caster = Charger[(Integer A)]
          • Set KBA_TargetUnit = Victim[(Integer A)]
          • Set KBA_StartingPosition = Charge_Point_03[(Integer A)]
          • Set KBA_Level = 1
          • Set KBA_Speed = 5.00
          • Set KBA_DistancePerLevel = 140.00
          • Set KBA_SpecialEffects[1] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
          • Set KBA_SpecialEffects[2] = Objects\Spawnmodels\Human\HumanBlood\HumanBloodLarge0.mdl
          • Set KBA_DestroyTrees = True
          • Trigger - Run Cast A Knockback <gen> (checking conditions)
          • Specialeffect - Destroy SpecialEffect[(Integer A)]
          • Animation - Reset Charger[(Integer A)]'s animation
          • Selection - Select Charger[(Integer A)] for (Owner of Charger[(Integer A)])
          • Unit - Order Charger[(Integer A)] to Angreifen Victim[(Integer A)]
          • Custom script: call RemoveLocation(udg_Charge_Point_01[bj_forLoopAIndex])
          • Custom script: call RemoveLocation(udg_Charge_Point_02[bj_forLoopAIndex])
          • Custom script: call RemoveLocation(udg_Charge_Point_03[bj_forLoopAIndex])
          • Custom script: set udg_Charger[bj_forLoopAIndex] = null
          • Custom script: set udg_Victim[bj_forLoopAIndex] = null

Now, to give the final information, the problem is.

It works completely fine when i use it the firsttime. The second time, no dummies are created, the hcrager is only moved once and then the final trigger fires off. (It looks like a ranged attack without missile)

Where the hag is that bug, eh?

Here is the map, plz help me, I am near insanity.
 
Last edited:
Level 13
Joined
Mar 16, 2008
Messages
941
Could the problem be in this lines?
  • 'IF'-Conditions
    • (DummyGroup[(Integer A)] is empty) equal to (==) True
    • 'THEN'-Actions
      • Set Dummyinteger[(Integer A)] = 1
      • Custom script: call DestroyGroup(udg_DummyGroup[bj_forLoopAIndex])
      • Trigger - Turn off (This trigger)
      • Set ControlTruth[(Integer A)] = False
      • Set ChargeInteger[1] = (ChargeInteger[1] - 1)
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • ChargeInteger[1] Gleich (==) 0
          • 'THEN'-Actions
            • Set CustomValue = 1
          • 'ELSE'-Actions
        • 'ELSE'-Actions
I mean this
  • Set CustomValue = 1
If you cast it a second time, CustomValue will be set to 2, while the loop starts running from 1 and may bug because there are no values given in the arrays. Didn't checked the entire code since GUI causes a headache to me, although I have to say that this is scripted pretty good :)
 
Last edited:
Level 24
Joined
Jun 16, 2008
Messages
1,939
now, i fixed two issues and it works better but still malfunctions...

here is the actual second trigger and the new version of the map:



  • ChargeDummy
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to CustomValue, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • ControlTruth[(Integer A)] Gleich (==) False
            • 'THEN'-Actions
              • Set Charge_Point_01[(Integer A)] = (Position of Charger[(Integer A)])
              • Set Charge_Point_02[(Integer A)] = (Position of Victim[(Integer A)])
              • Set Charge_Point_03[(Integer A)] = (Charge_Point_01[(Integer A)] offset by 45.00 towards (Angle from Charge_Point_01[(Integer A)] to Charge_Point_02[(Integer A)]) degrees)
              • Unit - Create 1 TimeChargeDummy for (Owner of Charger[(Integer A)]) at Charge_Point_03[(Integer A)] facing (Angle from Charge_Point_03[(Integer A)] to Charge_Point_02[(Integer A)]) degrees
              • Unit - Turn collision for (Last created unit) Off
              • Set Dummy[Dummyinteger[(Integer A)]] = (Last created unit)
              • Animation - Play Dummy[Dummyinteger[(Integer A)]]'s walk animation
              • Set DummyGroup[(Integer A)] = (Create Unit Group)
              • Unitgroup - Add Dummy[Dummyinteger[(Integer A)]] to DummyGroup[(Integer A)]
              • Set Dummyinteger[(Integer A)] = (Dummyinteger[(Integer A)] + 1)
              • Unit - Move Charger[(Integer A)] instantly to Charge_Point_03[(Integer A)]
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • 'IF'-Conditions
                    • (Distance between Charge_Point_02[(Integer A)] and Charge_Point_03[(Integer A)]) smaller or equal to (<=) 200.00
                  • 'THEN'-Actions
                    • Set ControlTruth[(Integer A)] = True
                    • Trigger - Run ChargeFinal<gen> (checking conditions)
                  • 'ELSE'-Actions
              • Custom script: call RemoveLocation(udg_Charge_Point_01[bj_forLoopAIndex])
              • Custom script: call RemoveLocation(udg_Charge_Point_02[bj_forLoopAIndex])
              • Custom script: call RemoveLocation(udg_Charge_Point_03[bj_forLoopAIndex])
            • 'ELSE'-Actions
          • Do Multiple ActionsFor each (Integer B) from 1 to Dummyinteger[(Integer A)], do (Actions)
            • Loop - Actions
              • Set fadeinteger[(Integer B)] = (fadeinteger[(Integer B)] + 10.00)
              • Animation - Change Dummy[(Integer B)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with fadeinteger[(Integer B)]% transparency
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • 'IF'-Conditions
                    • fadeinteger[(Integer B)] greater than (>) 90.00
                  • 'THEN'-Actions
                    • Unitgroup - Remove Dummy[(Integer B)] from DummyGroup[(Integer A)]
                    • Unit - Remove Dummy[(Integer B)] from the game
                    • Custom script: set udg_Dummy[bj_forLoopBIndex] = null
                      • Set fadeinteger[IntegerB] = 0
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • 'IF'-Conditions
                          • (DummyGroup[(Integer A)] is empty) equal to (==) True
                        • 'THEN'-Actions
                          • Set Dummyinteger[(Integer A)] = 1
                          • Custom script: call DestroyGroup(udg_DummyGroup[bj_forLoopAIndex])
                          • Trigger - Turn off (This trigger)
                          • Set ControlTruth[(Integer A)] = False
                          • Set ChargeInteger[1] = (ChargeInteger[1] - 1)
                            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • 'IF'-Conditions
                                • ChargeInteger[1] Gleich (==) 0
                              • 'THEN'-Actions
                                • Set CustomValue = 0
                              • 'ELSE'-Actions
                        • 'ELSE'-Actions
                  • 'ELSE'-Actions

i fixed an issue with the fadeinteger as well and i clear it now.
 
Last edited:
MjSonn.exe to the rescue!

Dude, this is certainly a weird bug. I noticed (and maybe someone else too) that, when Charge is cast by the Blademaster first, seems to work well on the first two casts, but the caster disappears after the third attempt, leaving two dummies where it was. And when the Paladin casts it after the Blademaster, he disappears too.
But when the Paladin casts Charge first, it has the same behavior as in the original Charge (the first one you posted): the "no missile ranged attack" thingy.
Note that the bug with hiding the hero only happens when the Blade casts it first, and not when the Paladin does.
Since I can't check the map right now (the WC3 in the internet cafe I am right now is a cracked one :S), I'll do it once I'm in my own PC (with an original WC3). If I get success resolving this bugs, I'll let you know as soon as possible (I hope I'm able to do it).
 
Status
Not open for further replies.
Top