Add Strength as decimal

Vnbear

Active Member
Reaction score
12
Code:
Hidden Potential
    Events
        Unit - A unit Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Killing unit)) Equal to Royal Knight
                (Level of Hidden Potential  for (Killing unit)) Greater than 0
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Hidden Potential  for (Killing unit)) Equal to 1
            Then - Actions
                Hero - Modify Strength of (Killing unit): Add (Integer(0.03))
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Hidden Potential  for (Killing unit)) Equal to 2
                    Then - Actions
                        Hero - Modify Strength of (Killing unit): Add (Integer(0.05))
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Hidden Potential  for (Killing unit)) Equal to 3
                            Then - Actions
                                Hero - Modify Strength of (Killing unit): Add (Integer(0.07))
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Level of Hidden Potential  for (Killing unit)) Equal to 4
                                    Then - Actions
                                        Hero - Modify Strength of (Killing unit): Add (Integer(0.09))
                                    Else - Actions
                                        Hero - Modify Strength of (Killing unit): Add (Integer(0.11))

What is wrong with this trigger? This trigger doesnt add any strength to my hero even after 10 kills at level 5.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Are the conditions working. Just to see if it is, add "Game - Display Text to ..." for all players before any of the other actions. Then test it.

This will tell you if the conditions are being met. ;)
 

Vnbear

Active Member
Reaction score
12
Are the conditions working. Just to see if it is, add "Game - Display Text to ..." for all players before any of the other actions. Then test it.

This will tell you if the conditions are being met. ;)

The conditions are met. The text "it works" is displayed. So what is wrong with the trigger?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Oh, I didn't look closely. You are adding 0.03, instead of 0.3. And you are making it an integer, so it will go to 0. Thus, it adds 0 strength.
 

Vnbear

Active Member
Reaction score
12
Doesnt convert real to integer works? I think it doesnt...
Then what can i do to make it real?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Integers are all whole numbers, so they can't be a decimal.

Reals are all numbers.

I'm not sure if you can add real strength values.

I don't have WE on this comp, so I'm not sure if there is a way.
 

Choppa

www.warcraft-gamers.po.gs
Reaction score
59
Are you converting an integer to a real? Or vice versa?
Yeah i'm pretty sure attributes are measured in integers, and converting a real to an integer would round it, for 0.03 it would make it 0 i.e no effect, and converting an integer to a real would still give an integer value unless you added on to the real number.

EDIT: Sorry I mean it doesn't round, it cuts off the decimals.
 

worldofDeath

New Member
Reaction score
47
You have to have some numbering system. Which is in jass i had this same problem and i said screw it!
 

Vnbear

Active Member
Reaction score
12
I know nothing about JASS except:
call RemoveLocation(udg_)
and
call DestroyGroup(udg_)
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
I know JASS. :p I love it and it is my pal. xD

I'll check for any functions that may help you.

EDIT: As far as I know, there aren't any functions for it. Sorry. But you can always track how many are killed, then do something like: NumberKilled Equal to 5 then add 1 strength..

Just crappy pseudo above. It may require a bit of triggering knowledge.
 

Vnbear

Active Member
Reaction score
12
Im doing this now:

Code:
Hidden Potential
    Events
        Unit - A unit Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Killing unit)) Equal to Royal Knight
                (Level of Hidden Potential  for (Killing unit)) Greater than 0
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Hidden Potential  for (Killing unit)) Equal to 1
            Then - Actions
                Set HPStr = (HPStr + 0.03)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Hidden Potential  for (Killing unit)) Equal to 2
                    Then - Actions
                        Set HPStr = (HPStr + 0.05)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Hidden Potential  for (Killing unit)) Equal to 3
                            Then - Actions
                                Set HPStr = (HPStr + 0.07)
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Level of Hidden Potential  for (Killing unit)) Equal to 4
                                    Then - Actions
                                        Set HPStr = (HPStr + 0.09)
                                    Else - Actions
                                        Set HPStr = (HPStr + 0.11)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                HPStr Greater than or equal to 1.00
            Then - Actions
                Set HPStr = (HPStr - 1.00)
                Hero - Modify Strength of (Killing unit): Add 1
            Else - Actions

But there is still a problem, whenever you level, you gain 2.5 strength. The 0.5 strength doesnt add with this strength gain. I know the reason why, but this is best solution to this.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
What you can try:

If you are not using the custom value of the unit, you can use it to store the decimal places. If you are, just use a variable

You replace this:
Hero - Modify Strength of (Killing unit): Add (Integer(0.03))
with this:
Unit - Set Custom value of (Killing unit) = Custom value of (Killing unit) + 3

At the end of your trigger, add this:
If
.. Custom value of (Killing unit) is greater then 99
Then
.. Set Custom value of (Killing unit) = Custom value of (Killing unit) - 100
.. Hero - Modify Strength of (Killing unit): Add 1
 

Vnbear

Active Member
Reaction score
12
@MoonSlinger

Your method is almost similar to my previous post. But thanks anyway.

@warroom99

I am bad at JASS. Once converted to custom text, i will faint.

@PurgeandFire

Nevermind.Thanks anyway.
 

warroom99

New Member
Reaction score
15
ow... you could always use search( i meant in the editor)

fist create a trigger with an action(only one) that adds the str of the hero

then convert look for the add str

then look for it in the other trigger...

just try...

if you fear jass...

face your fear...

:D
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
@MoonSlinger

Your method is almost similar to my previous post. But thanks anyway.

Didn't see your post when I am posting... but it should work except for the little problem you have
 

DhAoS[ARRC]

New Member
Reaction score
10
[i'm kind of off topic and such and you may delete post if necessary.] But decimals are integers >.> they're also real numbers, and i might sound like an idiot...so ^_^
 

Choppa

www.warcraft-gamers.po.gs
Reaction score
59
[i'm kind of off topic and such and you may delete post if necessary.] But decimals are integers >.> they're also real numbers, and i might sound like an idiot...so ^_^

A number with a decimal place value isn't an integer :nuts: lol.
 
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