![]() | |
| | #1 |
![]() Join Date: Jan 2008
Posts: 4
![]() | Problem with Jass Function In my map Element War's, I'm developing the new element Light. Their method of harvesting has already been thought out, but the function isn't working properly. The trigger's purpose is as follows: Light's worker cast's the spell light veil, the veil then gives the player Elemental Power (gold) for the amount of territories fogged or masked; as well as granting extra mana. Afterwards, the territory is revealed with a dummy caster generated farsight, revealing the terrain for 30 seconds, and thus requiring the worker to move to another destination, as the worker only has a vision radius of 200. Code: function LightVeilCond takes nothing returns boolean
return GetSpellAbilityId() == 'A05Y'
endfunction
function LightVeilAct takes nothing returns nothing
local unit u = GetTriggerUnit()
local texttag tt
local player pl = GetOwningPlayer(u)
local location p = GetUnitLoc(u)
local location vp
local integer i = 0
local real angle = 1
local real r = 0
local real mana
local unit c = CreateUnitAtLoc(pl, 'e000', p, 0)
loop
loop
exitwhen (i == 40)
set vp = PolarProjectionBJ(p, 200 + (i * 10), (angle * 10))
///Debug Special Effect, this allows me to see where vp is.
call DestroyEffect( AddSpecialEffectLoc( "Abilities\\Spells\\Undead\\DeathPact\\DeathPactTarget.mdl", vp ) )
if (IsLocationFoggedToPlayer(vp, pl) == true) then
set r = r + 1
endif
if (IsLocationMaskedToPlayer(vp, pl) == true) then
set r = r + 3
endif
call RemoveLocation(vp)
set i = i + 1
endloop
exitwhen (angle == 36)
set angle = angle + 1
//Debug Message
call DisplayTextToForce(GetPlayersAll(), R2S(angle))
endloop
set mana = GetUnitState(u,UNIT_STATE_MANA) + r
call SetUnitState(u,UNIT_STATE_MANA, mana)
call AdjustPlayerStateBJ(R2I(r),pl,PLAYER_STATE_RESOURCE_GOLD)
set tt = CreateTextTagLocBJ("+" + I2S(R2I(r)), p, 0, 10, 100, 100, 0.00, 0)
call ShowTextTagForceBJ( false, tt, GetPlayersAll() )
call ShowTextTagForceBJ( true, tt, GetForceOfPlayer(GetOwningPlayer(u)) )
call SetTextTagPermanent( tt, false )
call SetTextTagVelocityBJ( tt, 64, 90 )
call SetTextTagLifespan( tt, 5 )
call SetTextTagFadepoint( tt, 3.00 )
call TriggerSleepAction(0.01)
call UnitAddAbility(c, 'A05Z')
call IssuePointOrderLoc(c,"farsight",p)
call UnitApplyTimedLife(c,'BTLF',4)
call RemoveLocation(p)
endfunction
//===========================================================================
function InitTrig_Light_Veil_2 takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function LightVeilCond ) )
call TriggerAddAction( t, function LightVeilAct )
endfunction I think it may be something to do with me using a loop within another loop, but I'm not sure why that would cause an issue. |
| | |
| | #2 |
![]() Join Date: Jan 2008
Posts: 4
![]() | Re: Problem with Jass Function Fixed it, made the first loop call a function which contained the second loop, worked fine after that. Really wish there was a tutorial that explained this bug though. |
| | |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] Coding and efficient knockback (vJass) | Silvenon | Submit a Tutorial [World Editor] | 2 | 10-23-2007 06:43 AM |
| JASS? | Acolyte | World Editor Help | 9 | 09-21-2007 02:08 PM |
| The Ultimate Introduction to JASS! | darkwulfv | Tutorials | 0 | 08-07-2007 01:55 AM |