Help with Dialogue-based hero choosing

S

Spleen1013

Guest
Hi,
In the game that I am making, I want it to start where 3 popup boxes appear and each one presents players with a choice of options.

First box - Race.. there are four races. It records what choice is made as a variable integer.

Second box - Affinity.. either chaotic or lawful. It records your choice as a true/false variable.

Third box - Unit type.. melee, ranged, etc.. It records your choice as an integer.

After the third box, it will check all the spawn triggers for conditions matching the three variables and spawn a unit based on those into an area assigned specifically for that unit type.

However, I have the popup boxes working fine (I think), but then a unit isn't spawned. Here are some bits of my code to clarify things..

Map Initialization
Set variable Zcastlestart = castlestart <gen>

Event - Time elapsed = 1 second
Action - Pick every player and do actions -
- Clear race1(dialogue variable)
- Change Title
- Create diologue button for race1 labelled Human
- Set variable Human = last created button
- Show race1 to (Picked Player)

Event - Diologue button is pressed
Condition - [clicked button] is = Human
Actions
Set variable race = 1
Set continue = true
Game - Display to Playergroup(triggering player) the text: You picked Human.
Trigger - Run alignment <gen> checking conditions.

Conditions - continue is = true
Actions
Player Group - pick every player in group and do actions -
- dialogue - clear race1
- dialogue - clear pickalign
- dialogue - hide race1 for (triggering player)
- dialogue - change title of pickalign to Choose your Alignment
- dialogue - create button for pickalign labelled "Lawful"
- set variable lawful = last created button
- dialogue -display dialogue for (triggering player)

Event -a button is pressed on pickalign
Condition - button pressed = Lawful
Actions -
Set variable alignment = true
Game - display to triggering player "you are lawful."
Trigger - turn on Unit Type <gen>
Trigger - run Unit Type <gen> ignoring conditions

Unit type trigger
Actions
dialogue - hide pickalign for (triggering player)
dialogue - change title of type to Pick Unit Type
dialoge - create button labelled Melee
set variable melee = last created button
dialogue - show type to triggering player

event - dialogue button is clicked for type
condition - clicked button = melee
action - set job = 1

event - dialogue button clicked for type
conditions
race = 1
alignment = true
job = 1
actions
Create 1 Human Soldier for (triggering player) at (random point in Zcastlestart) facing default building degrees

I also have two more questions..

1. Will it record the variables seperatly for each player, or will I have to make it so there is one variable for each player?

2. Will it only spawn one unit (when it works), or will I have to program in another trigger that prevents it from spawning only one?

Thank you VERY MUCH in advance.
 
I saw that, however, it is a little more simple in that all you need to do is hit one button and it creates a unit of that type. With mine, it records three seperate variables, and I think the problem may lie in that it doesn't properly do something with the variables, or something..
 
i don know, ive not yet worked w/ dialogs. i just saw the tutorial. i suspect i will experiment w/ them sooner or later. probably on the current map im making.
 
some dialongs are explained in the free trigger page try there
 
To me it looks like your variables is going to overwrite each other when Example: Player 1 wants to be orc but player 2 wants night elf but he selects first so when player 1 selects orc it will choose orc for both players.

i think i would make it a integre array so it would look something like this
Code:
Pick Human Race
    Events
        Dialog - A dialog button is clicked for YourDialog
    Conditions
        (Clicked dialog button) Equal to (HumanRace)
    Actions
        Set Race[(Player number of (Triggering player))] = 1
        -Rest of your Actions

and of what i can see this goes for all of your (Variables) they record over one and other but checking the lille array box in the variable menu can prevent this...
 
look at my post in the free trigger code for 2D arrays, i think it would help a lot if you did that but you'd have to modify it a little, then instead of comparing conditions you can just put them in the array index and you'll only use like 2 lines to handle every hero instead of 3 seperate conditions for every hero

if theres 4 races (human, orc, undead, night elf), 2 allignments (lawful, chaotic), and 2 types (range, melee) then there are 4*2*2 = 16 possible choices. make a unit-type array of size 16.
1-4 will be used for Human
5-8 will be used for Orc
9-12 will be used for Undead
13-16 will be used for Night Elf

for each race, the 1st 2 will be Lawful and the 2nd 2 will be Chaotic
for each group of 2 (allignment and race) the first will be ranged and 2nd will be melee, so it looks like this:

Human/Lawful
HeroType[1] ranged
HeroType[2] melee
Human/Chaotic
HeroType[3]= ranged
HeroType[4]= melee
Orc/Lawful
HeroType[5]= ranged
HeroType[6]= melee
Orc/Chaotic
HeroType[7]= ranged
HeroType[8]= melee
Undead/Lawful
HeroType[9]= ranged
HeroType[10]= melee
Undead/Chaotic
HeroType[11]= ranged
HeroType[12]= melee
Night Elf/Lawful
HeroType[13]= ranged
HeroType[14]= melee
Night Elf/Chaotic
HeroType[15]= ranged
HeroType[16]= melee

