Detecting dialouge button click -1 reply

Please wait...

beier

TFT

50 XP

15th October 2004

0 Uploads

41 Posts

0 Threads

#1 12 years ago

Im trying to make a dialouge for a leader of a team, when one of his team leaves the game. This dialouge should be to assign who should have control.

The dialouge does show as intended, but clicking the button doesn't give me controle. It does if i delete the condition just before giving controle, but this means that every player will get controle regardless of wht button i press.

Keep in mind that in this example i have only written the funcions for creating and detecting Player 1 (red)s button, the others is the same, exept for the player ofc :D

Variabels used

Integer EkstraVariabels[1-100] (Only use 1 here) DialougeShown

Dialouge PlayerLeaveDialouge[1-12]

Dialouge Button LeaveDialougeButton[1-200] (Can only use up to 67 here)

Player Group NotActivePlayers

Player LeaderTeam (The leader is declared elsewhere)

To create the dialouge i have

Events Every 5 seconds

Acrions For each (integer EkstraVariabels[1]) from 1 to 12 do (actions) { If (All conditions are True) then do (then actions) else do (else actions) { Conditions (Player(EkstraVariabels[1]) slot status Not Equal to is playing (Player(EkstraVariabels[1]) is in NotActivePlayers Equal to False

Then Actions Dialouge - Change the titel of PlayerLeaveDialouge[EkstraVariabels[1]] to (Name of (Player(EkstraVariables[1])] + has left the game.

Player group - add (Player(EkstraVariabels[1]) to NotActivePlayers

If (All conditions are True) then do (then actions) else do (else actions) { Conditions (Player 1 (red)) slot status equal to Is Playing

Then actions Dialouge - Create dialouge button for (PlayerLeaveDialouge[EkstraVariables[1]]) labbled (Name of (Player 1(red))

Set LeaveDialogeButton[(((EkstraVariables[1]-1)*6)+1)] = (Last created dialouge button) } Set DialougeShown = EkstraVariables[1] Dialouge - Show PlayerLeaveDialouge[EkstraVariables[1]] for LeaderTeam } }

And when a button is pressed i use

Events Dialouge - A dialouge button is pressed for PlayerLeaveDialouge[1] Dialouge - A dialouge button is pressed for PlayerLeaveDialouge[2] Dialouge - A dialouge button is pressed for PlayerLeaveDialouge[3] Dialouge - A dialouge button is pressed for PlayerLeaveDialouge[4] etc.

Actions Dialouge - Clear PlayerLeaveDialouge[DialougeShown] If (All conditions are True) then do (then actions) else do (else actions) { Conditions (Clicked dialouge button) Equal to LeaveDialougeButton[(((DialougeShown-1)*6)+1)]

Then Actions Make (Player(DialougeShown)) Threat (Player 1 (red)) as an Ally with shared vision and full shared units }

Both triggers are longer, with more players and stuff added to them, but writing it all makes it to long, and i think its irelevant aswell. :uhm:

If it could help, i am willing to send you the map in an email.;)




Eleandor

No User title

50 XP

27th July 2004

0 Uploads

548 Posts

0 Threads

#2 12 years ago

wow what the hell do these numbers refer to? Set LeaveDialogeButton[(((EkstraVariables[1]-1)*6)+1)] = (Last created dialouge button)




beier

TFT

50 XP

15th October 2004

0 Uploads

41 Posts

0 Threads

#3 12 years ago

it is to assign the array of the buttons for each button, using loops

(x-1)*y)+z

x is the number of the player whos dialouge the button is created in

y is the number of buttons i want to be reserved for each dialouge, currently its 6 because thers 5 players on each team, and i want a button to give all players controle.

z is the number of player whos button is created, fx for player 1 red this will be 1

then i can use a funcion like this

Events Time - Every 5 seconds

Actions For each (integer EkstraVariabels[1]) from 1 to 12 do (actions) { If (All conditions are True) then do (then actions) else do (else actions) { Conditions Some conditions, so it doesnt make a dialouge each 5 sec

Then actions For each (integer EkstraVariabels[2]) from 1 to 5 do (actions) { If (All conditions are True) then do (then actions) else do (else actions) { Conditions (Player(EkstraVariabels[2]) slot status Equal to is playing

Then Actions Dialouge - Create dialouge button for (PlayerLeaveDialouge[EkstraVariables[1]]) labbled (Name of (Player(EkstraVariabels[2])

Set LeaveDialogeButton[(((EkstraVariables[1]-1)*6)+ EkstraVariabels[2] = (Last created dialouge button) } } Dialouge - Create dialouge button for (PlayerLeaveDialouge[EkstraVariables[1]]) labbled All Set LeaveDialogeButton[(((EkstraVariables[1]-1)*6)+ 6 = (Last created dialouge button)

Dialouge - Show PlayerLeaveDialouge[EkstraVariables[1]] for "some guy" } }

:D




InnerGemini

Certified Danger to Society

50 XP

23rd October 2004

0 Uploads

61 Posts

0 Threads

#4 12 years ago

See, I use array functions as little as possible, they're too easy to mess up. To be honest, although your idea of choosing who to give control to is a good idea, I think a dialog box would be the wrong way to do it. Case in point: two friends are in the game, then decide to leave. If they both leave within that five second period between trigger checks, the trigger will go off twice. There's one of two things that will happen: 1.The last person who left will bring up the dialog, and the first one's chance to share control will be lost. OR 2.Both these triggers trying to go off at once will set off a fatal error, ending the game for everyone. My suggestion would be to use a chat command system. Something like "when Player 1 types -give3 2, then have it check to see if player 2 is still playing and player 3 is gone. In most situations, dialog boxes look sharper and exude a more professional and quality game, but I feel that in order to make what you want to work, it will be a much larger headache. Good luck and peace out. P.S.* Although you've already done all the triggerwork, if you need to see another completed one to compare, I've done a dialog for a boot menu in one of my games. Just message me if you'd like to see it.




beier

TFT

50 XP

15th October 2004

0 Uploads

41 Posts

0 Threads

#5 12 years ago

In the trigger i have added a que system, putting the dialouge in a que, to be shown at next oppetunity, so thats not a problem.

In the 5 sec trigger to setup the dialouge i have

If (All conditions are True) then do (then actions) else do (else actions) { Conditions LeaderDialougeUp Equal to false

Then actions Set LeaderDialougeUp Equal to true Set DialougeShown = EkstraVariables[1] Dialouge - Show PlayerLeaveDialouge[EkstraVariables[1]] for LeaderTeam

Else actions Set DialougeQue[EkstraVariables[1]] equal to true }

And in the end of the button press dialouge i have

For each (integer EkstraVariabels[76]) from 1 to 12 do (actions) { If (All conditions are True) then do (then actions) else do (else actions) { Conditions DialougeQue[EkstraVariables[76]] Equal to true

Then actions Set DialougeShown = EkstraVariables[76] Set DialougeQue[EkstraVariables[76]] Equal to false Dialouge - Show PlayerLeaveDialouge[EkstraVariables[76]] for LeaderTeam Skip remaning actions

Else actions Set DialougeQueFalseNumber = DialougeQueFalseNumber + 1 If DialougeQueFalseNumber Equal to 5 then do set LeaderDialougeUp Equal to false Else do (do nothing) } }




beier

TFT

50 XP

15th October 2004

0 Uploads

41 Posts

0 Threads

#6 12 years ago

I found it out.. I didn't know you shouldn't clear the dialouge before running the concitions.