Squll2
je'ne sais pas
- Reaction score
- 76
I actually have three queries, which I will explain in this post but first of all, is there an event response for finding the Unit Within Range Center Unit?
If you dont get what I mean, heres my code (uncompleted)
Thats the intialization trigger, what im doing here as you can probably see it when a unit casts a spell it creates a unit, then adds that unit to a unit within range event to another trigger..
Heres the other trigger (incomplete)
And here stems my other two problems, first off, how do I code something depending on the integer I equaling 20-40?
also, is there a way of cleaning up and simplizing the Conditions, surly there must be?
(The Conditions)
Thanks for all the help greatly appreciate it! +rep to anyone who can solve any of my problems!
PS: Where have the spoiler tags gone?
If you dont get what I mean, heres my code (uncompleted)
JASS:
function Trig_Forest_of_Alchemy_Start_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A00A039;
endfunction
function Trig_Forest_of_Alchemy_Start_Actions takes nothing returns nothing
local location l = GetSpellTargetLoc()
local unit d
local unit u = GetSpellAbilityUnit()
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local player p = GetOwningPlayer(u)
set d = CreateUnit( p, 039;h006039;, x, y, 0.00 )
call TriggerRegisterUnitInRangeSimple( gg_trg_Forest_of_Alchemy, 600.00, d )
call PolledWait(1.00)
set p = null
endfunction
//===========================================================================
function InitTrig_Forest_of_Alchemy_Start takes nothing returns nothing
set gg_trg_Forest_of_Alchemy_Start = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Forest_of_Alchemy_Start, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Forest_of_Alchemy_Start, Condition( function Trig_Forest_of_Alchemy_Start_Conditions ) )
call TriggerAddAction( gg_trg_Forest_of_Alchemy_Start, function Trig_Forest_of_Alchemy_Start_Actions )
endfunction
Thats the intialization trigger, what im doing here as you can probably see it when a unit casts a spell it creates a unit, then adds that unit to a unit within range event to another trigger..
Heres the other trigger (incomplete)
JASS:
function Trig_Forest_of_Alchemy_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit e = GetEnteringUnit()
if ( not ( IsUnitAliveBJ(e) == true ) ) then
return false
endif
if ( not( IsUnitEnemy(e, GetOwningPlayer(u)) == true ) ) then
return false
endif
return true
endfunction
function Trig_Forest_of_Alchemy_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit e = GetEnteringUnit()
local player p = GetOwningPlayer(u)
local integer I = GetRandomInt(0, 100)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local unit d
if I <= 20 then
set d = CreateUnit(p, 039;h006039;, x, y, 0.00)
call UnitAddAbility (d, 039;A00B039;)
call IssueTargetOrder(d, "entanglingroots", e)
endif
if I
endfunction
//===========================================================================
function InitTrig_Forest_of_Alchemy takes nothing returns nothing
set gg_trg_Forest_of_Alchemy = CreateTrigger( )
call TriggerAddCondition( gg_trg_Forest_of_Alchemy, Condition( function Trig_Forest_of_Alchemy_Conditions ) )
call TriggerAddAction( gg_trg_Forest_of_Alchemy, function Trig_Forest_of_Alchemy_Actions )
endfunction
And here stems my other two problems, first off, how do I code something depending on the integer I equaling 20-40?
also, is there a way of cleaning up and simplizing the Conditions, surly there must be?
(The Conditions)
JASS:
function Trig_Forest_of_Alchemy_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local unit e = GetEnteringUnit()
if ( not ( IsUnitAliveBJ(e) == true ) ) then
return false
endif
if ( not( IsUnitEnemy(e, GetOwningPlayer(u)) == true ) ) then
return false
endif
return true
endfunction
Thanks for all the help greatly appreciate it! +rep to anyone who can solve any of my problems!
PS: Where have the spoiler tags gone?