HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger doesn't work.

09-18-2005, 03:11 PM#1
MrApples
Quote:

Anti Tp2
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
Actions
Set OwnerTP = (Owner of (Hero manipulating item))
Set VictimTP = (Owner of (Target unit of ability being cast))
Set CasterTP = (Hero manipulating item)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Target unit of ability being cast)) Equal to (Owner of (Hero manipulating item))
Then - Actions
Do nothing
Else - Actions
Wait until (TpDecided Equal to True), checking every 1.00 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(OwnerTP is giving VictimTP Alliance (non-aggression)) Equal to False
Then - Actions
Set TempPoint = (Position of (Hero manipulating item))
Set TempUnitGroup = (Units within 700.00 of TempPoint matching (((Matching unit) is in (Units owned by OwnerTP)) Equal to True))
Unit Group - Pick every unit in TempUnitGroup and do (Unit - Remove (Picked unit) from the game)
Custom script: call DestroyGroup(udg_TempUnitGroup)
Custom script: call RemoveLocation(udg_TempPoint)
Game - Display to (All players) for 30.00 seconds the text: Anti Tp has removed...
Game - Display to (All players) for 30.00 seconds the text: Read |cff32cd32Fair...
Trigger - Turn off DecideTp2 <gen>
Trigger - Turn on DecideTp2 <gen>
Trigger - Turn off PlayerTp2 <gen>
Trigger - Turn on PlayerTp2 <gen>
Set TpDecided = False
Else - Actions
Trigger - Turn off PlayerTp2 <gen>
Trigger - Turn on PlayerTp2 <gen>
Trigger - Turn off DecideTp2 <gen>
Trigger - Turn on DecideTp2 <gen>
Set TpDecided = False

Quote:

PlayerTp2
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
Actions
Wait until ((OwnerTP is an enemy of VictimTP) Equal to True), checking every 1.00 seconds
Set TpDecided = True


Quote:

DecideTp2
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
Actions
Wait 120.00 game-time seconds
Set TpDecided = True

The trigger is supposed to remove all units within range of the teleporting hero when a player teleports inside someones base and then unallys.
09-18-2005, 08:39 PM#2
duckduck
im guessing those are anti-bs triggers
so the easiest thing to do is just make it so that you can't unally
09-19-2005, 04:26 PM#3
MrApples
Anti-TP.

Making it so noone can unally would be completly retarded!(in my map-happy?)
Whats the point of replying to help fix a trigger if your telling me to do something completly different?
09-19-2005, 09:03 PM#4
Anitarf
The point is to give you a fresh outlook on the problem. Trigger problems are sometimes the consequence of a faulty concept, so a suggestion to change the concept can be considered as valid a solution as a suggestion about what to change on the trigger.

And you're right, Blizzard's ladder games are completely retarded.[/sarcasm]
09-20-2005, 12:41 AM#5
Gandalf2349
Quote:
Anti Tp2
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
Actions
Set OwnerTP = (Owner of (Hero manipulating item))
Set VictimTP = (Owner of (Target unit of ability being cast)) (Possibly your entire problem right here, there is no target of Ability being Cast when maniuplating Items)
Set CasterTP = (Hero manipulating item)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Target unit of ability being cast)) Equal to (Owner of (Hero manipulating item))
Then - Actions
Do nothing
Else - Actions
[b]Wait until (TpDecided Equal to True), checking every 1.00 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(OwnerTP) is an enemy of (VictimTP)
Then - Actions[b]

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(OwnerTP is giving VictimTP Alliance (non-aggression)) Equal to False
Then - Actions
Set TempPoint = (Position of (Hero manipulating item))
Set TempUnitGroup = (Units within 700.00 of TempPoint matching (((Matching unit) is in (Units owned by OwnerTP)) Equal to True))
Unit Group - Pick every unit in TempUnitGroup and do (Unit - Remove (Picked unit) from the game)
Custom script: call DestroyGroup(udg_TempUnitGroup)
Custom script: call RemoveLocation(udg_TempPoint)
Game - Display to (All players) for 30.00 seconds the text: Anti Tp has removed...
Game - Display to (All players) for 30.00 seconds the text: Read |cff32cd32Fair...
Else - Actions
Set TpDecided = False

