Takes integer returns unit

Lobster

Old Fogey ofthe site
Reaction score
90
Is there such thing as
Code:
 Take integer Return Unit
I need it for my resistant thing, if thjats even possible.
 

Luth

Lex Luthor!
Reaction score
41
Code:
function Resistance takes integer I returns unit
  //do my fancy code here
  return myUnit
endfunction
 

Lobster

Old Fogey ofthe site
Reaction score
90
Im new to JASS, but Ill try n figure the code out from there. + rep to both of you.
 

SFilip

Gone but not forgotten
Reaction score
634
wait, what are you trying to do? have a special number for each unit? that would be custom value, already exists in gui...
additionally you could use handle vars/cscache (discussed before, look through the forum if you need links). however this would require converting your whole trigger to jass so i'm not sure if this is what you want (and you dont if you simply want to store an integer).
 

Lobster

Old Fogey ofthe site
Reaction score
90
Dont I need 4 custom values, one for each element? Ill explain the problem in my other thread.

all the spells have a element type, And every unit has a certain amount of resistance, and a certain amount of power for each element. for example: Oceans wave is a spell that deals water damage. If a unit in the way of the spell has a water resistance to 20 to water and the spell would have done 40 damage, the spell would do a total of 20 damage, because 40-20= 20. If the unit has -20 resistance to water* the unit will take 60 damage, because 40+20 = 60.

* The real resistance is on a balance between 0- 1000, where 500 is the balance between negative and positive.
Sorry if I can't be clear, this is taking math which might be hard for some people to understand.
 

SFilip

Gone but not forgotten
Reaction score
634
ok for that you need handle vars. you have 2 options:
CSCache (probably the better way, but the site is down atm - will be up tomorow)
Local Handle Vars (not as good as CSCache, but you don't really need more than this)

example of using them:
CSCache
call AttachInt(unit, "Resistance Fire", 5)
call AttachInt(unit, "Resistance Frost", 10)
and to read them
set udg_SomeGlobalInteger = GetAttachedInt(unit, "Resistance Fire")
set udg_SomeGlobalInteger = GetAttachedInt(unit, "Resistance Frost")
Local Handle Vars (same thing basically, different command names)
call SetHandleInt(unit, "Resistance Fire", 5)
call SetHandleInt(unit, "Resistance Frost", 10)
set udg_SomeGlobalInteger = GetHandleInt(unit, "Resistance Fire")
set udg_SomeGlobalInteger = GetHandleInt(unit, "Resistance Frost")

of course "Resistance Fire" can be any string. unit can also be anything you can use from the gui, including Triggering Unit (GetTriggerUnit()), Target Unit Of Ability Being Cast (GetSpellTargetUnit()) etc.
 
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