Dialog Trouble

Tastyfish

New Member
Reaction score
2
Hey guys!
Its me again :D.
Im having some trouble with getting some "dialouge" (text) to work properly.
I want a "trainer" to say something different depending on the hero type, an item the unit carries etc. but he is saying like everything.

Code:
Events
    Unit - A unit enters Twohanded Swordsman Trainer <gen>
Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Not equal to Village Boy
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: Go away! You dont h...
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
            (Level of (Entering unit)) Greater than or equal to 6
            ((Entering unit) has (Item carried by (Entering unit) of type Broad Sword)) Equal to True
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: Hey there lad!  Do ...
            Do nothing
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
            (Level of (Entering unit)) Greater than or equal to 6
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: You have potential ...
            Do nothing
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
            ((Entering unit) has (Item carried by (Entering unit) of type Broad Sword)) Equal to True
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: You are to inexperi...
            Do nothing
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: You have potential ...
            Do nothing
        Else - Actions

that aint working and its kindoff bothering me...
would appreciate any help i can get :D.
 

Arkan

Nobody rides for free
Reaction score
92
First of you can use Triggering Unit instead of Entering Unit.

Your problem is that severeal of the if-conditions will be run if the unit is >= level 6, has a sword and is a villager boy. You have to add more conditions like this:

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Not equal to Village Boy
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: Go away! You dont h...
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
            (Level of (Entering unit)) Greater than or equal to 6
            ((Entering unit) has (Item carried by (Entering unit) of type Broad Sword)) Equal to True
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: Hey there lad!  Do ...
            Do nothing
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
            (Level of (Entering unit)) Greater than or equal to 6
            [COLOR="Red"]((Entering unit) has (Item carried by (Entering unit) of type Broad Sword)) Equal to False[/COLOR]
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: You have potential ...
            Do nothing
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
            [COLOR="red"](Level of (Entering unit)) Less than to 6[/COLOR]
            ((Entering unit) has (Item carried by (Entering unit) of type Broad Sword)) Equal to True
        Then - Actions
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: You are to inexperi...
            Do nothing
        Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of (Entering unit)) Equal to Village Boy
           [COLOR="red"] (Level of (Entering unit)) Less than 6
            ((Entering unit) has (Item carried by (Entering unit) of type Broad Sword)) Equal to False
        Then - Actions[/COLOR]
            Game - Display to (Player group((Owner of (Entering unit)))) for 8.00 seconds the text: You have potential ...
            Do nothing
        Else - Actions
 

Tastyfish

New Member
Reaction score
2
Thanks for the answer ! :).
Instead of posting another thread i thought i would ask about it in here!

How can i make a trigger that gives a player 1 score when he casts an ability and the opponent casts the wrong ability. (think rock, paper, scissors, Im making a minigame like that :)).
For example if player one casts "rock" and the opponent casts "scissors" player one recieves one point.
If player one casts "rock" and player two casts "paper" player two recieves one point.
If both players casts "rock" then noone gets a point.
How could i be able to do this?
 

Sooda

Diversity enchants
Reaction score
318
> Instead of posting another thread i thought i would ask about it in here!

It' s actually another way around. Don' t be afraid to post new threads with new questions because it' s easier to find answers by using search then.

> rock, paper and scissors game


"ability" is ability variable array of 3 with default starting value.
"result" is integer variable array of 12 with default starting value.
"Ready" is boolean variable array of 12 with default starting value.

Ability list (Needs to be in right order)

ability[1] = Rock
ability[2] = Paper
ability[3] = Scissors

Create 2 triggers for both different players, create 3 abilites each for one type (Rock, paper or scissors). As event use "unit starts the effect of ability".
In actions use integer loop to find out what does casted ability is equal to ability[ForLoopIndexA] and set "result[Player_Index]" = "ForLoopIndexA", set one boolean "Ready[Player_Index]" to true. Then in same trigger check does "Ready[Opponent_Player_Index]" is true then do:
Main If/ Then/ Else
Sub1 If/ Then/ Else: result[Player_Index_1] equal to 1 and result[Player_Index_2] equal to 3 do actions (in the end of actions add skip other actions).
Sub2 If/ Then/ Else: result[Player_Index_1] equal to 3 and result[Player_Index_2] equal to 2 do actions (in the end of actions add skip other actions).
Sub3 If/ Then/ Else: result[Player_Index_1] equal to 2 and result[Player_Index_2] equal to 1 do actions (in the end of actions add skip other actions).

