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

CONVERT REAL TO INTEGER QUESTION!!

Status
Not open for further replies.
Level 4
Joined
Feb 27, 2006
Messages
49
how do damage a unit for the damage the unit deals X 2 etc by using the conversion - convert real to integer function. i know how to damage units for their current mana and life and max life but not their damage how do i do that?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
raul...
Hes asking how can he get a units attack not how to convert integers to reals or visa versa.

The answer is simple. . .
You just can not easily!

There are ways but they are not all that accurate and can cause glitches (uber damage) if the unit casts a spell at the right time.

The only way to accuratly deal 2X unit's atack is to temperoraly add a moded critical strike and get the unit to attack the target.

THERE IS NO WAY TO RETRIVE OR DEAL 2X A UNIT'S ATTACK WITH OUT IT ATTACKING OR MAKING A COMPLEX SYSTEM!
Blizzard never put in a GetUnitAttack() function or anything like it.

Though if you assemble an advanced tracking system of items, stats and damage moding spells/bluffs you can culculate a units attack you cant realy just directly retrieve it.

I reccomend you make all your spells stat based like in DBZ tribute.
Since you can easily retrieve stats.
 
Level 2
Joined
Dec 18, 2005
Messages
28
sorry dude just saw the topic and posted, i was kinda weary that evening
in JASS:
JASS:
function Trig_doublehit_Conditions takes nothing returns boolean
    if ( ( GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) > 0 ) ) then
        return true
    else
        return false
    endif
endfunction

function Trig_doublehit_Actions takes nothing returns nothing
    local integer i = GetRandomInt(1, 100)
    if ( ( i <= ( GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) * 5 ) ) ) then
        call SetUnitLifeBJ( GetAttackedUnitBJ(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ()) - GetEventDamage() ) )
    endif
endfunction

//===========================================================================
function InitTrig_doublehit takes nothing returns nothing
    set gg_trg_doublehit = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_doublehit, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_doublehit, Condition( function Trig_doublehit_Conditions ) )
    call TriggerAddAction( gg_trg_doublehit, function Trig_doublehit_Actions )
endfunction
All you have to do is to change the 'XXXX' values with the ability raw code of your passive skill and change the values for the chance (I set it to 5% per level).
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
raul said:
sorry dude just saw the topic and posted, i was kinda weary that evening
in JASS:
JASS:
function Trig_doublehit_Conditions takes nothing returns boolean
    if ( ( GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) > 0 ) ) then
        return true
    else
        return false
    endif
endfunction

function Trig_doublehit_Actions takes nothing returns nothing
    local integer i = GetRandomInt(1, 100)
    if ( ( i <= ( GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) * 5 ) ) ) then
        call SetUnitLifeBJ( GetAttackedUnitBJ(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetAttackedUnitBJ()) - GetEventDamage() ) )
    endif
endfunction

//===========================================================================
function InitTrig_doublehit takes nothing returns nothing
    set gg_trg_doublehit = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_doublehit, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_doublehit, Condition( function Trig_doublehit_Conditions ) )
    call TriggerAddAction( gg_trg_doublehit, function Trig_doublehit_Actions )
endfunction
All you have to do is to change the 'XXXX' values with the ability raw code of your passive skill and change the values for the chance (I set it to 5% per level).

lol, 1st

JASS:
function Trig_doublehit_Conditions takes nothing returns boolean
    if ( ( GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) > 0 ) ) then
        return true
    else
        return false
    endif
endfunction

//should be

function Trig_doublehit_Conditions takes nothing returns boolean
return GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) > 0
endfunction

second, remove those messy BJs and Swappeds.

third, no offence, but that looks like a Convert.

it probably is.

4th, this doesnt work ^.^ if a unit is attacked, it is not damaged, so you cannot GetEventDamage()
 
Level 2
Joined
Dec 18, 2005
Messages
28
ur right i figured out that geteventdamage only works with unit takes damage, for myself i did an dummy who whenever u succes a double hit its placed at the location of the attacked unit and the attacking unit is forced to attack that unit, so with a second trigger i can get the eventdamage and damage the attacked unit this way.
bzw its not a convert and no offense if u call that a convert u probably never converted a trigger ^^
i just put sometimes some extra ( to have a better overview in the trigger editor.
 
Level 2
Joined
Dec 18, 2005
Messages
28
First of all it's no convert and I also cant see any similarity with a convert... So next time you allege something give arguments.
And btw there is nothing such as "ur code should look like this"
my code was correct so it makes no difference if i write
return "shit"
or
return (("sh")) + ("it")
 
Level 2
Joined
Dec 18, 2005
Messages
28
I ment the code u claimed to be look like this
JASS:
function Trig_doublehit_Conditions takes nothing returns boolean 
if ( ( GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) > 0 ) ) then 
return true 
else 
return false 
endif 
endfunction 

//should be 

