HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Just had some serious problems..

10-31-2006, 07:42 PM#1
Zachary_Shadow
And now one of my spells doesn't work.

It's Jass, and I suck at Jass... all I get is errors if I try to start up the trigger.. I'm thinking I need something in the custom script code, as I tried to use the WE Enhancer to add Advanced Triggers, and ended up with 10000 errors... Now there is nothing in my custom script code.

Anyways, here is the spell.. Can anyone tell me what I need to do ?

The spell does create the Guardians, as that is based on GUI, but the control of the Guardians has gone out the window....

Collapse JASS:
function Trig_Guardian_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetSummonedUnit()) == 'n00F' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Guardian_Actions takes nothing returns nothing
    local unit ball = GetSummonedUnit()
    local unit master = GetSummoningUnit()
    local location target
    local real angle
    local real distance
    
    loop
    exitwhen IsUnitDeadBJ(ball)
    if (DistanceBetweenPoints(GetUnitLoc(ball), GetUnitLoc(master)) > 1000.00 ) then
        set target = GetUnitLoc(master)
        call IssuePointOrderLocBJ(ball, "move", target) 
        call RemoveLocation(target)
    else
        set target = GetUnitLoc(master)
        set angle =  GetRandomDirectionDeg()
        set distance = GetRandomReal(100.00, 500.00)

        call PolarProjectionNL(target, distance, angle)
        call IssuePointOrderLocBJ(ball, "attack", target)
        call RemoveLocation(target)
    endif
    call TriggerSleepAction( 0.50 )
    endloop
endfunction

//===========================================================================
function InitTrig_Guardian takes nothing returns nothing
    set gg_trg_Guardian = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Guardian, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition( gg_trg_Guardian, Condition( function Trig_Guardian_Conditions ) )
    call TriggerAddAction( gg_trg_Guardian, function Trig_Guardian_Actions )
endfunction


Trigger:
Randomize Guardians
Collapse Events
Unit - A unit Spawns a summoned unit
Collapse Conditions
(Unit-type of (Summoned unit)) Equal to Lightning Guardian (Level 2)
Collapse Actions
Set Random_Elemental_Nr = (Random integer number between 0 and 5)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random_Elemental_Nr Equal to 1) or (Random_Elemental_Nr Equal to 2)
Collapse Then - Actions
Unit - Add Ball of Fire to (Summoned unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Random_Elemental_Nr Equal to 3
Collapse Then - Actions
Unit - Add Ball of Earth to (Summoned unit)
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Random_Elemental_Nr Equal to 4) or (Random_Elemental_Nr Equal to 5)
Collapse Then - Actions
Unit - Add Ball of Ice to (Summoned unit)
Collapse Else - Actions
Do nothing
Custom script: call UnitAddAbilityBJ('Aloc',GetTriggerUnit())
Unit - Add Wander (Neutral) to (Triggering unit)
10-31-2006, 08:09 PM#2
Fireeye
uhm, i think this is the problem
Collapse JASS:
    exitwhen IsUnitDeadBJ(ball)
If i'm not wrong you have to type
Collapse JASS:
    exitwhen IsUnitDeadBJ(ball) == true
10-31-2006, 08:56 PM#3
Captain Griffen
No, you don't. Boolean has to be true, no need to compare with true. GetWidgetLife(ball) < 0.405 would be better.
11-01-2006, 03:28 PM#4
Zachary_Shadow
Cool, I'll see if it works...

None of you said I needed anything in my custom script part (the things that load before any triggers) is that correct? I think I had something there ....

Collapse JASS:
call PolarProjectionNL(target, distance, angle)

Getting an error like that... says: Expected a function name...

Sorry, but I'm totally stupid at JASS... :P
11-01-2006, 03:42 PM#5
zen87
I'm not quite sure... is this what you trying to do ?
- order the guardian to move towards the master when he is at range 1000 or more
- if it is in the range, ask the guadian to attack random loc around it

---

if thats the case, the try this, but i'm not sure will work or not

Collapse JASS:
function Trig_Guardian_Conditions takes nothing returns boolean
    return GetUnitTypeId(GetSummonedUnit()) == 'n00F'
endfunction

function Trig_Guardian_Actions takes nothing returns nothing
    local unit ball = GetSummonedUnit()
    local unit master = GetSummoningUnit()
    local location lball
    local location lmas
    local location target
    
    loop
    exitwhen GetWidgetLife(ball)<0.405
    set lball = GetUnitLoc(ball)
    set lmas = GetUnitLoc(master)
    if DistanceBetweenPoints(lball,lmas) > 1000 then
        call IssuePointOrderLoc(ball,"move",lmas) 
    else
        set target=PolarProjectionBJ(lball,GetRandomReal(100,500), GetRandomReal(0,360))
        call IssuePointOrderLocBJ(ball, "attack", target)
    endif
    call TriggerSleepAction(0.5)
    endloop
 set ball=null
 set master=null
 set lball=null
 set lmas=null
endfunction

//===========================================================================
function InitTrig_Guardian takes nothing returns nothing
 local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SUMMON )
    call TriggerAddCondition(t, Condition( function Trig_Guardian_Conditions ) )
    call TriggerAddAction( t, function Trig_Guardian_Actions )
 set t=null
endfunction

11-04-2006, 03:17 AM#6
Zachary_Shadow
Thanks Zen87 :) It works now, I suppose that I can change the range for the balls distance from the hero to whatever I want right ? Gonna try it out ;)
+rep for the help!
11-04-2006, 03:21 AM#7
zen87
yes, just change the value here
Collapse JASS:
    if DistanceBetweenPoints(lball,lmas) > 1000 then //change the 1000, for your case, i do suggest a number around... 300-500
11-04-2006, 03:29 AM#8
Zachary_Shadow
Setting it at 300, just tried 650 and it seems like they get to go maybe 50-100 extra before returning as the trigger takes a bit to react, so 300 is fine :) Thanks for helping me out here since I fucked it up... gonna credit you for it and the original owner, although I've unfortunatly forgotten who wrote it for me back then :( I'll look around to see if I can't locate it :)

Wanna take a look at another trigger for me? Alot bigger though... hehe.. but it's only 1 thing I need to make happen...
11-04-2006, 03:53 AM#9
zen87
well, i'll see what can i help, im still a jass learner after all, need more practice :P but remember to tell what's the trigger atctually doing x_x
11-04-2006, 11:51 AM#10
Whitehorn
Zachary! When did you return?
11-04-2006, 11:56 PM#11
Zachary_Shadow
Quote:
Originally Posted by Whitehorn
Zachary! When did you return?


Hey mate! Like 1 or 2 weeks ago :) Took up THE project again :D hehe... Things are already looking up ;)

Hope I don't get hurt for replying to this... hehe... I'll send you my MSN mate!