HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Anti Teleport Trigger

11-05-2005, 04:27 PM#1
MrApples3
OK, I know I posted this before and I said I finished it, well for some reason it just stopped working. See post at http://www.wc3campaigns.com/thread_view.php?t=77877. Well since I cant edit that post because I cant login to that account, I gotta repost.

The Anti Teleport is supposed to remove all teleported units if someone teleports into another persons base and unallies.

The Trigger Now
Code:
TPAnti Item
    Events
        Unit - A unit Uses an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to Scroll of Town Portal
    Actions
        Wait 5.01 game-time seconds
        Set TempPoint = (Position of (Triggering unit))
        Set TPGroup = (Units within 700.00 of TempPoint matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is in (Units owned by (Owner of (Triggering unit)))) Equal to True)))
        Set TPOwner = (Owner of (Triggering unit))
        Set TempUnitGroup = (Units within 400.00 of TempPoint matching (((Matching unit) is A town-hall-type unit) Equal to True))
        Unit Group - Pick every unit in TempUnitGroup and do (Actions)
            Loop - Actions
                Set TPVictim = (Owner of (Picked unit))
        Trigger - Run TPReset <gen> (ignoring conditions)
        Custom script:   call DestroyGroup(udg_TempUnitGroup)
        Custom script:   call RemoveLocation(udg_TempPoint)

Code:
TPAnti Spell
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Mass Teleport
    Actions
        Set TempPoint = (Position of (Casting unit))
        Set TPGroup = (Units within 700.00 of TempPoint matching ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is in (Units owned by (Owner of (Casting unit)))) Equal to True)))
        Set TPOwner = (Owner of (Casting unit))
        Set TPVictim = (Owner of (Target unit of ability being cast))
        Trigger - Run TPReset <gen> (ignoring conditions)
        Custom script:   call DestroyGroup(udg_TempUnitGroup)
        Custom script:   call RemoveLocation(udg_TempPoint)
Code:
TPReset
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TPOwner Equal to TPVictim
            Then - Actions
                Custom script:   call DestroyGroup(udg_TPGroup)
                Set TPOwner = Player_NONE
                Set TPVictim = Player_NONE
            Else - Actions
                Wait 120.00 game-time seconds
                Custom script:   call DestroyGroup(udg_TPGroup)
                Set TPOwner = Player_NONE
                Set TPVictim = Player_NONE
NOTE, THERE ARE 11 MORE OF THE NEXT TRIGGER FOR EACH PLAYER, I HIGHLITED THE ACTUAL ANTI TP PART IN BOLD
Code:
Declare War 1
    Events
        Player - Player 1 (Red) changes alliance settings
    Conditions
    Actions
        [b]Set Instagator = Player 1 (Red)
        Set TempPlayerGroup = (All players matching ((Instagator is giving (Matching player) Alliance (non-aggression)) Equal to False))[/b]
        Player Group - Pick every player in TempPlayerGroup and do (If (((Picked player) is giving Instagator Alliance (non-aggression)) Equal to True) then do (Set TempPlayer = (Picked player)) else do (Do nothing))
        [b]Player Group - Pick every player in TempPlayerGroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Instagator Equal to TPOwner
                        ((Picked player) is giving Instagator Alliance (non-aggression)) Equal to True
                        (Picked player) Equal to TPVictim
                    Then - Actions
                        Game - Display to (All players) for 30.00 seconds the text: ANTI TP: The act of...
                        Unit Group - Pick every unit in TPGroup and do (Actions)
                            Loop - Actions
                                Unit - Remove (Picked unit) from the game
                    Else - Actions
                        Do nothing[/b]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Alliance_Number[(Player number of TempPlayer)] Equal to (Player number of Instagator)
            Then - Actions
                Player - Make Instagator treat TempPlayer as an Ally with shared vision
                Custom script:   call DestroyForce(udg_TempPlayerGroup)
            Else - Actions
                Trigger - Run Turn Off <gen> (ignoring conditions)
                Set PlayerName = (Colors[(Player number of Instagator)] + ((Name of Instagator) + |r))
                Player Group - Pick every player in TempPlayerGroup and do (If (((Picked player) is giving Instagator Alliance (non-aggression)) Equal to True) then do (Game - Display to (Player group((Picked player))) for 10.00 seconds the text: (PlayerName +  has declared war against you!)) else do (Do nothing))
                Player Group - Pick every player in TempPlayerGroup and do (If (((Picked player) is giving Instagator Alliance (non-aggression)) Equal to True) then do (Player - Make (Picked player) treat Instagator as an Enemy) else do (Do nothing))
                Custom script:   call DestroyForce(udg_TempPlayerGroup)
                Trigger - Run Turn On <gen> (ignoring conditions)
EDIT: Bold isn't allowed in code?
Set Instagator = Player 1 (Red)
Set TempPlayerGroup = (All players matching ((Instagator is giving (Matching player) Alliance (non-aggression)) Equal to False))

Player Group - Pick every player in TempPlayerGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Instagator Equal to TPOwner
((Picked player) is giving Instagator Alliance (non-aggression)) Equal to True
(Picked player) Equal to TPVictim
Then - Actions
Game - Display to (All players) for 30.00 seconds the text: ANTI TP: The act of...
Unit Group - Pick every unit in TPGroup and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game
Else - Actions
Do nothing
11-07-2005, 11:27 PM#2
MrApples3
I had the trigger working, then it just stopped. I dont know why.
11-16-2005, 01:58 PM#3
MrApples3
Ok, is there any known problem that triggers would just stop working after a save or etc?
11-18-2005, 09:14 PM#4
MrApples3
SOmeone please post just so I know im not the only one who sees this?
11-18-2005, 11:28 PM#5
Mystic Prophet
I can see it just fine. The mostly likely reason why you're not getting a response is because there aren't very many people who can help you.

Shoot I'm still having trouble with making a few stat based spells.
11-19-2005, 01:51 AM#6
tassadar920
You don't need 12 of those, just put 12 events in and set the "Set instagtor" line to be equal to the triggering player :P.

I can't see any problems in the first two they seem simple and look like they work fine. With one exception, I didn't know Mass Teleport had to traget a unit? I didn't even think the ability targeted units. I also don't like you 120 second TPReset thing... that doesn't make sense.

Mostly they all make sense... You may want to add debug lines (little game-text lines that display what's going on, such as what unit is about to be killed etc), they could help isolate the problem.
11-19-2005, 04:23 PM#7
MrApples3
Triggering Player does not work with PLayer changes alliance settings

The TPReset is so it only works if a player unallies within 2 minutes.

Its just that I had it working perfectly, then it just stopped for no reason after I saved it.