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

A confusing Reals and Integers

Status
Not open for further replies.
Level 24
Joined
May 15, 2013
Messages
3,782
Hello WEditors, What is the real or integer of 30% of intelligence, For Example
I created a shockwave with triggered damage, but first i need a variable,

  • Set Variable - Set DamageReal - (60.00 + (Real(Intelligence of Casting Unit (Include Bonus)) (x or /) (3?)
what is it? X or / And the last number, 3?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Damage-calculation should be done in Reals.

To get 30%, you should multiply the value of INT by 0.30.
  • Set Damage = (60.00 + ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 0.30))
Note that, Damage variable is Real.

Using Real to be used as Damage gives one advantage and that is: Accuracy

If you're using Integer for damaging:
Imagine your INT is 5, therefore 30% out of 5 is 1.5, in Integer, it would be converted to 1.

In Real, you would get the 1.5 as damage.

Yes, Real value is not shown in the Unit's UI HP/MP Bar, but it does exist.

One of the proof it exists is if the unit is damaged until its HP reaches a value of 0.404 and below, it will die.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Integers are 32 bit signed integers that comply with the C/C++ type uint32_t.
Floats are 32 bit float values which are not very compliant to IEEE floats.

Use integers for absolute whole number precision. Use floats for fractional precision but be aware they are only accurate to a certain number of significant figures (possibly with error >1 unit for very large values).
 
Level 24
Joined
May 15, 2013
Messages
3,782
thq's
but another prob. So I use damage area, I only wanted to damage enemies but my ally are also damage, I use Unit Group with Condition, the condition is Owner of Picked Unit not equal to Owner of Casting Unit, And then with Damage Unit,

  • Unit Group - Pick every units in (Target point of ability being cast) with Condition (Owner of (Picked Unit)) Not equal to (Owner of (Casting Unit)) and Do Action
    • Unit - Cause (Caster(or any)) to damage (Target Point of ability being cast) with range of 200, causing (DamageVariable)
 
Level 5
Joined
Jan 27, 2014
Messages
164
> And then with Damage Unit
Well, from the trigger you didn't really damage unit per se.
You damaged a circular area.
Instead of using 'Unit - Damage area', use 'Unit - Damage target'.
And then damage individual target within the unit group that you picked.

Code:
Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)
    Loop - Actions
        Unit - Cause (Triggering unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
This should be the result of your trigger:
  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set TempLoc = (Target point of ability being cast)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 200.00 of TempLoc matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 200.00 damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_TempLoc)
TempLoc is a Point variable.


What vypur85 is true, you should never use Damage Area because of a bug with macs, I believe.
It doesn't have to do with OS or whatsoever.
We avoid using this because we can't control over which unit that is affected by the damage, that's why we often choose Damage Target for this occasion.
 
Status
Not open for further replies.
Top