HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Dialog - interget multy player problem

02-06-2005, 07:44 PM#1
HEZZA
In my map, u customise your hero through dialogs, and im not a newbie to dialogs ive wrote a tutorial on how to do them, its not the dialog im having trouble with but a strange problem

in one of the sets of dialogs your hero has 20 stat points (20 intergers) and he can assin a stat point to a stat attribute by clicking on a dialog say strenght for example.

this all works well single player, but not multiplayer. Ive done it so theres one interger variable:
STATsplayer[7] its 7 because there are 8 players, and i have the value at 0 because i set it through triggers.

Im not goign to post up the triggers or put it in a map to show, beecause im trying to avoid doing so.
02-06-2005, 07:50 PM#2
Tommi
I don't think we can help you without the code. And you didn't tell us how it did not work.
02-06-2005, 07:57 PM#3
HEZZA
Ok but i hate seing these posts with relelentless code which fills the page so ill just show u two players instead of all 8.

Whats its supposed to do

A player would click either ;strenght, agility or intelligence on a dialog option and a interget would be deducted from that players assigned interget variable so:
player one would be - STATSunits[0]
Player twos would be - STATSunits[1]

etc, when the interger reaches 0 it moves onto the next dialog.

What happens?
It will work for player one but not for anyone else.

Heres the code: this is the example respons for the button STRENGHT for example

Code:
Strength
    Events
        Dialog - A dialog button is clicked for dialogSETUP_TEST[0]
    Conditions
        (Clicked dialog button) Equal to CHARdiabut_TEST[0]
        Or - Any (Conditions) are true
            Conditions
                STATSPlayer[1] Not equal to 0
                STATSPlayer[0] Not equal to 0
                STATSPlayer[2] Not equal to 0
                STATSPlayer[3] Not equal to 0
                STATSPlayer[5] Not equal to 0
                STATSPlayer[4] Not equal to 0
                STATSPlayer[7] Not equal to 0
                STATSPlayer[6] Not equal to 0
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Triggering player) Equal to Player 1 (Red)
            Then - Actions
                Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
                    Loop - Actions
                        Hero - Set Strength of(Picked unit) to ((Strength of (Picked unit) (Exclude bonuses)) + 1), (Permanent or Temporary:Permanent)
                Set STATSPlayer[0] = (STATSPlayer[0] - 1)
                Game - Display to Player Group - Player 1 (Red) for 10.00 seconds the text: (Points Remaining:  + (String((STATSPlayer[0] - 1))))
                Wait 1.00 seconds
                Dialog - Show dialogSETUP_TEST[0] for Player 1 (Red)
            Else - Actions
                Dialog - Hide dialogSETUP_TEST[0] for Player 1 (Red)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Triggering player) Equal to Player 2 (Blue)
            Then - Actions
                Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
                    Loop - Actions
                        Hero - Set Strength of(Picked unit) to ((Strength of (Picked unit) (Exclude bonuses)) + 1), (Permanent or Temporary:Permanent)
                Set STATSPlayer[1] = (STATSPlayer[1] - 1)
                Game - Display to Player Group - Player 2 (Blue) for 10.00 seconds the text: (Points Remaining:  + (String((STATSPlayer[1] - 1))))
                Wait 1.00 seconds
                Dialog - Show dialogSETUP_TEST[0] for Player 2 (Blue)
            Else - Actions
                Dialog - Hide dialogSETUP_TEST[0] for Player 2 (Blue)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)

notice its only for player one and two, theres are 8 players all in all but i dont need to reveal the whole code
02-06-2005, 09:07 PM#4
Vexorian
Are you setting the array's initial value for all the 8 indexes?
02-06-2005, 09:20 PM#5
HEZZA
Yes i set it at the very start of the game so all values are 20, and if that slots not used, the relivant players value will be set to 0.
02-06-2005, 10:17 PM#6
ThyFlame
Test it in multiplayer, not single player mode.

You're always player one in single player.
02-07-2005, 07:42 AM#7
logik
why not use a loop?

for each integer A to what ever.


and you can also do something like player(player number of triggering player)

that should help clear up the code... and make it easier to see and sort out.
02-07-2005, 07:45 AM#8
HEZZA
mmm dont think u can as the interger variables arent set to a player number, there just set manually. if u know what i mean
02-07-2005, 08:09 AM#9
Tommi
How do you create the dialog?

I usually use separate dialogs for every player, since every time I create a dialog I need to change texts on buttons (and the number of buttons may vary). If I used the same dialog for every player, other players' dialogs would be affected, when I created the dialog for one player.

Also, I've seen cases when creating dialog buttons only once for a dialog won't work. Instead, you need to create dialog buttons just before opening the dialog.
02-07-2005, 08:27 AM#10
HEZZA
The system i use makes it so u can use one dialog and a set of buttons for all players. Its very simple and its very easy to trace errors, this has nothing to do with the dialog its all about my interger.

if u want ill tell u how to do it.

EDIT: i have to go to school now so ill reply later
02-07-2005, 08:35 AM#11
Tommi
Sure, I would like to hear how to do that with a single dialog.
02-07-2005, 03:06 PM#12
HEZZA
Well ive done it with one dialog and just cleared it every time i want a new set of options, but its less complicated if u create it with an array.

