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

fire and reload triggers

Status
Not open for further replies.
Level 9
Joined
Apr 7, 2010
Messages
480
i was wondering almost all the advanced shooting/survival/zombie maps in the hive has a fire and reload triggers. i searched the spells in the hive but ended up with different kind of spells, so i tried to download some map and try to understand how people do it, well. i am only a beginner in WE so i got confused

so can someone show me how?

-most of those system depends on gold as its bullets, how do i change it to something else that people doesn't have a hard time looking for it, something unique actually. (because i already have something to use for the gold, so i can't use it for bullets)

-i don't use jass because my WE doesn't work on newgen, i guess its because of the version.

-doesn't run out of ammo but still needs to reload after some shots.
 
Level 12
Joined
Oct 10, 2009
Messages
438
i was wondering almost all the advanced shooting/survival/zombie maps in the hive has a fire and reload triggers. i searched the spells in the hive but ended up with different kind of spells, so i tried to download some map and try to understand how people do it, well. i am only a beginner in WE so i got confused

so can someone show me how?

-most of those system depends on gold as its bullets, how do i change it to something else that people doesn't have a hard time looking for it, something unique actually. (because i already have something to use for the gold, so i can't use it for bullets)

-i don't use jass because my WE doesn't work on newgen, i guess its because of the version.

-doesn't run out of ammo but still needs to reload after some shots.


Trigger it.

Use triggers like "Unit is attacked" Then decrease a variable for attacking unit, and if this variable is zero, order the unit to stop.
 
Level 9
Joined
Apr 7, 2010
Messages
480
i'm not good at triggers but i think i should use ability instead of Unit is attacked?

i really don't know. hahaha. maybe a test map?
 
Level 7
Joined
May 13, 2011
Messages
310
I think what slash is trying to say is that you should just use an integer variable for your ammo, and decrease the value by one every time your unit attacks. Here's an example of how it would work.

At map initialization:

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ammo1 = 20
      • Set reloading = False
      • -------- "reloading" is required so that we don't reload more than once at a time --------
And then in another trigger:

  • Attacking
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to Rifleman 0017 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ammo1 Equal to 0
        • Then - Actions
          • Unit - Order Rifleman 0017 <gen> to Stop
          • Trigger - Run Reload <gen> (checking conditions)
        • Else - Actions
          • Set ammo1 = (ammo1 - 1)
And then we have a trigger named Reload that does this:

  • Reload
    • Events
    • Conditions
      • reloading Equal to False
    • Actions
      • Set reloading = True
      • Wait 5.00 seconds
      • Set ammo1 = 5
      • Set reloading = False
As you can see my example is extremely simple since it only focuses on one unit (Rifleman 0017 <gen>) but it's just so that you get the idea. If you implement it cleverly you can make it work for multiple units, without having to make triggers for each one.

By the way, if you need help understanding any of this or you're curious on what something does just ask.
 
Level 12
Joined
Oct 10, 2009
Messages
438

Aye that is what I meant, But mind if I edit your triggers so that they effect multiple units?

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For integer A between 1 and 12
        • Set Ammo[For loop integer A] = 20
And then, this is to detect if the unit still has Ammo, if so. Lets them attack. If not, it orders them to stop and interrupts the attack order.

  • Initialization
    • Events
      • Unit is attacked
    • Conditions
    • Actions
      • If - Conditions
        • ammo1 Equal to or less than 0
      • Then - Actions
        • Unit - Order (Attacking unit) to Stop
      • Else - Actions
        • Set TempInteger = Player number (Owner of (Attacking unit))
        • Set Ammo[TempInteger]= (Ammo[TempInteger] - 1)

Then, make a "Reload" abillity, based of either Beserk or Channel. (Can use thunderclap and warstomp, but these interrupt orders)

  • Reload
    • Events
      • Unit starts casting an abillity
    • Conditions
      • Abillity being cast == Reload
    • Actions
      • Set TempInteger = Player number (Owner of (Triggering Unit))
      • Set Ammo[TempIntegert] = 20

All of this is assuming you want the ammo for only 12 heroes/units, one for each player.

However, to make this MUI. Simply replace the "Ammo" variable with mana of the attacking unit.
 
Level 9
Joined
Apr 7, 2010
Messages
480
correct me if i am wrong, puggsoy's reload triggers - "when unit has run out of ammo, it automatically reloads"

