• 🏆 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] Charge System pushing units away in a wierd way

Status
Not open for further replies.
Level 11
Joined
Oct 9, 2015
Messages
721
Hi everyone, so I have made a push system that pushes units away from a horse if it's moving, however units are only pushed onward and backwards from it's current location, this creates a wierd effect, I want to make them spread as the horse passes trought them, how can I achieve that ?


  • pushing
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within 50.00 of (Position of UnitHorse[(Integer A)])) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Owner of (Picked unit)) is an ally of (Owner of UnitHorse[(Integer A)])) Equal to False
                  • Mounted[(Integer A)] Equal to True
                  • IsRunning[(Integer A)] Equal to True
                • Then - Actions
                  • Set PushUnit = (Picked unit)
                  • Set Loc1 = (Position of PushUnit)
                  • Set Loc2 = (Loc1 offset by -5.00 towards (Facing of PushUnit) degrees)
                  • Unit - Move PushUnit instantly to Loc2, facing (Facing of PushUnit) degrees
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Facing of UnitHorse[(Integer A)]) + 120.00) Greater than or equal to (Facing of PushUnit)
                      • ((Facing of UnitHorse[(Integer A)]) - 120.00) Less than or equal to (Facing of PushUnit)
                    • Then - Actions
                      • Set Loc2 = (Loc1 offset by 5.00 towards (Facing of PushUnit) degrees)
                      • Unit - Move PushUnit instantly to Loc2, facing (Facing of PushUnit) degrees
                    • Else - Actions
                  • Set PushUnit = No unit
                • Else - Actions
                  • Custom script: call RemoveLocation(udg_Loc1)
                  • Custom script: call RemoveLocation(udg_Loc2)
