• 0

    posted a message on Variable Organization

    Awesome, thank you! I'll definitely look into them.

    Posted in: Triggers
  • 0

    posted a message on Variable Organization

    Hi Mapster! I'm working on an RPG where your character can freely switch between a number of different classes. In order to store which class the player currently has selected, I'm using an integer variable. Is there a better way to organize it, so that I don't have to remember which number corresponds to which class? Maybe a different variable type, or a way to give a name to each integer? Thanks!

    Posted in: Triggers
  • 0

    posted a message on [Trigger] Switching unit control

    Thank you so much for the help! The editor sure can be a bit temperamental at times, can't it? =)

    I was able to successfully implement your system into my map, and, after toying around with it for a bit, was able to apply your cleaner if/then model to several of my other triggers! This will definitely save me a ton of time and effort.

    Thanks once again!

    Posted in: Triggers
  • 0

    posted a message on [Trigger] Switching unit control

    I've got a trigger that isn't working the way I would like it to. My goal is to have 3 units, one owned by player 1, the other two owned by player 2 (a computer). When player one presses the tab key, it cycles to another unit, so player 1 now controls one of the units previously controlled by player 2, and player 2 gets control of the unit previously owned by player 1. Here is how I set up the triggers:

    Spawn Characters
        Events
            Game - Map initialization
        Local Variables
        Conditions
        Actions
            Player - Make player 1 and player 2 treat each other as Ally With Shared Vision
            Unit - Create 1 Zealot for player 1 at Character Spawn facing 90.0 degrees (No Options)
            Variable - Set Party Member[0] = (Last created unit)
            Variable - Set Main Character = (Last created unit)
            Unit - Create 1 Ghost for player 1 at (Character Spawn offset by 2.5 towards 240.0 degrees) facing 90.0 degrees (No Options)
            Variable - Set Party Member[1] = (Last created unit)
            Unit - Create 1 High Templar for player 1 at (Character Spawn offset by 2.5 towards 300.0 degrees) facing 90.0 degrees (No Options)
            Variable - Set Party Member[2] = (Last created unit)
            Unit - Change ownership of Party Member[1] to player 2 and Retain Color
            Unit - Change ownership of Party Member[1] to player 2 and Retain Color
    
    Main Character Switch 0 to 1
        Events
            UI - Player 1 presses Tab key Up with shift Allow, control Allow, alt Allow
        Local Variables
        Conditions
            Party Member[0] == Main Character
        Actions
            Unit - Change ownership of Party Member[1] to player 1 and Retain Color
            Unit - Change ownership of Party Member[0] to player 2 and Retain Color
            Variable - Set Main Character = Party Member[1]
    
    Main Character Switch 1 to 2
        Events
            UI - Player 1 presses Tab key Up with shift Allow, control Allow, alt Allow
        Local Variables
        Conditions
            Party Member[1] == Main Character
        Actions
            Unit - Change ownership of Party Member[2] to player 1 and Retain Color
            Unit - Change ownership of Party Member[1] to player 2 and Retain Color
            Variable - Set Main Character = Party Member[2]
    
    Main Character Switch 2 to 0
        Events
            UI - Player 1 presses Tab key Up with shift Allow, control Allow, alt Allow
        Local Variables
        Conditions
            Party Member[2] == Main Character
        Actions
            Unit - Change ownership of Party Member[0] to player 1 and Retain Color
            Unit - Change ownership of Party Member[2] to player 2 and Retain Color
            Variable - Set Main Character = Party Member[0]
    

    If I initialize Party Member[0] as the Main Character, pressing tab will do absolutely nothing. If I initialize either Party Member[1] or Party Member[2] as the Main Character, with player 1 having control over them right off the bat instead of Party Member [0], pressing tab will always switch control to Party Member [0] and further presses will do nothing. I can't see any problems with my triggers, but it is late, so another pair of eyes would definitely help.

    What I have tried so far: Using the "z" button instead of Tab. Creating a trigger to confirm that the Main Character and Party Member[#] variables are being properly assigned. Using an "(Owner of Party Member[#]) == 1" condition instead of the "Party Member[#] == Main Character" condition

    None of these changes had an effect on the result.

    Thanks in advance for the help!

    Posted in: Triggers
  • To post a comment, please or register a new account.