Converting Real to Integer

LordSaddler1

New Member
Reaction score
4
I have two questions. First one is, if you have the event, "A unit is attacked", do events involving damage trigger? Or is there another way to bring damage done into a trigger?

Second question is, when for an arithmetic thing for damage, how do you make it so you can put an integer variable in, rather than a real?
 

xmkiller

New Member
Reaction score
6
If your first question was about how to detect damage, its a lot more complicated then that.
 

saw792

Is known to say things. That is all.
Reaction score
280
Here are the separate events:

Unit - A unit is attacked
Unit - Unit takes damage

As you can see, there is no generic unit event for unit takes damage. You need to use a specific unit. Search for damage detection in the search pages and you will see how it works, basically.
 

Cold

New Member
Reaction score
4
I don't believe unit is attacked + damage amount/source will work together.
 

saw792

Is known to say things. That is all.
Reaction score
280
Of course not. That is what I just said.

The 'unit is attacked' event occurs when the attack order is given, before any damage is given or taken or the attack animation is even played.
 

LordSaddler1

New Member
Reaction score
4
Here are the separate events:

Unit - A unit is attacked
Unit - Unit takes damage

As you can see, there is no generic unit event for unit takes damage. You need to use a specific unit. Search for damage detection in the search pages and you will see how it works, basically.

so, to do this I have to have another trigger that would add the event into this trigger?
 

Jagan

New Member
Reaction score
30
Yes. If you're still unsure, search the forums for a damage detection system.
 

saw792

Is known to say things. That is all.
Reaction score
280
Exactly right, for the basic damage detection system.

A good, more advanced system can be found here:
http://www.wc3campaigns.net/showthread.php?t=102079

Otherwise you could just use this:
Code:
Untitled Trigger 001
    Events
        Map initialization
    Conditions
    Actions
        Set TempGroup = (Units in (Playable map area))
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                Trigger - Add to YourTrigger <gen> the event (Unit - (Picked unit) Takes damage)
        Custom script:   call DestroyGroup(udg_TempGroup)
Code:
Untitled Trigger 002
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        Trigger - Add to YourTrigger <gen> the event (Unit - (Entering unit) Takes damage)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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