Page 1 of 1

Trigger Help

Posted: June 28th, 2008, 7:26 pm
by Gilles
Not sure if this should go in off-topic.

How do you make summons follow their summoner? Are you using a follow command? Or more complicated, like calculate when the hero get's too far away and order it to move to the hero? I'm having trouble with my own following summon.
Summon
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Summon Water Being
Or - Any (Conditions) are true
Conditions
(Region 001 <gen> contains (Triggering unit)) Equal to True
Actions
Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at (Center of Water <gen>) facing (Position of (Triggering unit))
Unit - Add Summon Water Being (real) to (Last created unit)
Unit - Order (Last created unit) to Human Archmage - Summon Water Elemental
Set WaterBeing = (Summoned unit)
Set NaturesGuardian_Water = (Triggering unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Now for the follow.
WaterBeing Move
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit - Order WaterBeing to Follow NaturesGuardian_Water
If you have some time Darn Yak, I'd appreciate it if you could help me out. Thanks.

Re: Trigger Help

Posted: June 28th, 2008, 10:12 pm
by Dekar
Try "Distance between points" with the positions of the 2 units. It should return a real.

If it is larger than 300 make it attack move to the caster, if it is larger then 800 make it move to him.

Will leak in GUI though if you dont fix it.

Re: Trigger Help

Posted: June 29th, 2008, 11:41 am
by Gilles
Dekar wrote:Try "Distance between points" with the positions of the 2 units. It should return a real.

If it is larger than 300 make it attack move to the caster, if it is larger then 800 make it move to him.

Will leak in GUI though if you dont fix it.
Can't get it to work. Here is what I have.
I even tried moving the triggers that set the variables up to the top. Still won't work.
Summon
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Summon Water Being
Or - Any (Conditions) are true
Conditions
(Region 001 <gen> contains (Triggering unit)) Equal to True
Actions
Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at (Random point in Water <gen>) facing (Position of (Triggering unit))
Unit - Add Summon Water Being (real) to (Last created unit)
Unit - Order (Last created unit) to Human Archmage - Summon Water Elemental
Set WaterBeing = (Summoned unit)
Set NaturesGuardian_Water = (Triggering unit)
Set Range = (Distance between (Position of (Summoned unit)) and (Position of (Triggering unit)))
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
WaterBeing Move
Events
Game - Range becomes Equal to 300.00
Conditions
Actions
Unit - Order WaterBeing to Attack-Move To (Position of NaturesGuardian_Water)
WaterBeing MoveFarther
Events
Game - Range becomes Equal to 800.00
Conditions
Actions
Unit - Order WaterBeing to Move To (Position of NaturesGuardian_Water)

Re: Trigger Help

Posted: June 29th, 2008, 1:29 pm
by DarnYak
Alright, you've got the basic concept right but there's some big issues with the triggers. Ignoring memory leak issues, as those should be dealt with after the thing works.

Code: Select all

Conditions
(Ability being cast) Equal to Summon Water Being 
Or - Any (Conditions) are true
Conditions
(Region 001 <gen> contains (Triggering unit)) Equal to True
Not sure why youhave an or here, the ability being cast should be sufficient. Unless it should be an AND... I suppose that could explain some of the weirdnessi n the trigger.

Code: Select all

Unit - Order (Last created unit) to Human Archmage - Summon Water Elemental
Set WaterBeing = (Summoned unit)
Suggestion: just create the summoned unit directly with a create unit, and add a summon timer (if nessary). If there's a birth animation problem, just queue that animation up.

Problem: Summoned unit doesn't refer to anything in this trigger. Another event, "A unit spawns a summoned unit" goes off, and in that event it will refer to Summoned Unit properly.

This is the main reason you're entire trigger is being frustrating and unresponsive at the moment.

Code: Select all

Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
You could probably just remove the unit at this point, most spells go off instantly.


Dekar's suggestion is pretty correct for a nicer following unit, but you're understanding of how that works seems abit off.

Code: Select all

Events
Game - Range becomes Equal to 300.00
This might work, but I doubt it and don't like it. Not too familiar with the range trigger and how frequently it goes off. Instead what you want to do, in you're periodic 2 second timer, have an If (Distance between is > 300) then do follow, else (if distance between > 800 then do warp)

DarnYak

Re: Trigger Help

Posted: June 29th, 2008, 1:35 pm
by Dekar
"Game - Range becomes Equal to 300.00" O_o wtf is that?

Add a periodical event for the distance check triggers: Every 1 second

Change the distance check to xxx greater than 300/800 instead of equal to.

Merge the 2 distance checks into one trigger:


Events:
Every 1 sec
Actions:
if distance between x y > 300 then attack move
if distance between x y > 800 then move

edit: yak posted at the same time :D

Re: Trigger Help

Posted: June 30th, 2008, 11:42 pm
by Gilles
Thanks guys, I'll try and fix it up soon.

btw DarnYak, I have the "Or" condition because I was going to make multiple areas that you could spawn the unit. Now that I've thought about it, I have to just summon the unit beside the caster.