but this only works for a single unit, right?

then

slash's reload trigger - "still needs to active an ability to reload the ammo"

but works on multiple unit.

i am too afraid to add my own triggers that can destroy the whole system.
can you guys add this details one last time?

-making the reload automatic, no skills.
-doesn't interrupt any orders, making the unit able to reload while moving.
-triggers effect multiple units.

(sorry about the bad english, as pugssoy said ->
Your wording was a bit strange.
but i'm totally aware of it.)
 
Level 7
Joined
May 13, 2011
Messages
310
Well, reloading automatically using slash's triggers isn't really that hard. All you need to do is merge his multiple unit technique with my reloading technique. I'll just modify his triggers now:

Make your initialization like this:

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For integer A between 1 and 12
        • Set Ammo[For loop integer A] = 20
        • Set Reloading[For loop integer A] = false
And then we have our ammo handling trigger:

  • Attacking
    • Events
      • Unit is attacked
    • Conditions
    • Actions
      • If - Conditions
        • ammo1 Equal to or less than 0
      • Then - Actions
        • Unit - Order (Attacking unit) to Stop
        • Set TempInteger = Player number (Owner of (Attacking unit))
        • Trigger - Run Reload <gen> (checking conditions)
      • Else - Actions
        • Set TempInteger = Player number (Owner of (Attacking unit))
        • Set Ammo[TempInteger]= (Ammo[TempInteger] - 1)
And finally our Reload trigger:

  • Reload
    • Events
    • Conditions
      • Reloading[TempInteger] Equal to False
    • Actions
      • Set Reloading[TempInteger] = True
      • Wait 5.00 seconds
      • Set Ammo[TempInteger] = 20
      • Set Reloading[TempInteger] = False
I had a wee bit of trouble with the Reloading array as I didn't know how to get a dynamic number for a condition, but then I figured to set TempInteger before running the Reload trigger :grin:

I'm pretty sure that should work how you want it to. Still, remember what slash said about this being for a system of one hero/unit per player.
 
Level 9
Joined
Apr 7, 2010
Messages
480
thanks, that is a great idea, having both automatic and manual reloads.

puggsoy, i'll now try adding that trigger on my map. thanks.

{edit}

oh lol, i mislead you guys to focus on the reload system, by giving all the details on reload and didn't give any in shooting. from the look of the triggers, this system only allows a unit to normal attack if there is ammo. the unit should cast an ability that lets it fire, no target required, and fires at facing angle and moves all the way in a straight line for a maximum range.

well, too much request i believe, so if you guys will still help me in this system or not, its your choice, but i will thank you for all the things you've done so far ^^
 
Last edited:
Level 12
Joined
Oct 10, 2009
Messages
438
thanks, that is a great idea, having both automatic and manual reloads.

puggsoy, i'll now try adding that trigger on my map. thanks.

{edit}

oh lol, i mislead you guys to focus on the reload system, by giving all the details on reload and didn't give any in shooting. from the look of the triggers, this system only allows a unit to normal attack if there is ammo. the unit should cast an ability that lets it fire, no target required, and fires at facing angle and moves all the way in a straight line for a maximum range.

well, too much request i believe, so if you guys will still help me in this system or not, its your choice, but i will thank you for all the things you've done so far ^^

Ahh, Klan my friend. I do have a readily available "Bullet system" sitting at home, I would gladly give it to you.

Just give me 3 hours, remind me. And I will upload it (Dont have access to it atm)


Tl;DR

System moves the bullet dummy forwards, checking if there is a unit in a radius, damages said unit and then the dummy is destroyed. Deals damage == units custom value.
 
Level 7
Joined
May 13, 2011
Messages
310
Well, looks like slash has got this bit sussed. Glad I could help with the reloading though, it's been educational :ogre_haosis:
 
Level 12
Joined
Oct 10, 2009
Messages
438
See attached, Linked the trigger you will be needing for added useability.

Folder: Tempo (Bleugh, should've changed this.)


  • Attacks move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set AttacksOn = False
      • Unit Group - Pick every unit in AttackGroup and do (Actions)
        • Loop - Actions
          • Set AttacksOn = True
          • Set Point[0] = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Bullet (Sniper)
            • Then - Actions
              • Set Point[1] = (Point[0] offset by 40.00 towards (Facing of (Picked unit)) degrees)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to Bullet (Lightning)
                • Then - Actions
                  • Set Point[1] = (Point[0] offset by 10.00 towards (Facing of (Picked unit)) degrees)
                • Else - Actions
                  • Set Point[1] = (Point[0] offset by 33.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Move (Picked unit) instantly to Point[1]
          • Set Unit = (Picked unit)
          • Set TempInteger = ((Terrain cliff level at Point[1]) - (Terrain cliff level at Point[0]))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain cliff level at Point[0]) Less than ((Terrain cliff level at Point[1]) + 0)
            • Then - Actions
              • Unit - Set the custom value of Unit to ((Custom value of Unit) - (50 x TempInteger))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Custom value of Unit) Less than or equal to 0
                • Then - Actions
                  • Unit Group - Remove Unit from AttackGroup
                  • Unit - Kill Unit
                • Else - Actions
            • Else - Actions
              • Unit - Set the custom value of Unit to ((Custom value of Unit) - (30 x TempInteger))
          • Set Group = (Units within (80.00 + (25.00 x (Real((Current research level of AOE Increase for (Owner of (Picked unit))))))) of Point[1] matching ((((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True) and ((((Matching unit) is dead) Equal to F
          • Destructible - Pick every destructible within 70.00 of Point[1] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of Unit) Not equal to Bullet (Shotgun)
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked destructible) is alive) Equal to True
                      • (Destructible-type of (Picked destructible)) Not equal to Long Natural Bridge (Diagonal 2)
                      • (Destructible-type of (Picked destructible)) Not equal to Pathing Blocker (Both)
                      • (Destructible-type of (Picked destructible)) Not equal to Long Natural Bridge (Diagonal 2)
                      • (Destructible-type of (Picked destructible)) Not equal to Volcano
                    • Then - Actions
                      • Unit Group - Remove Unit from AttackGroup
                      • Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - (Real((Custom value of Unit))))
                      • Unit - Kill Unit
                    • Else - Actions
                • Else - Actions
          • Unit Group - Pick every unit in Group and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit is dead) Equal to False
                • Then - Actions
                  • Set Point[3] = (Position of (Picked unit))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Unit) Not equal to Bullet (Shotgun)
                      • (Unit-type of Unit) Not equal to Bullet (MachineGun)
                    • Then - Actions
                      • Set Point[4] = (Point[3] offset by 5.00 towards (Facing of Unit) degrees)
                      • Special Effect - Create a special effect at Point[4] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Set KB_UnitAdd = (Units within 10.00 of Point[3])
                      • Unit Group - Pick every unit in KB_UnitAdd and do (Actions)
                        • Loop - Actions
                          • Trigger - Turn on Loop <gen>
                          • Set Point[5] = (Position of (Picked unit))
                          • Set KB_Distance = ((Custom value of Unit) / 2)
                          • Unit Group - Add (Picked unit) to KB_Move
                          • Hashtable - Save (Angle from Point[0] to Point[5]) as (Key Angle) of (Key (Picked unit)) in Hastable
                          • Hashtable - Save (Real(KB_Distance)) as (Key Distance) of (Key (Picked unit)) in Hastable
                          • Hashtable - Save 2.00 as (Key Duration) of (Key (Picked unit)) in Hastable
                          • Custom script: call RemoveLocation(udg_Point[5])
                      • Special Effect - Create a special effect at Point[4] using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                      • Custom script: call DestroyGroup(udg_KB_UnitAdd)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of Unit) Not equal to Bullet (Shotgun)
                        • Then - Actions
                          • Set Point[4] = (Point[3] offset by 0.00 towards (Facing of Unit) degrees)
                          • Special Effect - Create a special effect at Point[4] using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                        • Else - Actions
                          • Set Point[4] = (Point[3] offset by 20.00 towards (Facing of Unit) degrees)
                          • Unit - Move (Picked unit) instantly to Point[4]
                          • Special Effect - Create a special effect at Point[4] using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Unit) Not equal to Bullet (Sniper Rocket Rounds)
                    • Then - Actions
                      • Unit - Cause Unit to damage (Picked unit), dealing (Real((Custom value of Unit))) damage of attack type Pierce and damage type Normal
                    • Else - Actions
                      • Unit - Cause Unit to damage circular area after 0.00 seconds of radius 200.00 at Point[3], dealing (Real((Custom value of Unit))) damage of attack type Siege and damage type Normal
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of Unit) Not equal to Bullet (Shotgun)
                    • Then - Actions
                      • Unit Group - Remove Unit from AttackGroup
                      • Unit - Kill Unit
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_Point[3])
                  • Custom script: call RemoveLocation(udg_Point[4])
                • Else - Actions
                  • Unit Group - Remove Unit from AttackGroup
          • Custom script: call RemoveLocation(udg_Point[0])
          • Custom script: call RemoveLocation(udg_Point[1])
          • Custom script: call DestroyGroup(udg_Group)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AttacksOn Not equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Okay, this trigger might need some changes, remove the if then else functions for the "Unit type of triggering unit is XX" But continue with the needed actions. Or, keep them and replace them so that you can change bullet speed of other bullets.

