[Help]² Decreasing Charges

eclypt

New Member
Reaction score
4
Hello there again, now, i got a mini-problem, that occours when i manage to attack any unit.

i started a trigger that will decrease the remainning charges of the current weapon, so when i attack a unit and then instantly moves arround to cancel the attack order, the current charges goes down like i've attacked and doens't canceled...

is any thing that prevent it to keep happening?
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
Well on attack events are before the unit takes damage you will need a damage detection system like GDD
 

denmax

You can change this now in User CP.
Reaction score
155
Trigger:
  • DDT
    • Events
      • Map initialization
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BooleanVar[1] Equal to False
        • Then - Actions
          • Set BooleanVar[1] = True
          • Set UnitGroupVar = (Units in (Playable map area))
          • Unit Group - Pick every unit in UnitGroupVar and do (Actions)
            • Loop - Actions
              • Trigger - Add to ItemChargers <gen> the event (Unit - (Picked unit) Takes damage)
          • Custom script: call DestroyGroup(udg_UnitGroupVar)
        • Else - Actions
          • Trigger - Add to ItemCharges <gen> the event (Unit - (Triggering unit) Takes damage)



Trigger:
  • ItemCharges
    • Events
    • Conditions
      • (Damage taken) Greater than 0.00
    • Actions
      • If (All conditions) are true then do (Actions) else do (Actions)
        • If - Conditions
          • (Damage source) has <item>
        • Then - Actions
          • <actions pertaining removing charges>


PS:
Attacking unit = Damage source
Attacked unit = Triggering unit

The bad thing about this is that it also works on spells. :<
 

Bogrim

y hello thar
Reaction score
154
Please Denmax, never recommend using the GUI damage taken event, instead recommend using Weep's GDD snippet.

I think your problem lies in using orders to prevent an attack. Instead, add the Cargo (Hold) ability to the unit when the unit has no "attack" items with charges left, and remove it when it acquires new.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top