If that didn' t give results add same same ammount If/ Then/ Else actions only for player 2:
Sub4 If/ Then/ Else: result[Player_Index_2] equal to 1 and result[Player_Index_1] equal to 3 do actions (in the end of actions add skip other actions).
...
Sub6 If/ Then/ Else: result[Player_Index_2] equal to 2 and result[Player_Index_1] equal to 1 do actions (in the end of actions add skip other actions).

If that didn' t give results also display to players: Draw!
 

Tastyfish

New Member
Reaction score
2
I dont really understand that and you have some variables that you havent listed what to do with them, if you have the time please clarify :).
 

Sooda

Diversity enchants
Reaction score
318
Oh gosh, sry for not making it so clear:
Code:
Rock Paper Scissors Game
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
    Actions
        -------- "WichOne" is integer variable array of 12 with default starting values. --------
        -------- "ready" is boolean variable array of 12 with default starting values. --------
        For each (Integer A) from 1 to 3, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Ability being cast) Equal to whichOne[(Integer A)]
                    Then - Actions
                        Set result[(Player number of (Owner of (Triggering unit)))] = (Integer A)
                        Set ready[(Player number of (Owner of (Triggering unit)))] = True
                    Else - Actions
        -------- Everything now on needs to be outside of loop. --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ready[3] Equal to True
            Then - Actions
                Trigger - Run Rock Paper Scissors Winner <gen> (ignoring conditions)
            Else - Actions

It is base for both players, it' s up to you how you get right players into arrays. Then:
Code:
Trigger - Run Rock Paper Scissors Winner <gen> (ignoring
should consist of these If/ Then/ Else what I spoke before. It looks like this:
Code:
Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            result[1] Equal to 1
            result[2] Equal to 3
        Then - Actions
            -------- We got winner do now actions. --------
            Skip remaining actions
        Else - Actions

I hope it is more clear now.
 

Tastyfish

New Member
Reaction score
2
Ok!

Code:
Melee Initialization
    Events
        Map initialization
    Conditions
    Actions
        Game - Set the time of day to 12.00
Setup
    Events
        Map initialization
    Conditions
    Actions
        Set Heroes[1] = Paladin
        Set Heroes[2] = Mountain King
Units
    Events
        Map initialization
    Conditions
    Actions
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Unit - Create 1 Paladin for Player 1 (Red) at (Center of Player 1 <gen>) facing 0.00 degrees
                Unit - Create 1 Mountain King for Player 2 (Blue) at (Center of Player 2 <gen>) facing 180.00 degrees
Leaderboard
    Events
        Map initialization
    Conditions
    Actions
        Wait 5.00 seconds
        Leaderboard - Create a leaderboard for (All players) titled Rock, Paper, Scisso...
        Custom script:   set bj_wantDestroyGroup=true
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked player) controller) Equal to User
                        ((Picked player) slot status) Equal to Is playing
                    Then - Actions
                        Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Triggering player)) and value 0
                    Else - Actions
                        Do nothing
Pick
    Events
        Map initialization
    Conditions
    Actions
        Unit - Pause all units
        Wait 5.00 seconds
        Game - Display to (All players) for 5.00 seconds the text: Pick either rock, p...
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Hero - Learn skill for (Triggering unit): Rock 
                Hero - Learn skill for (Triggering unit): Paper 
                Hero - Learn skill for (Triggering unit): Scissors 
        Unit - Unpause all units
        Wait 1.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: Rock!
        Wait 1.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: Paper!
        Wait 1.00 seconds
        Game - Display to (All players) for 1.00 seconds the text: Scissors!
        Wait 1.00 seconds
Abilitys
    Events
        Map initialization
    Conditions
    Actions
        Set Ability[1] = Rock 
        Set Ability[2] = Paper 
        Set Ability[3] = Scissors 
Player1
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
    Actions
        For each (Integer A) from 1 to 3, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Ability being cast) Equal to Ability[(Integer A)]
                    Then - Actions
                        Set Result[(Player number of (Triggering player))] = (Integer A)
                        Set Ready[(Player number of (Triggering player))] = True
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Ready[3] Equal to True
            Then - Actions
                Trigger - Run Winner <gen> (ignoring conditions)
            Else - Actions
Winner
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Result[1] Equal to 1
                Result[2] Equal to 3
            Then - Actions
                Game - Display to (All players) the text: Player 1 wins!
                Leaderboard - Change the value for Player 1 (Red) in (Last created leaderboard) to 1
            Else - Actions

Thats all of em.
some of these things i dont even know why i did :D.
I want this game to be like.
It first waits a bit and shows some text and then it starts saying:
Rock
Paper
Scissors

and thats the time you have to do any of the abilitys.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top