jig7c
Stop reading me...-statement
- Reaction score
- 123
i want it so that everytime a HERO kils a Neutral Hostile creep, the hero gains +2 to either Agi, Int, or Str, randomly picked and applied to hero's stats..
i could create a tome, but then the hero has to pick it up.. i don't want that...
how do i do it?
here is what i got so far?
i dont know if this is correct or not...
this is also my first JASS trigger, so i dont know if i did it correctly or not, most likely i didn't... but if someone can check up on it and let me know where i messed up, that would be great!
i know the conditions are not that good! but i dont' know how to write conditions, so i had to convert that from GUI!
using UnitProperties
i could create a tome, but then the hero has to pick it up.. i don't want that...
how do i do it?
here is what i got so far?
i dont know if this is correct or not...
this is also my first JASS trigger, so i dont know if i did it correctly or not, most likely i didn't... but if someone can check up on it and let me know where i messed up, that would be great!
i know the conditions are not that good! but i dont' know how to write conditions, so i had to convert that from GUI!
using UnitProperties
JASS:
function Attribute_Conditions takes nothing returns boolean
if ( not ( IsUnitEnemy(GetKillingUnit(), Player(PLAYER_NEUTRAL_AGGRESSIVE)) == true ) ) then
return false
endif
if ( not ( IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Attribute_Actions takes nothing returns nothing
local unit u //creating unit var for later use
local integer i //creating integer for random attribute
local texttag t = CreateTextTag () //floating text
local integer a = 0 //attribute array start with 0
local integer array Attribute //creating integer[array] for the attributes
set Attribute[a+1] = bj_HEROSTAT_STR //setting array 1 to strenght
set Attribute[a+2] = bj_HEROSTAT_AGI //setting array 2 to agility
set Attribute[a+3] = bj_HEROSTAT_INT //setting array 3 to intellligence
set u = GetKillingUnit //setting u to killing unit
set i = Attribute[GetRandomInt(1,3)] //picking a random array to give bonus to
//showing a floating text over killing unit, based on the bonus given!!
//Strenght
if (i == 1) then
UnitModifyStr (u, 2) //adding the bonus
set t = CreateTextTagUnitBJ(( "+2 Strenght", u, 0, 10, 100, 100, 100, 0 )
call SetTextTagPermanent (t, false)
call SetTextTagLifespan (t, 2.00)
call SetTextTagVelocityBJ (t, 64, 90 )
call SetTextTagFadepoint (t, 2.00 )
endif
//Agility
if (i ==2) then
UnitModifyAgi (u, 2) //adding the bonus
set t = CreateTextTagUnitBJ(( "+2 Agility", u, 0, 10, 100, 100, 100, 0 )
call SetTextTagPermanent (t, false)
call SetTextTagLifespan (t, 2.00)
call SetTextTagVelocityBJ (t, 64, 90 )
call SetTextTagFadepoint (t, 2.00 )
endif
// Intelligence
if (i ==3) then
UnitModifyInt (u, 2) //adding the bonus
set t = CreateTextTagUnitBJ(( "+2 Intelligence ", u, 0, 10, 100, 100, 100, 0 )
call SetTextTagPermanent (t, false)
call SetTextTagLifespan (t, 2.00)
call SetTextTagVelocityBJ (t, 64, 90 )
call SetTextTagFadepoint (t, 2.00 )
endif
set u = null //removing unit from var
endfunction
//===========================================================================
function InitTrig_Jass takes nothing returns nothing
set t = CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple( t, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition(t, function Attribute_Conditions)
call TriggerAddAction( t, function Attribute_Actions)
endfunction