I've got an Infiltration map where I'd like to have the player find bits and clues of the password on different enemies. Once they find it, they can go to a vault in the facility and get an upgrade.
Anyways, I have some basic know-how on Dialogs, but not enough to make it enter a number into a variable.
Example of what I'm going for:
Password:
[1][2][3]
[4][5][6]
[7][8][9]
[Enter]
I know how to create that button layout, but not how to make each one enter the corresponding number into a variable which I can check.
To assign the button to a variable you just have to add an action "set variable" after creating every button and assign it to the "last dialog control created"
You can make an extra "integer" global variable called "correct digits" (or something like that), and a trigger where you add 1 to it each time the digit typed is correct.
Example with the combination 139
EVENT
Player any uses any dialog item - event click
ACTIONS
if then else:
CONDITIONS
dialog item used = 1 (the variable for the button with number 1)
"correct digits" = 0 (the extra integer variable)
THEN:
Set variable "correct digits" = 1
ELSE:
if then else:
CONDITIONS;
dialog item used = 3 (the variable for the button with number 3)
"correct digits" = 1 (the extra integer variable)
THEN:
Set variable "correct digits" = 2
ELSE:
if then else:
CONDITIONS;
dialog item used = 9 (the variable for the button with number 9)
"correct digits" = 2 (the extra integer variable)
THEN:
set variable "password accepted" = True (a boolean variable)
Fortunately for you, I've made exactly this for my map, Xeno Crisis! I have a system that randomizes several access codes every game. And, using buffs, I can directly apply certain codes to individual doors. It is a bit complex though...
I'll post some of my triggers here for you to dig through. It may or may not be a complete list, but this is to help you, not for you to just copy :P
EDIT: I'll post a video in the next day or so of it actually working
RefreshKnownCodesListOptions:Action,CreateThreadReturnType:(None)ParametersPlayerID=0<Integer>GrammarText:RefreshKnownCodesList(PlayerID)HintText:(None)CustomScriptCodeLocalVariablesLinebreak="<n/>"<String(Constant)>KnownCode1=""<String>KnownCode2=""<String>KnownCode3=""<String>NewTooltip=""<String>ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfKnownCodes[PlayerID][1]==FalseKnownCodes[PlayerID][2]==FalseKnownCodes[PlayerID][3]==FalseThenDialog-SetDialogKeypadCodestooltipto"Known passcodes: [None] NOTE: If a..."for(Playergroup(PlayerID))ElseGeneral-Switch(Actions)dependingonKnownCodes[PlayerID][1]CasesGeneral-If(True)ActionsVariable-SetKnownCode1=(("Commander: "+CodeCommander)+Linebreak)DefaultGeneral-Switch(Actions)dependingonKnownCodes[PlayerID][2]CasesGeneral-If(True)ActionsVariable-SetKnownCode2=(("Scientist: "+CodeScientist)+Linebreak)DefaultGeneral-Switch(Actions)dependingonKnownCodes[PlayerID][3]CasesGeneral-If(True)ActionsVariable-SetKnownCode3=(("Engineer: "+CodeEngineer)+Linebreak)DefaultVariable-SetNewTooltip=((KnownCode1+KnownCode2)+KnownCode3)Dialog-SetDialogKeypadCodestooltipto(Combine("Known passcodes: ",(Text(NewTooltip))," NOTE: If a passcode changes, it w..."))for(Playergroup(PlayerID))
Nope nothing else to set up, if you use more that one code add more dimensions to the array in the code input and all that to suit your needs, that was just a base generalization trigger.
Seems like you put a lot of work into that system Bashar, it seems very well made. Though I probably won't need the random generation of codes, I still really appreciate you putting it on this thread for reference.
Thanks guys, this really helps out. It'll have a good effect on the map.
it's a rough trigger, essentially you state the button size you're gonna use, and then you just multiply by the number of buttons already made for that row.
You could, alternatively, attach the new button to the right of the previous one, anchoring left. Same effect, really. willuwontu's method calculates the offset from the left of the dialog instead of from one of the buttons... kind of like this:
I've got an Infiltration map where I'd like to have the player find bits and clues of the password on different enemies. Once they find it, they can go to a vault in the facility and get an upgrade.
Anyways, I have some basic know-how on Dialogs, but not enough to make it enter a number into a variable.
Example of what I'm going for:
Password:
[1][2][3]
[4][5][6]
[7][8][9]
[Enter]
I know how to create that button layout, but not how to make each one enter the corresponding number into a variable which I can check.
To assign the button to a variable you just have to add an action "set variable" after creating every button and assign it to the "last dialog control created"
You can make an extra "integer" global variable called "correct digits" (or something like that), and a trigger where you add 1 to it each time the digit typed is correct.
Example with the combination 139
EVENT
Player any uses any dialog item - event click
ACTIONS
if then else:
CONDITIONS
dialog item used = 1 (the variable for the button with number 1)
"correct digits" = 0 (the extra integer variable)
THEN:
Set variable "correct digits" = 1
ELSE:
if then else:
CONDITIONS;
dialog item used = 3 (the variable for the button with number 3)
"correct digits" = 1 (the extra integer variable)
THEN:
Set variable "correct digits" = 2
ELSE:
if then else:
CONDITIONS;
dialog item used = 9 (the variable for the button with number 9)
"correct digits" = 2 (the extra integer variable)
THEN:
set variable "password accepted" = True (a boolean variable)
ELSE:
ser variable "correct digits" = 0
Check out my kitbashes! Custom Campaign Initiative: Lots of great Custom Campaigns!! Check out and Support!!
I'm hoping to make something like in here:
They were showing off a pass worded door using a dialog.
Try that
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Thank you very much, It was hard to read when you first posted it. Heh.
I'll try this. Again, really appreciated.
(Edit: Is there anything else that needs to be setup other than those triggers and the global variables? I've got the enable trigger setup.)
Fortunately for you, I've made exactly this for my map, Xeno Crisis! I have a system that randomizes several access codes every game. And, using buffs, I can directly apply certain codes to individual doors. It is a bit complex though...
I'll post some of my triggers here for you to dig through. It may or may not be a complete list, but this is to help you, not for you to just copy :P
EDIT: I'll post a video in the next day or so of it actually working
Random code generation:
Applying locks to individual doors:
A trigger which deals with a player interfacing with a door which may or may not be locked:
A "hacking" function:
Keypad entry dialog:
A function which stores codes known by a player:
Good luck!
@Alnatair: Go
Nope nothing else to set up, if you use more that one code add more dimensions to the array in the code input and all that to suit your needs, that was just a base generalization trigger.
@BasharTeg: Go
I just use a fusion bomb to get past all that madness :)
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
Ah, the good ol' skeleton key ;)
Seems like you put a lot of work into that system Bashar, it seems very well made. Though I probably won't need the random generation of codes, I still really appreciate you putting it on this thread for reference.
Thanks guys, this really helps out. It'll have a good effect on the map.
(Sorry for the double post)
I just got to using the code you gave me, willu. I'm wondering how you made the: -create a button in row 1 with an x offset of buttonsize * x
it's a rough trigger, essentially you state the button size you're gonna use, and then you just multiply by the number of buttons already made for that row.
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@Alnatair: Go
You could, alternatively, attach the new button to the right of the previous one, anchoring left. Same effect, really. willuwontu's method calculates the offset from the left of the dialog instead of from one of the buttons... kind of like this:
Sorry, I meant to say, did you just use the regular: Dialog - Create a Button for dialog (Last created dialog)
Or did you use some sort of Galaxy Editor Wizardry I haven't learned yet. :P
@Alnatair: Go
oh, yes i used the regular method.
Edit: the only wizardry is my mad genius.
@BasharTeg: Go
Could you look at this thread bash
\
http://www.sc2mapster.com/forums/development/triggers/52850-break-while-loop-or-stop-trigger
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)