# A confusing Reals and Integers

Discussion in 'World Editor Help Zone' started by Edge45, Feb 17, 2014.

1. ### Edge45

Joined:
May 15, 2013
Messages:
2,570
Resources:
27
Models:
8
Icons:
17
Template:
2
Resources:
27
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?

2. ### defskull

Joined:
Mar 27, 2008
Messages:
7,979
Resources:
17
Spells:
17
Resources:
17
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.

3. ### Edge45

Joined:
May 15, 2013
Messages:
2,570
Resources:
27
Models:
8
Icons:
17
Template:
2
Resources:
27
Oh thanks defskull

### Spell Reviewer

Joined:
Jan 18, 2005
Messages:
25,930
Resources:
3
Maps:
1
Spells:
2
Resources:
3
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).

5. ### Edge45

Joined:
May 15, 2013
Messages:
2,570
Resources:
27
Models:
8
Icons:
17
Template:
2
Resources:
27
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)

6. ### muzzel

Joined:
Jun 27, 2008
Messages:
1,303
Resources:
2
JASS:
1
Wurst:
1
Resources:
2
Dont check the owners of <Picked Unit> and <Casting Unit> for equality, instead use the condition "Player (Owner of <Picked Unit>) is enemy of Player (Owner of <Casting unit>)".

7. ### vypur85

Joined:
Jan 27, 2014
Messages:
158
Resources:
1
Maps:
1
Resources:
1
> 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 (Text):

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

8. ### DysfunctionaI

Joined:
Mar 6, 2006
Messages:
281
Resources:
1
Tutorials:
1
Resources:
1
What vypur85 is true, you should never use Damage Area because of a bug with macs, I believe.

9. ### defskull

Joined:
Mar 27, 2008
Messages:
7,979
Resources:
17
Spells:
17
Resources:
17
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.

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.

Joined:
Mar 6, 2006
Messages:
281
Resources:
1
Tutorials:
1
Resources:
1
11. ### Edge45

Joined:
May 15, 2013
Messages:
2,570
Resources:
27
Models:
8
Icons:
17
Template:
2
Resources:
27
thanks guys for helping me, now I will try to do this