The bullets become weaker when travelling uphill, whereas they become stronger while travelling downhill

This is an example of how the attacking works:

  • Attack Sniper
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack (Sniper)
    • Actions
      • Trigger - Turn on Attacks move <gen>
      • Animation - Play (Triggering unit)'s attack animation
      • Special Effect - Create a special effect attached to the weapon of (Triggering unit) using war3mapImported\Konstrukt_SniperEffectAttachment.MDX
      • Special Effect - Destroy (Last created special effect)
      • Set Point[0] = (Position of (Triggering unit))
      • Set Point[1] = (Target point of ability being cast)
      • Set TempReal2 = (30.00 - (10.00 x (Real((Level of SteadyAimDummeh for (Triggering unit))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) has buff Rocket Rounds ) Not equal to True
        • Then - Actions
          • Unit - Create 1 Bullet (Sniper) for (Owner of (Triggering unit)) at Point[0] facing ((Angle from Point[0] to Point[1]) + (Random real number between (TempReal2 x -1.00) and TempReal2)) degrees
          • Unit - Add a 2.90 second Generic expiration timer to (Last created unit)
          • Unit Group - Add (Last created unit) to AttackGroup
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Instagib Equal to True
            • Then - Actions
              • Unit - Set the custom value of (Last created unit) to 999999
            • Else - Actions
              • Unit - Set the custom value of (Last created unit) to (90 + (Integer(((Real((Agility of (Triggering unit) (Include bonuses)))) x (5.00 x (Real((Level of SteadyAimDummeh for (Triggering unit)))))))))
        • Else - Actions
          • Unit - Remove Rocket Rounds buff from (Triggering unit)
          • Unit - Create 1 Bullet (Sniper Rocket Rounds) for (Owner of (Triggering unit)) at Point[0] facing ((Angle from Point[0] to Point[1]) + (Random real number between (TempReal2 x -1.00) and TempReal2)) degrees
          • Unit - Set level of Kaboom! for (Last created unit) to (Level of Rocket Rounds for (Triggering unit))
          • Unit - Add a 2.90 second Generic expiration timer to (Last created unit)
          • Unit Group - Add (Last created unit) to AttackGroup
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Instagib Equal to True
            • Then - Actions
              • Unit - Set the custom value of (Last created unit) to 999999
            • Else - Actions
              • Unit - Set the custom value of (Last created unit) to ((90 + (30 x (Level of Rocket Rounds for (Triggering unit)))) + (Integer(((Real((Agility of (Triggering unit) (Include bonuses)))) x (1.00 + (4.00 + (Real((Level of SteadyAimDummeh for (Triggering unit))))))))))
      • Custom script: call RemoveLocation(udg_Point[0])
      • Custom script: call RemoveLocation(udg_Point[1])

The various special effects are not needed; Feel free to remove them.
Creates a unit, adds it to the movement group. Sets the custom value as a variable of damage, changes the distance the bullet travels as the "Expiration Timer".
Also, as is demonstrated you can use a buff check to make a unit fire different attacks; All of these functions require "Dummy" units.

If you need some more help, just say so. Need demonstrations on how it works? Test the map. Note: If you get an error while using it; Just delete the grenade function inside this map.
 

Attachments

  • Fraggedv1.w3x
    2.5 MB · Views: 82
Last edited:
Status
Not open for further replies.
Top