I am using this thing i got from here. It causes the summoned unit to guard the summoning unit like in Diablo II. It wont work. It says "Expected a function name".
I also not sure where to put the Jass Snippet thing. Here is the Jass Snippet thing.
Also here is another trigger that calls or something.
there is a problem with this line. It says "Expected a function name".
It now works. I convert the guard trigger into text and then copy pasted the jass snippet at the top of the call UnitGuardUnitAI(GetSummonedUnit(),GetSummoningUnit())
I also not sure where to put the Jass Snippet thing. Here is the Jass Snippet thing.
Code:
function UnitGuardUnitAI takes unit summon, unit master returns nothing
local location target
local real angle
local real dist
loop
exitwhen IsUnitDeadBJ(summon)
if (DistanceBetweenPoints(GetUnitLoc(summon), GetUnitLoc(master)) > 1000.00 ) then
set target = GetUnitLoc(master)
call IssuePointOrderLocBJ(summon, "move", target)
call RemoveLocation(target)
else
set target = GetUnitLoc(master)
set angle = GetRandomDirectionDeg()
set dist = GetRandomReal(100.00, 500.00)
call MoveLocation(target, GetLocationX(target) + dist * Cos(angle * bj_DEGTORAD), GetLocationY(target) + dist * Sin(angle * bj_DEGTORAD))
call IssuePointOrderLocBJ(summon, "attack", target)
call RemoveLocation(target)
endif
call TriggerSleepAction( 1.0+GetRandomReal(0.0,1.5))
endloop
set target = null
endfunction
Also here is another trigger that calls or something.
Code:
Guard
Events - A unit Spawns a summoned unit
Conditions
Or - Any (Conditions) are true
Conditions
- Unit type of summoned... bla... bla...bla
- Unit type of summoned... bla... bla...bla
- Unit type of summoned... bla... bla...bla
Actions - Custom Script: call UnitGuardUnitAI(GetSummonedUnit(),GetSummoningUnit())
there is a problem with this line. It says "Expected a function name".
Code:
UnitGuardUnitAI(GetSummonedUnit(),GetSummoningUnit())
It now works. I convert the guard trigger into text and then copy pasted the jass snippet at the top of the call UnitGuardUnitAI(GetSummonedUnit(),GetSummoningUnit())