HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

why doesn't this work?

02-06-2006, 03:18 AM#1
Linera
Why doesn't this move the unit selected by the player who typed the command to his hero?

Code:
    Events
        Player - Player 1 (Red) types a chat message containing -gm move as An exact match
        Player - Player 2 (Blue) types a chat message containing -gm move as An exact match
        Player - Player 3 (Teal) types a chat message containing -gm move as An exact match
        Player - Player 4 (Purple) types a chat message containing -gm move as An exact match
        Player - Player 5 (Yellow) types a chat message containing -gm move as An exact match
        Player - Player 6 (Orange) types a chat message containing -gm move as An exact match
        Player - Player 7 (Green) types a chat message containing -gm move as An exact match
        Player - Player 8 (Pink) types a chat message containing -gm move as An exact match
        Player - Player 9 (Gray) types a chat message containing -gm move as An exact match
        Player - Player 10 (Light Blue) types a chat message containing -gm move as An exact match
    Conditions
        (Length of (Entered chat string)) Equal to 8
        GMaccess[(Player number of (Triggering player))] Equal to True
        Or - Any (Conditions) are true
            Conditions
                (Name of (Triggering player)) Equal to Linera
    Actions
        Set SelectedUnit[(Player number of (Triggering player))] = (First unit of group (Units currently selected by (Triggering player)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (First unit of group (Units currently selected by (Triggering player)))) controller) Equal to User
                (Owner of (First unit of group (Units currently selected by (Triggering player)))) Not equal to (Triggering player)
            Then - Actions
                Unit - Move (First unit of group (Units currently selected by (Triggering player))) instantly to (Position of (First unit of group (Units owned by (Triggering player))))
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Owner of (First unit of group (Units currently selected by (Triggering player)))) Equal to (Triggering player)
            Then - Actions
                Game - Display to (Player group((Triggering player))) the text: You must select ano...
            Else - Actions
                Do nothing
02-06-2006, 12:34 PM#2
Vexorian
Arg GUI is awful.

First of all you are setting that variable for err, no reason at all? Shouldn't you be using that variable in the checks so it doesn't call (Units currectly selected by Player) a lot of times?

You are checking for the length of the entered chat string to be 8, but you are already using Exact match in the event so that's unnecessary.

For some reason you used OR for just one condition? that is the same as not using OR at all. I actually think that you wanted the OR to effect all the conditions:

Trigger:
Collapse Events
Player - Player 1 (Red) types a chat message containing -gm move as An exact match
Player - Player 2 (Blue) types a chat message containing -gm move as An exact match
Player - Player 3 (Teal) types a chat message containing -gm move as An exact match
Player - Player 4 (Purple) types a chat message containing -gm move as An exact match
Player - Player 5 (Yellow) types a chat message containing -gm move as An exact match
Player - Player 6 (Orange) types a chat message containing -gm move as An exact match
Player - Player 7 (Green) types a chat message containing -gm move as An exact match
Player - Player 8 (Pink) types a chat message containing -gm move as An exact match
Player - Player 9 (Gray) types a chat message containing -gm move as An exact match
Player - Player 10 (Light Blue) types a chat message containing -gm move as An exact match
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Length of (Entered chat string)) Equal to 8
GMaccess[(Player number of (Triggering player))] Equal to True
(Name of (Triggering player)) Equal to Linera
Collapse Actions
Set SelectedUnit[(Player number of (Triggering player))] = (First unit of group (Units currently selected by (Triggering player)))
Set SelectedOwner = Owner of (SelectedUnit[(Player number of (Triggering player))] )
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((SelectedOwner) controller) Equal to User
(SelectedOwner) Not equal to (Triggering player)
Collapse Then - Actions
Unit - Move (SelectedUnit[(Player number of (Triggering player))]) instantly to (Position of (First unit of group (Units owned by (Triggering player))))
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(SelectedOwner) Equal to (Triggering player)
Collapse Then - Actions
Game - Display to (Player group((Triggering player))) the text: You must select ano...
Collapse Else - Actions
Do nothing

And please use [trigger] tags next time
02-06-2006, 04:42 PM#3
Linera
I noticed you set the conditions wrong according to how i need them but thats ok i just used the actions.

Now it works perfectly