• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger help please ( not rookie )

Status
Not open for further replies.
Level 3
Joined
Jan 18, 2012
Messages
26
So i am trying to make a trigger that prevents Players from Un-Allying the target player for 3 minutes, after Teleporting to Target's Main Hall. I tried making my system which should work but wont work for some reason, id like to know why... Take a look:
  • First teleport declare
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Item Town Portal
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Not equal to (Owner of (Target unit of ability being cast))
        • Then - Actions
          • Set OwnerOfTeleUnit[1] = (Owner of (Triggering unit))
          • Set OwnerOfTownHall[1] = (Owner of (Target unit of ability being cast))
          • Trigger - Run First Teleport declare activat <gen> (ignoring conditions)
          • Trigger - Turn on Second teleport declare <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • First Teleport declare activat
    • Events
    • Conditions
    • Actions
      • Trigger - Turn on First Teleport declae 2 <gen>
      • Wait 180.00 seconds
      • Trigger - Turn off First Teleport declae 2 <gen>
  • First Teleport declae 2
    • Events
      • Player - Player 1 (Red) changes Alliance (non-aggression) settings
      • Player - Player 2 (Blue) changes Alliance (non-aggression) settings
      • Player - Player 3 (Teal) changes Alliance (non-aggression) settings
      • Player - Player 4 (Purple) changes Alliance (non-aggression) settings
      • Player - Player 5 (Yellow) changes Alliance (non-aggression) settings
      • Player - Player 6 (Orange) changes Alliance (non-aggression) settings
      • Player - Player 7 (Green) changes Alliance (non-aggression) settings
      • Player - Player 8 (Pink) changes Alliance (non-aggression) settings
      • Player - Player 9 (Gray) changes Alliance (non-aggression) settings
      • Player - Player 10 (Light Blue) changes Alliance (non-aggression) settings
      • Player - Player 11 (Dark Green) changes Alliance (non-aggression) settings
      • Player - Player 12 (Brown) changes Alliance (non-aggression) settings
    • Conditions
      • (Triggering player) Equal to OwnerOfTeleUnit[1]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) is an enemy of OwnerOfTownHall[1]) Equal to True
        • Then - Actions
          • Player - Make OwnerOfTownHall[1] treat OwnerOfTeleUnit[1] as an Ally
          • Player - Make OwnerOfTeleUnit[1] treat OwnerOfTownHall[1] as an Ally
        • Else - Actions
I use Arrays because There are 12 of those triggers repeated ( because theres gonna be more than 1 teleport in 3 minutes )
The Trigger: Trigger - Turn on Second teleport declare <gen> . is what activates the next triggerl.

Please help, My map really needs this system , as there are rules in this map which ppl often break, One of them is Teleporting to ally's base and Declaring war to them... need to prevent that . Map is called : World War ][][][ New Tun. #000 ( true name: World War 3 Tundra Revisited )
 
Level 3
Joined
Jan 31, 2012
Messages
42
JASS:
//! zinc
library PreventWar {
    //! textmacro PreventWar_Ability
        'A000'
    //! endtextmacro
    //! textmacro PreventWar_Time
        180.
    //! endtextmacro

    player P[ ];
    timer  T[ ];

    function onInit() {
        trigger cast = CreateTrigger(), war = CreateTrigger();
        integer i = 0;
        do {
            TriggerRegisterPlayerUnitEvent(cast, Player(i), EVENT_PLAYER_UNIT_SPELL_CHANNEL, null);
            TriggerRegisterPlayerAllianceChange(war, Player(i), ALLIANCE_PASSIVE);
            T[i] = CreateTimer();
            i = i + 1;
        } while (i < 12);
        TriggerAddCondition(cast,
            function() -> boolean {
                return GetSpellAbilityId() ==
                    //! runtextmacro PreventWar_Ability()
                ;
            }
        );
        TriggerAddAction(cast,
            function() {
                player p = GetOwningPlayer(GetTriggerUnit()), p2 = GetOwningPlayer(GetSpellTargetUnit());
                integer id;
                if (p != p2) {
                    id = GetPlayerId(p);
                    P[id] = p2;
                    TimerStart(T[id],
                        //! runtextmacro PreventWar_Time()
                    , false, null);
                }
                p = null; p2 = null;
            }
        );
        TriggerAddAction(war,
            function() {
                player p = GetTriggerPlayer();
                integer id = GetPlayerId(p);
                if (TimerGetRemaining(T[id]) > .0) {
                    SetPlayerAlliance(p, P[id], ALLIANCE_PASSIVE, true);
                    SetPlayerAlliance(p, P[id], ALLIANCE_HELP_REQUEST, true);
                    SetPlayerAlliance(p, P[id], ALLIANCE_HELP_RESPONSE, true);
                    SetPlayerAlliance(p, P[id], ALLIANCE_SHARED_XP, true);
                    SetPlayerAlliance(p, P[id], ALLIANCE_SHARED_SPELLS, true);
                    SetPlayerAlliance(p, P[id], ALLIANCE_SHARED_VISION, false);
                    SetPlayerAlliance(p, P[id], ALLIANCE_SHARED_CONTROL, false);
                    SetPlayerAlliance(p, P[id], ALLIANCE_SHARED_ADVANCED_CONTROL, false);
                }
                p = null;
            }
        );
        cast = null; war = null;
    }
}
//! endzinc
 
Level 3
Joined
Jan 18, 2012
Messages
26
Thanks to both of you guys for the replys, Tho i didnt use the jass yet and i think it wont be needed if the Maker's idea will work ( which im making right now ) ( though need to test before i could say if it works ) I think i got the help i needed and i can do it on my own now, THANKS AGAIN! Both of your names will be on the Credits area on the next version of my map World War ][][][ Tundra Revisited v7.5 .
 
Status
Not open for further replies.
Top