PS: I don't know if this thread fits here or in the world editor help zone.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Try pushing them back by the angle between picked units and player horses, something like this:

  • Set TempPoint2 = (TempPoint offset by 5.00 towards (Angle from (Position of ( UnitHorse[(Integer A))) to (Position of (Picked unit))) degrees)
Im not sure atm if this pushes them forward or backward, if it does push them on to the horse then just include "+180 degrees" in the equation.

Also, what is this 120 degree interrogation good for? Do u want to check, if a unit is somehow in a range of 120 degrees left and right in front of the horse?

By the way u have to set the two custom scripts into the THEN section behing the PushUnit = NoUnit action, which in turn could be placed behind the loop once.
 
Level 11
Joined
Oct 9, 2015
Messages
721
Thanks man, it worked just fine! However some units aren't moved and I realized it was because of their collision size, I reduced their collision size in object editor then they moved, what causes this? bigger collision sizes can't be affected?

Ah it's probaly for the good, otherwise the horse would rush endless trought the enemies troops and would never stop, not would be unrealistic... what are your toughts?

Thanks a lot for helping me out it's much appreciated!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Thanks man, it worked just fine! However some units aren't moved and I realized it was because of their collision size, I reduced their collision size in object editor then they moved, what causes this? bigger collision sizes can't be affected?
The "Units within X of Y" function ignores collision size and purely goes by unit origin. As such if the horse collision added to unit collision is larger than 50 then the two units will never be pushed since the in-built movement system will never let them within 50 units of each other. There is no easy work around.

You are leaking at least 600 groups and 600 locations per second. You might want to fix that if you value your map being playable.
 
Level 11
Joined
Oct 9, 2015
Messages
721
Thanks a lot for the advice, I have fixed 90+ leaks in my map with the hive leak tool. May I ask what kind of leaks are those and how can they be fixed?

Type: group
Trig_bots_Actions [war3map.j:6113]
GetLastCreatedGroup [war3map.j:6081]
CreateGroup [Blizzard.j:3081]

Type: triggeraction
Trig_Dialogo1_Actions [war3map.j:4542]
TransmissionFromUnitWithNameBJ [war3map.j:4513]
TryInitCinematicBehaviorBJ [Blizzard.j:6410]
TriggerAddAction [Blizzard.j:6330]
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
A leak is basically data that you will never use any more but still have stored. (Potentially having no reference to it any more.)

So when you create a group, create a location, create a unit, create some data and dont remove it any more after you are done using it, then you leak that data.
Most units are (almost) cleaned when they die (after decay time or something like that).
But dummy units which are often used for spells have to be manually (trigger-wise) removed.

Another way that something can leak is that it wont be properly removed if there is still a reference to that agent (type of data).
Especially when using local variables or hashtables or arrays, this may be the case for many leaks. However, you wont be making many of these when you are using GUI.

CreateGroup() creates a group which is probably not cleared.
GetLastCreatedGroup() is something I am not sure of how that leaks.
I suppose that you create a group in your trigger somewhere where you use "GetLastCreatedGroup()" in GUI possibly (last created unit group).

The second one may be that you add an action to a trigger via triggers, which also piles up infinitely.
It may be only a singular leak so wont be very dangerous but the problem may also be in the cinematic stuff (I never used those enough to say).

It is quite hard to tell how to fix leaks if we dont know how they are created, so it would be very helpful if you could find the places where these leaks are created and upload those triggers.
 
Level 11
Joined
Oct 9, 2015
Messages
721
Thanks a lot for the advices, here are the triggers:

1ist:
  • bots
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set Loc1 = (Center of entrada time 1 <gen>)
      • Set Loc2 = (Center of entrada time 2 <gen>)
      • Unit - Create 5 Footman for Player 2 (Blue) at Loc1 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc2
      • Unit - Create 2 Knight for Player 2 (Blue) at Loc1 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc2
      • Unit - Create 2 Archer for Player 2 (Blue) at Loc1 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc2
      • Unit - Create 1 Rifleman for Player 2 (Blue) at Loc1 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc2
      • Unit - Create 5 Footman for Player 3 (Teal) at Loc2 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc1
      • Unit - Create 2 Knight for Player 3 (Teal) at Loc2 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc1
      • Unit - Create 2 Archer for Player 3 (Teal) at Loc2 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc1
      • Unit - Create 1 Rifleman for Player 3 (Teal) at Loc2 facing Default building facing degrees
      • Custom script: set bj_wantDestroyGroup = true
      • Set UnitGroup = (Last created unit group)
      • Unit Group - Order UnitGroup to Patrol To Loc1
      • Custom script: call RemoveLocation(udg_Loc1)
      • Custom script: call RemoveLocation(udg_Loc2)
2nd:
  • Dialogo1
    • Events
      • Dialog - A dialog button is clicked for DialogInstrutordeCombatepg2
    • Conditions
    • Actions
      • -------- Switch to page 2 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButtonsInstrutor[6]
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup=true
          • Set PlayerGroup = (Player group((Triggering player)))
          • Cinematic - Turn cinematic mode On for PlayerGroup
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display O arco e flecha é .... Modify duration: Add 7.00 seconds and Wait
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display Com um arco e flech.... Modify duration: Add 10.00 seconds and Wait
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display Carregue uma flecha.... Modify duration: Add 8.00 seconds and Wait
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display Quando estiver disp.... Modify duration: Add 10.00 seconds and Wait
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display Quando estiver se m.... Modify duration: Add 15.00 seconds and Wait
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display Porque não pega um.... Modify duration: Add 7.00 seconds and Wait
          • Cinematic - Turn cinematic mode Off for PlayerGroup
          • Custom script: call DestroyForce(udg_PlayerGroup)
          • Dialog - Show DialogInstrutordeCombatepg2 for (Triggering player)
          • Skip remaining actions
        • Else - Actions
      • -------- Switch to page 1 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButtonsInstrutor[7]
        • Then - Actions
          • Custom script: set bj_wantDestroyGroup=true
          • Set PlayerGroup = (Player group((Triggering player)))
          • Cinematic - Turn cinematic mode On for PlayerGroup
          • Cinematic - Send transmission to PlayerGroup from InstrTiro[(Player number of (Triggering player))] named Instrutor de Tiro: Play No sound and display Mantenha-se sempre .... Modify duration: Add 7.00 seconds and Wait
          • Cinematic - Turn cinematic mode Off for PlayerGroup
          • Custom script: call DestroyForce(udg_PlayerGroup)
          • Dialog - Show DialogInstrutordeCombatepg2 for (Triggering player)
          • Skip remaining actions
        • Else - Actions
      • -------- SAIR --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButtonsInstrutor[8]
        • Then - Actions
          • Dialog - Hide DialogInstrutordeCombatepg2 for (Triggering player)
        • Else - Actions
 
Status
Not open for further replies.
Top