PoLlama Forums  

Go Back   PoLlama Forums > WarCraft > World Editor Help

Reply
 
LinkBack Thread Tools
Old 02-05-2008   #1
 
Join Date: Jan 2008
Posts: 4
Zackreaver is an unknown quantity at this point
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
However, the trigger goes off, and my debug special effect only goes to the right, as if it doesn't even put the angle real into the function. As such, the trigger only scan's to see if the area to the east is fogged.

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.
Zackreaver is offline   Reply With Quote
Old 02-05-2008   #2
 
Join Date: Jan 2008
Posts: 4
Zackreaver is an unknown quantity at this point
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.
Zackreaver is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On


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


All times are GMT -5. The time now is 09:58 PM.

A friend of Wc3Happy
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165