Btw before i start righting it up, i want to make one thing clear:
This system of mine does:
-use one dialog variable with mutlple arrays (each array represents a different set of options
-Allows it so one dialog can be used for all players responses

This system of mine does not:
-use a dialog for each indivual player :P
02-07-2005, 03:10 PM#13
Tommi
How have you solved the problem that when you clear the dialog for one player, it clears itself for all players? That is, if many players have the same dialog open at the same time?
02-07-2005, 03:22 PM#14
HEZZA
Ok First off this is my map btw so ill cut out all the additional functionals, i start off with one trigger, the setup of the dialogs. Ill show u just a basic one for now as youll get the idea.

Before you begin:
-Create one dialog variable call it dialogSETUP, and give it an array of how many sets of options you want, mine has an array of 8, because i have 9 sets of options. But ill just show u these
-Create a set of buttons to match your corresponding dialog, since this part of my dialog is choosing the hero it has CHARdiabut, (diabut just means dialog button, my abreivation and CHAR means character). Set that to how many options you want to be in, i set mine to 4. Because there are 5 options.

Code:
E: Map Init
C: N/A
A:
    Dialog - Change the title of dialogSETUP[1] to Choose your Hero
    Dialog - Create a dialog button for dialogSETUP[3] labelled Summoner
    Set CHARdiabut[0] = (Last created dialog Button)
    Dialog - Create a dialog button for dialogSETUP[3] labelled Assasin
    Set CHARdiabut[1] = (Last created dialog Button)
    Dialog - Create a dialog button for dialogSETUP[3] labelled Nether Mage
    Set CHARdiabut[2] = (Last created dialog Button)
    Dialog - Create a dialog button for dialogSETUP[3] labelled Paladin
    Set CHARdiabut[3] = (Last created dialog Button)
    Dialog - Create a dialog button for dialogSETUP[3] labelled Troll Lord
    Set CHARdiabut[4] = (Last created dialog Button)
    Wait 0.50 seconds
        Player Group - Pick every player in (All players) and do (Dialog - Show dialogSETUP[1] for (Picked player))
    Wait 16.00 seconds
    Sound - Play SuccubusPissed6 <gen>

Ok the 16 second wait is because i had a countdown timer in there. so just ignore that.

Now you have that you want the response, people say its alot easier to use For interger A commands, but ive used these before and they collide with each other. Dont listen to them i say :).

Where going to use a set of If - then - else - multiple action functions to do this trigger. So here we go.
it was original for 8 players but ive cut it down to 3 because it takes up so much room on the post

Code:
E:  Dialog - A dialog button is clicked for dialogSETUP[1]
C:  (Clicked dialog button) Equal to CHARdiabut[0]
A:
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Triggering player) Equal to Player 1 (Red)
            Then - Actions
                Unit Group - Pick every unit in (Units in SETUP <gen> owned by Player 1 (Red)) and do (Actions)
                    Loop - Actions
                        Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: |cff00ffff SUMMONER...
                        Unit - Remove (Picked unit) from the game
                        Unit - Create 1 Elementalist for Player 1 (Red) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
                        Set PlayersUnits[0] = (Last created unit)
                Dialog - Hide dialogSETUP[1] for Player 1 (Red)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Triggering player) Equal to Player 2 (Blue)
            Then - Actions
                Unit Group - Pick every unit in (Units in SETUP <gen> owned by Player 2 (Blue)) and do (Actions)
                    Loop - Actions
                        Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: |cff00ffff SUMMONER...
                        Unit - Remove (Picked unit) from the game
                        Unit - Create 1 Elementalist for Player 2 (Blue) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
                        Set PlayersUnits[1] = (Last created unit)
                Dialog - Hide dialogSETUP[1] for Player 2 (Blue)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Triggering player) Equal to Player 3 (Teal)
            Then - Actions
                Unit Group - Pick every unit in (Units in SETUP <gen> owned by Player 3 (Teal)) and do (Actions)
                    Loop - Actions
                        Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: |cff00ffff SUMMONER...
                        Unit - Remove (Picked unit) from the game
                        Unit - Create 1 Elementalist for Player 3 (Teal) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
                        Set PlayersUnits[2] = (Last created unit)
                Dialog - Hide dialogSETUP[1] for Player 3 (Teal)
            Else - Actions

This is one of the options, i doubt u dont need to see the others as there vary similar.

EXPLINATION

Lets take a look at one of the functions and decapate it for you. Im not suggesting your stupid, im just being dilligent :).

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Triggering player) Equal to Player 1 (Red) - detecting which player is clicking on the dialog so it doesnt effect the others if they choose a different one
Then - Actions
Unit Group - Pick every unit in (Units in SETUP <gen> owned by Player 1 (Red)) and do (Actions)
Loop - Actions
Game - Display to (Player group((Triggering player))) for 30.00 seconds the text: |cff00ffff SUMMONER...
Unit - Remove (Picked unit) from the game
Unit - Create 1 Elementalist for Player 1 (Red) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
Set PlayersUnits[0] = (Last created unit) THE FUNCTIONS
Dialog - Hide dialogSETUP[1] for Player 1 (Red) Since it was player one who clicked it in this case , its also hiding this dialog so he cant pick another one from the same dialog. And since its hiding for him it doesnt effect anyone else still choosing.
Else - Actions - no input needed

Now that is just one player, this allows the players to all choose an option without affecting a dialog window for everyone else.

Mind when you do this, you have to create these functions for EACH option so theres no errors.

Thx for reading.
-HeZzA
02-07-2005, 05:46 PM#15
ThyFlame
Quote:
Originally Posted by HEZZA
mmm dont think u can as the interger variables arent set to a player number, there just set manually. if u know what i mean


No, you can. Since all you've done is copy and paste the same lines of coding without changing them, aside from the player number, you could make a loop for X players, and modify the player number to use Integer A or whatever variable you're using in that loop.