Shooting system

Question

New Member
Reaction score
0
how can i make a shooting system like potm's arrow except you shoot bullets.
eg.i wanna make a gun with 7 bullets in magazine and unlimited ammo.
so when i shoot 7 times i have to reload with a cooldown and it goes back to 7.
and when i click a gun in my inventory i will use that gun .
how do i do these?
 

Psiblade94122

In need of sleep
Reaction score
138
shooting usually requires knolage of slide systems (move unit instantly, set unit X/Y rapidly overtime) and the actual bullet is actually a sliding dummy unit

Bullet detection can be a bit tricky, you can use vaious methods from picking the units around the bullet itself <may cause mass lagg> to using spells such as pheonixe fire to detect it (pheonixe fire has to be able to target the bullet, meaning no locoust, no invune) <note immolation will be too slow for this since it burns once every second so it is inacurrate>

Using the pick unit method, if it picks a unit do whatever you want to the unit and whatever you want with the bullet

Using the pheonixe fire detection might be a bit tricky, you are going to need a damage detection system for this and will need to know if pheonixe fire itself was the source of the damage (i use 0 damage pheonixe fire with .01 duration to detect this)

You can detect item use from either "a unit uses an item" or "a unit casts a spell" as when you use an item you are casting that item's spell.

Its hard to explain the concept in whole, but ill post a diagram to help you out...

Item/ability use detected -> Bullet Spawn Triggers
Slide System will move the spawned bullets forward at whatever speed you want (i prefer sliding them every .04 seconds, so to convert wc3 units into slide units you just divide wc3 units by 25 (since this shoots 25 times a second))

Then you would want
Detection (detection will take care of whatever happens to the bullet and whatever it hit)

... not much of a diagram... is it?
 

Lord Regno

Active Member
Reaction score
19
It's exist two way to do a ammo system:

1. The ammo trigger, this has a floating text in it:

Forgot temp player is a player variable as same as ammo but it's a array integer.
In Trigger editor window click on ctrl + b then click on +X , give the variable a name and then pick player in variable type for temp_player and pick integer for ammo and don't forget to tick on array mode for ammo.

Trigger:
  • Ammo
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set temp_player = (Owner of (Attacking unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ammo[(Player number of temp_player)] Greater than or equal to 1
          • ammo[(Player number of temp_player)] Less than or equal to 7
        • Then - Actions
          • Set ammo[(Player number of temp_player)] = (ammo[(Player number of temp_player)] - 1)
          • Floating Text - Create floating text that reads (String(ammo[(Player number of temp_player)])) above (Attacking unit) with Z offset 10.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set floating_text_ammo[(Player number of temp_player)] = (Last created floating text)
          • Floating Text - Set the velocity of (Last created floating text) to 10.00 towards 50.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
          • Wait 1.50 seconds
          • Floating Text - Destroy floating_text_ammo[(Player number of temp_player)]
        • Else - Actions
          • Unit - Order (Attacking unit) to Stop


Trigger:
  • Relode
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Ammo
    • Actions
      • Set temp_player = (Owner of (Casting unit))
      • Set ammo[(Player number of temp_player)] = (ammo[(Player number of temp_player)] + 7)


2: You can use lumber or gold system to have ammo on.

Trigger:
  • Ammo
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set temp_player = (Owner of (Attacking unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (temp_player Current gold) Greater than or equal to 1
          • (temp_player Current gold) Less than or equal to 7
        • Then - Actions
          • Player - Add -1 to temp_player Current gold
        • Else - Actions
          • Unit - Order (Attacking unit) to Stop


Trigger:
  • 2. Relode
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Player - Add 7 to temp_player Current gold


How can i make a shooting system like potm's arrow except you shoot bullets and when I click a gun in my inventory I will use that gun.
<- That someone ells can help you with.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top