you will need 3 integer variables (arrays, so each player will have their own copy)
when a dialog button is clicked for race
if clicked button = Human
set Race[player number of the player that clicked the button] = 0
else if clicked button = Orc
set Race[player number of the player that clicked the button] = 1
else if clicked button = Undead
set Race[player number of the player that clicked the button] = 2
else if clicked button = Night Elf
set Race[player number of the player that clicked the button] = 3

when a dialog button is clicked for allignment
if clicked button = Lawful
set Allignment[player number of the player that clicked the button] = 0
else if clicked button = Chaotic
set Allignment[player number of the player that clicked the button] = 1

when a dialog button is clicked for Type
if clicked button = Ranged
set Type[player number of the player that clicked the button] = 1
else if clicked button = Melee
set Type[player number of the player that clicked the button] = 2
Create 1 HeroType[ ( ( Race[player number] * 4 ) + ( Allignment[player number] * 2) ) + Type[player number] ] for player at location


if you want to test to make sure, i already showed a list of where you should put each hero type in the array so lets check it. say you want Undead/Chaotic/Melee
Race would be 2
Allignment would be 1
Type would be 2
((2 * 4) + (1 * 2)) + 2
(8 + 2) + 2
10 + 2 = 12
if you look at the array undead/chaotic/melee is number 12 in the array
if you want Human/Lawful/Ranged you'd get
Race = 0
Allignment = 0
Type = 1
((0 * 4) + (0 * 2)) + 1
( 0 + 0 ) + 1
0 + 1 = 1 and that matches with Human/Lawful/Ranged in the array, so it works.
 
ok here we go, i made a batch of triggers that should work (untested)

Code:
Set Heros
    Events
        Map initialization
    Conditions
    Actions
        Set HeroType[1] = Paladin
        Set HeroType[2] = Archmage
        Set HeroType[3] = Mountain King
        Set HeroType[4] = Blood Mage
        Set HeroType[5] = Tauren Chieftain
        Set HeroType[6] = Far Seer
        Set HeroType[7] = Blademaster
        Set HeroType[8] = Shadow Hunter
        Set HeroType[9] = Death Knight
        Set HeroType[10] = Lich
        Set HeroType[11] = Dreadlord
        Set HeroType[12] = Dark Ranger
        Set HeroType[13] = Warden
        Set HeroType[14] = Keeper of the Grove
        Set HeroType[15] = Demon Hunter
        Set HeroType[16] = Priestess of the Moon
Code:
Show Dialog
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Dialog - Clear RaceDialog
        Dialog - Change the title of RaceDialog to Choose your race:
        Dialog - Create a dialog button for RaceDialog labelled Human
        Set Human = (Last created dialog Button)
        Dialog - Create a dialog button for RaceDialog labelled Orc
        Set Orc = (Last created dialog Button)
        Dialog - Create a dialog button for RaceDialog labelled Undead
        Set Undead = (Last created dialog Button)
        Dialog - Create a dialog button for RaceDialog labelled Night Elf
        Set NightElf = (Last created dialog Button)
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Dialog - Show RaceDialog for (Picked player)
Code:
Race Button Pressed
    Events
        Dialog - A dialog button is clicked for RaceDialog
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        If ((Clicked dialog button) Equal to Human) then do (Set PlayerChoice[PlayerNum] = 0) else do (Do nothing)
        If ((Clicked dialog button) Equal to Orc) then do (Set PlayerChoice[PlayerNum] = 4) else do (Do nothing)
        If ((Clicked dialog button) Equal to Undead) then do (Set PlayerChoice[PlayerNum] = 8) else do (Do nothing)
        If ((Clicked dialog button) Equal to NightElf) then do (Set PlayerChoice[PlayerNum] = 12) else do (Do nothing)
        Dialog - Clear AlignentDialog
        Dialog - Change the title of AlignentDialog to Choose your alignme...
        Dialog - Create a dialog button for AlignentDialog labelled Lawful
        Set Lawful = (Last created dialog Button)
        Dialog - Create a dialog button for AlignentDialog labelled Chaotic
        Set Chaotic = (Last created dialog Button)
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Dialog - Show AlignentDialog for (Picked player)
Code:
Alignment Button Pressed
    Events
        Dialog - A dialog button is clicked for AlignentDialog
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        If ((Clicked dialog button) Equal to Chaotic) then do (Set PlayerChoice[PlayerNum] = (PlayerChoice[PlayerNum] + 2)) else do (Do nothing)
        Dialog - Clear TypeDialog
        Dialog - Change the title of TypeDialog to Chose your Type:
        Dialog - Create a dialog button for TypeDialog labelled Melee
        Set Melee = (Last created dialog Button)
        Dialog - Create a dialog button for TypeDialog labelled Ranged
        Set Ranged = (Last created dialog Button)
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Dialog - Show AlignentDialog for (Picked player)
Code:
Type Button Pressed
    Events
        Dialog - A dialog button is clicked for TypeDialog
    Conditions
    Actions
        Set PlayerNum = (Player number of (Triggering player))
        If ((Clicked dialog button) Equal to Melee) then do (Set PlayerChoice[PlayerNum] = (PlayerChoice[PlayerNum] + 1)) else do (Do nothing)
        If ((Clicked dialog button) Equal to Ranged) then do (Set PlayerChoice[PlayerNum] = (PlayerChoice[PlayerNum] + 2)) else do (Do nothing)
        Unit - Create 1 HeroType[PlayerChoice[PlayerNum]] for (Player(PlayerNum)) at ((Player(PlayerNum)) start location) facing Default building facing degrees