Quote:

PlayerTp2
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
Actions
Wait until ((OwnerTP is an enemy of VictimTP) Equal to True), checking every 1.00 seconds
Set TpDecided = True


Quote:


DecideTp2
Events
Unit - A unit Uses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
Actions
Wait 120.00 game-time seconds
Set TpDecided = True

(I don't see what the point of this is, your going to condemn his units whether they unally or not.

:wtf: what was ^that^ about, see my corrections.

You know what, just scratch everything you have there. Try this on for size:

change your ownerTP and victimTP variables to arrays with the size of the number of players
Quote:
TPed (<---hmmm, coincidence? i think not)
-Events
--A Unit Uses an Item
-Conditions
--(Item Type of (Item being manipulated) = Town Portal
-Actions
--Set ownerTP[Player Number of (Owner of (Hero Manipulating Item))] = (Owner of (Hero Manipulating Item))
--Set victimTP[Player Number of(ownerTP)] = (hmm, not sure how you'd get this guy. Look up on it. I'm guessing change it to an Issued Order event, then find the targeted object.)
--Set casterTP[Player Number of(ownerTP)] = Hero Manipulating Item
--If/Then/Else
---Conditions
----ownerTP[Player Number of (ownerTP)] is an Enemy of victimTP[Player Number of(OwnerTP)] = True
---Then
----Unit Group - Pick every unit in (Units within 700.00 of Unit - Position of (casterTP) matching (((Matching unit) is in (Units owned by OwnerTP[Player Number of (Owner of TP)])) Equal to True)) and do (Unit - Remove (Picked unit) from the game)
----ownerTP[Player Number of (OwnerTp)] = Null
---Else
----Wait 120.00 seconds
----ownerTP[Player Number of (OwnerTP)] = Null

Quote:
Betrayed
-Events
--Player 1 <Red> Changes (Alliance (Non-Aggression)) settings
-Conditions
--OwnerTP[player number of (Triggering Player)] is an enemy of victimTP[player number of (Triggering Player])
-Actions
--Unit Group - Pick every unit in (Units within 700.00 of Unit - Position of (casterTP) matching (((Matching unit) is in (Units owned by OwnerTP[Player Number of (Owner of TP)])) Equal to True)) and do (Unit - Remove (Picked unit) from the game)
--OwnerTP[Player Number of (Triggering Player] = Null

That should remove any units after an alliance change or with a prior alliance change as long as it's within 120 seconds, you can remove that requirement.
09-20-2005, 12:55 AM#6
MrApples
:wtf: what was ^that^ about, see my corrections.
Answer:
It won't remove units if they are still allied.

If - Conditions
(OwnerTP is giving VictimTP Alliance (non-aggression)) Equal to False
Then - Actions


Ok, but that is the problem, the first one you saw(Target unit of ability being cast). Because i have one that works with Mass Teleport.

Since I can't use Target Unit of ability being cast how else could this be done.

Ok, i've read your solution, looks like it will work. (the remove action on the first trigger is pointless since someone won't be able to unally within the time period of how long it takes for the game to run the trigger.)

But what does null mean?

Also the original trigger crashes the players sometimes about a minute after the action is performed(NOT SURE IF THEY LEFT oR NOT), or while exiting. Does yours fix that?
09-20-2005, 06:27 PM#7
drdlord
It was crashing as the trigger was continuing 120.00 game-time seconds after being called. If anything changed, (the player leaves, the global variables have new values etc) then it can cause random results, (ie crash, bugs etc) that's why he was using the array, (but even that fails if a single player uses another town portal too soon after the first one)

2 solutions, a queue, (array with counter variable as index not player num) or local variables.

ether solution will need to check the player is still playing just after the wait.

null is a way to note your done with the variable, it can somtimes prevent leaks, (but you need to destroy the object first I think)
09-20-2005, 07:14 PM#8
Gandalf2349
Yes, that is why I did the variables, but I did not use local variables, because you need them to be global to interact with the other trigger.

What my trigger is doing is it will check if they are unallied, and if they are then removes the units, and set's the variables back to null, or No Player, Nothing etc.

My second trigger detects whenever a player switches their alliance settings. If they unally someone it checks if they have used a town portal on the person they just unallied, now if it is after 120 seconds that variable will have been reset, so it won't register. You can always remove that clause, but I put it there because that's what I interpreted you wanted to do in your trigger.

If they use another town portal in that period of time, the remove will only hone in on the most recent one.

Also I just realized right now, it will only destroy the units that are in the radius at the time of the unallying. What you want to do is make another arrayed variable of a type unit group, and save all the units into that with the index of the player just like i've done for all the other variables. Then when it comes time to remove them, just use that unit group.

The only way I see you could use local variables is a Wait for Condition action. That's messy coding, but it could make your trigger more functional, but you would have more going on in the backround. If you wanted to use it you would change your code to something like this:


Quote:
Variables
-ownerTP as Player
-victimTP as Player
-casterTP as Player
-unitGroupTP as Unit Group
Quote:
TPed (<---hmmm, coincidence? i think not)
-Events
--A Unit Uses an Item
-Conditions
--(Item Type of (Item being manipulated) = Town Portal
-Actions
--Custom Script: local player udg_OwnerTP
--Custom Script: local player udg_victimTP
--Custom Script: local unit udg_casterTP
--Custom Script: local group udg_unitGroupTP
--Set ownerTP = (Owner of (Hero Manipulating Item))
--Set victimTP = ???
--Set casterTP = Hero Manipulating Item
--Pick Every Unit within (700.00) of casterTP and matching condition (Owner of (Picked Unit)) = ownerTP
---Actions
----Unit Group - Add (Picked Unit) to unitGroupTP
--Wait for Condition ((ownerTP[Player Number of (ownerTP)] is an Enemy of victimTP[Player Number of(OwnerTP)] = True) Checking every 1.00 seconds
--Unit Group - Pick every unit in (Units within 700.00 of Unit - Position of (casterTP) matching (((Matching unit) is in (Units owned by OwnerTP[Player Number of (Owner of TP)])) Equal to True)) and do (Unit - Remove (Picked unit) from the game)
--ownerTP = No Player
--victimTP = No Player
--casterTP = No Unit
--unitGroupTP = No Unit Group

Thats cleaner and will annhialate any unallying forces, but for every TP cast you will always have that trigger in the backround running once every second. You may want to consider making it once every 2 seconds just to reduce lag.

Then you have the problem of the other player. I was thinking about it, and I think you could ammend it to find the closest unallied unit to your caster unit and then just use that as the vitim.

Quote:
Variables
-ownerTP as Player
-victimTP as Player
-casterTP as Player
-unitGroupTP as Unit Group
-DistanceReal as Real
-DistanceUnit as Unit
Quote:
TPed (<---hmmm, coincidence? i think not)
-Events
--A Unit Uses an Item
-Conditions
--(Item Type of (Item being manipulated) = Town Portal
-Actions
--Custom Script: local player udg_OwnerTP
--Custom Script: local player udg_victimTP
--Custom Script: local unit udg_casterTP
--Custom Script: local group udg_unitGroupTP
--Custom Script: local real udg_DistanceReal
--Custom Script: local unit udg_DistanceUnit
--Set ownerTP = (Owner of (Hero Manipulating Item))
--Set DistanceReal = 701.00
--Pick Every Unit within (700.00) of (Casting Unit) matching (Owner of (Matching Unit) does not = ownerTP) and do (Actions)
---Actions
----If/Then/Else
-----Conditions
------Math - Distance from (Position of (Casting Unit)) to (Position of (Picked Unit)) < DistanceReal
-----Actions
------Set DistanceReal = (Math - Distance from (Position of (Casting Unit)) to (Position of (Picked Unit))
------Set DistanceUnit = Picked Unit
--Set victimTP = (Owner of (DistanceUnit))
--Set casterTP = Hero Manipulating Item
--Pick Every Unit within (700.00) of casterTP and matching condition (Owner of (Matching)) = ownerTP
---Actions
----Unit Group - Add (Picked Unit) to unitGroupTP
--Wait for Condition ((ownerTP[Player Number of (ownerTP)] is an Enemy of victimTP[Player Number of(OwnerTP)] = True) Checking every 1.00 seconds
--Unit Group - Pick every unit in (Units within 700.00 of Unit - Position of (casterTP) matching (((Matching unit) is in (Units owned by OwnerTP[Player Number of (Owner of TP)])) Equal to True)) and do (Unit - Remove (Picked unit) from the game)
--ownerTP = No Player
--victimTP = No Player
--casterTP = No Unit
--unitGroupTP = No Unit Group
09-20-2005, 08:46 PM#9
MrApples
If I use the closest unallied unit to the casting unit as the victim, wouldn't it need for the victim to actually be set before the unallying occurs so it can check if they are unallied.

Also can't just detect to see if the OwnerTP unallys because he might have TPed to help the person instead of unally(as in unallying on someone who is already attacking).


How would I detect this "checks if they have used a town portal on the person they just unallied"
09-21-2005, 03:43 AM#10
yuripro84
couldnt you just do this?

Quote:
Elapsed Game Time is 1 sec

No Conditions

Start Timer (Check) as a repeating timer that expires every .5 secs

Quote:
When Timer (Check) expires

No Conditions

Pick every unit in region (base) matching unit is ally of (players color) equal to false and remove picked unit

Then do this for all players, im pretty sure this wont crash or anything, and isnt really that hard to add. There might be an easier way, but im tired, and i thought of this in like 1 min, lol, so gl

*The cow flies high at night*
09-21-2005, 08:37 PM#11
MrApples
I can tell you thought about it in 1 minute.
09-22-2005, 07:29 PM#12
Gandalf2349
Quote:
Originally Posted by MrApples
If I use the closest unallied unit to the casting unit as the victim, wouldn't it need for the victim to actually be set before the unallying occurs so it can check if they are unallied.

Also can't just detect to see if the OwnerTP unallys because he might have TPed to help the person instead of unally(as in unallying on someone who is already attacking).


How would I detect this "checks if they have used a town portal on the person they just unallied"

What my version is doing is checking every unit that is not owned by the TPing player, and whichever one is closest is used as the victim. It's not 100% accurate, but should suffice..

Quote:
couldnt you just do this?


Elapsed Game Time is 1 sec

No Conditions

Start Timer (Check) as a repeating timer that expires every .5 secs



When Timer (Check) expires

No Conditions

Pick every unit in region (base) matching unit is ally of (players color) equal to false and remove picked unit


Then do this for all players, im pretty sure this wont crash or anything, and isnt really that hard to add. There might be an easier way, but im tired, and i thought of this in like 1 min, lol, so gl

*The cow flies high at night*

That is if you're not allowed in their base period. This way you could walk into their base but not TP there. Same reasoning why you can slip through a shield slowly, but not shoot it with a las-gun.


Damn you people. Use periodic evnets as a last resort!!!!!

Quote:
Event
-Unit - A Unit enters (Region Red <gen>)
Conditions
-Owner of (Entering Unit) Is an Ally of (Player 1 <Red>) = False
Actions
-Unit - Explode (Entering Unit)
09-22-2005, 08:33 PM#13
MrApples
Does the teleporting hero end up in the middle after a teleport?
09-22-2005, 11:53 PM#14
Gandalf2349
I'm not sure, but I thought so. Test it.

Put a level 10 archmage out there, and have a trigger so that when he goes, it puts up a floating text 'o' where the center is.
09-24-2005, 12:09 AM#15
MrApples
Set ownerTP = (Owner of (Hero Manipulating Item))

I can't do this because OwnerTP has to be Array?