function Trig_doublehit_Conditions takes nothing returns boolean 
return GetUnitAbilityLevelSwapped('XXXX', GetAttacker()) > 0 
endfunction
and as you might have read I noticed my mistake and also suggested a solution
also that BJ whatever you mean by it is a part of the native that returns the attacking unit and I have no idea what you find as "converted" in it
I maybe am not the best JASSer around but ur for sure the most arrogant and I'm sure ur also not the best...
P.S. I tested the condition like I wrote it returning the time taken for the trigger and there was no difference to ur version, dude....
Why dont you show off at ur smaller brother.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
raul. . . . . . . .
What your saying makes absoultly no sense.
Learn to jass properly then you can help in this type of question.

firstly
SetUnitLifeBJ()
WT% your meant to DAMAGE not remove HP from the target, this will cause HORIABLE bugs like a unit dieing with no one having killed it and even crashes if the unit is linked to a trigger that requires a killer.
Worse this is a BJ call and among the worst, it links to about 3 diffrent functions so just call the proper one.

and as you might have read I noticed my mistake and also suggested a solution
also that BJ whatever you mean by it is a part of the native that returns the attacking unit and I have no idea what you find as "converted" in it
I maybe am not the best JASSer around but ur for sure the most arrogant and I'm sure ur also not the best...
P.S. I tested the condition like I wrote it returning the time taken for the trigger and there was no difference to ur version, dude....
Why dont you show off at ur smaller brother.

Your talking rubish raul. . .

and as you might have read I noticed my mistake and also suggested a solution. . .

Its obovious to anyone who has even played with GUI triggers and even people who have played WC3 alot that GetUnitDamage() or whatever only works with the single unit takes damage event since unit is attacked event only fires when a unit is about to atttack (launch projectile) not when the attack deals damage and further more it might fire with out the attacking unit even inflicting damage due to it is triggered when it starts attack animation not when the attack is launched.

also that BJ whatever you mean by it is a part of the native that returns the attacking unit. . .

BJ calls LINK to other functions that can be directly called thus adding more strain to your computer than necssary.
Some BJ calls are good to call though since they run a group of functions thus saving map size through triggering. Such BJ calls are the BJErumDestructablesInCircle() or whatever it is called and other like it.

By "converted" he means that that trigger you gave was a GUI trigger that you used "convert to text" on and posted to try and fool people into thinking you are smart since thats exactly how GUI writes.

I tested the condition like I wrote it returning the time taken for the trigger and there was no difference to ur version. . .

LOL . . . You take things too lituraly.
When he says "faster" he means in processing speed.
Call the condition 100000 times and call the other the same amount and see which is faster to stop lagging. . .
You should notice that the direct return one is way supperior.
I admit he is wrong to say it is faster since they both are phicialy as fast in game and both fire instantly but the one will not lag as much if you are "over calling" functions.

I maybe am not the best JASSer around but ur for sure the most arrogant and I'm sure ur also not the best. . .
. . . Why dont you show off at ur smaller brother.

Yes raul why do you not show off to your 3-4 year old brother or sister since atleast you can fool him or her into thinking you know triggers.
You made a complete fool of your self in this topic and if I was you I would be very imbarresed and get back to reading about jass.
PurplePoot knows a HECK of alot more about jass than you do although he should not say a function is faster since it can be misleading and understood wrongly also raul you should not rant about things you do not under stand to a great degree.
Your grammars attrotious and your perseption of the world is selfish.

I my self know jass where as my OLDER brother does not, so do not think that just because someone is younger does not mean they will not understand things.
 
Level 2
Joined
Dec 18, 2005
Messages
28
Your grammars attrotious and your perseption of the world is selfish.
well...
"HORIABLE" "Worse this" "obovious" "Its obovious to anyone who has even played with GUI triggers and even people who have played WC3 alot that GetUnitDamage() or whatever only works with the single unit takes damage" "necssary" " lituraly" "supperior" "phicialy" "imbarresed" "do not under stand" "attrotious" "perseption"
Every 4th word you type is spelled wrong...
And you tell me?
Your talking rubish raul. . .
Your grammars attrotious...
But the best one is still:
your perseption of the world is selfish
I am impressed bout ur insight into human nature.
Although you think that my grammar sucks cuz I shorten words like "u" "ur" "cuz" "bout" a.s.o. I am left standing since I also know how to spell words correct.
Not to mention I have no sister or brother =P but I guess your knowledge of human nature can't be compared to my intuition. (call that selfish or whatever you want, but it was just an ironic joke)
Dont get me wrong dude I take this all very amused and not "imbarresed"
At last I have to admit that you and your brother know better JASS then I do and you were right with the setlife function I just didnt think about it that way, I wanted to deal 100% dmg to a target not regarding the armor. Why I used the BJ functions is because I'm working with JassCraft and I am using the native search field where I just input logic search terms like "set unit Life" or "attacking unit". I havent noticed yet that they call other functions cuz to be honest I dont use JASS for a long time.
 
Status
Not open for further replies.
Top