Of course set the heros i have there to the ones you are going to use, its the same order as the guy above me said. (this is actually a working version of what he said, simplified a little) if you run into any problems be sure to notify me.
 
Sorry about long wait for reply - went on vacation.

I coded in everything that you had written down, AgentPaper, and from what I can tell, most of it works fine, but no unit is spawned at the end. Is there some way for me to tell what is messing up and fix it?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    Luckily I live in an age with electricity so it's way fucking faster, but when I was just a boy trying to find my place I had some hardcore chefs that made use do things like that by hand. It is WAY easier to get right by hand because you control it and can feel it, but it takes soooooo much longer. And on the scale a modern kitchen requires... I serve 400-500 guests on average per day right now, if I had 100 then we could do things way better
  • Varine Varine:
    But we can't do that. In the winter yeah, but I HAVE to get people through here right now so I can afford the staff that we CAN do that. We have about 100 days of summer, and if that summer doesn't make us what it will, then I can't operate the other most of the year with my staff. The owner is talking about closing two days a week to cut down on labor, I told him he should cut down on vacations and it did not go great. I do think I won though, I have to keep my fucking core staff and they have to be gainfully employed
  • Varine Varine:
    Sure some of them might take a second job, but I can't just cut my entire staff to unlivable hours, nor can I can cut them off all winter if I want them to come back.
  • Varine Varine:
    And also, there is no fucking way I'm pulling these hours come september. I only do this right now because I have to, the second I don't have to be the one doing it I won't be
  • Varine Varine:
    I have a 5 person core staff in the kitchen, not including me or Chef Ben
  • Varine Varine:
    Though two of those people are likely not making it this year. One of them has been replaced, the other I am kind of trying to. He's being a giant bitch, today I had to get onto him because in the three hours before I left he had taken like thirty minutes for cigarette breaks
  • Varine Varine:
    And he was also complaining to me the other day that he was out of weed so couldn't smoke any before work that day, and was confused about why I was annoyed he was telling me, his boss, that he is smoking weed everyday before work.
    +1
  • Varine Varine:
    Like yeah I can tell. I don't need to fucking know.
  • Varine Varine:
    So now he's getting scrutinized and will not be top of the list. I know I don't have the smartest people but I do expect them to have some common fucking sense
  • Varine Varine:
    I did do a rare thing for me and hire a girl last month without warning. Everyone was made at me because I started her at like 21, but she worked with me before and I was like don't care. She made 19 at her old job and I wanted her to come work with me, she is the best
    +1
  • Varine Varine:
    I'm going to get her a raise at the end of the summer. She wants to go to school again, but I want her to still work with me so.... she kind of can just tell me what the price is. I can go to 25 if she keeps up. I need to get her onto line more, that's what she wants, but I need her where she is and it's not fair that she doesn't get the little bit of raise that comes with it. She can do it no problem, I've worked with her there.
  • Varine Varine:
    It's just hard to move and train people unnecessarily right now. And also the line fucking sucks, it's not any more fun. This is turn and burn so I have the bankroll, and everyone suffers for it
  • Varine Varine:
    Eventually we'll get it balanced, we'
  • Varine Varine:
    we're starting online orders and stuff, but I also turn that off all the time because I barely keep up trying to be the best at Sysco shit
  • Varine Varine:
    I think it's gonna be a good fall and winter though. We're going to have a good staff, they will get along, they will be able to manage the workload and the complications, they know how to really cook this year, like every person on line knows their steak temps. Some of them use thermometers a lot and they don't always use them right, but they do know how to do it. Failure, especially in this field, is the only way to get better. They'll get it
  • Varine Varine:
    They won't get feel down while they do the thermometer, but we didn't have an instant read probe when I was learning. Like they did but god knows how off it is, you HAD to do it by feel. Even if the chef was fine with me bringing my own, it takes too long. Poke and know
  • The Helper The Helper:
    420 threads in the Artificial Intelligence forum :)
  • The Helper The Helper:
    Happy Monday!
    +1
  • The Helper The Helper:
    and then it was Tuesday!
    +1
  • The Helper The Helper:
    fyi I am going out of town to lake somewhere in bfe texas for the weekend will be gone Friday morning to sunday afternoon for a paranormal thing and some rest peace
  • jonas jonas:
    cool take it easy
  • jonas jonas:
    I recently had an experience with a waiter that really brought down @Varine's point about them being in sales. The first waiter just asked "anything else? deserts?" and when the table shook their head said "ok" and left. Then the other waiter came in and started going off describing the deserts and you could see the heads turning, and they finally got a bunch of deserts
  • jonas jonas:
    makes sense if you consider that the tip is basically a commission on sales

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top