• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Map Start-up Ingame Lobby

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
Hello.

I have created a custom-race map for 2 players and with 2 playable races so far.
Usualy, players select their race in the gamelobby (Orc=Goblins, Night Elfs=Sylvan) but now I have realized that it causes some minor problems. :(


I wonder if this is possible to do instead:


When the game starts the game freezes and a menu appears and the players get to select: "Play as Goblins" or "Play as Elves"
There are only two start locations on the map and the units every race starts with are: 5 Workers, 1 Townhall and 1 "Caravan"

For example, if a player select the Goblins, he start at one of the two startlocations with the appropriate goblin units. The other player starts at the other location with the race he has selected. Then the game begins.


How do I do to make something like this?
 
Level 10
Joined
Nov 5, 2008
Messages
536
Ah! Now I have read it and I think I understand it.

The mechanic would be something like:

Player A chooses "Play as Goblins"
In that case, the trigger create 5 Workers, 1 Townhall and 1 "caravan" under his control at a location.



But how do I prevent so both players spawn at the same location?
 
Have a condition.
  • Dialog
  • Events
    • Dialog - A dialog button is clicked for Dialog
  • Conditions
  • Actions
    • If (Conditions)
      • ((Dialog button clicked) Equal to "Goblins")
    • Then
      • Set <yourpoint> = <your point>
      • Unit - Create 1 Townhall at (<yourpoint>) for (Triggering Player).. bla bla
    • Else
      • Set <yourpoint2> = <your point2>
      • Unit - Create 1 Townhall at (<yourpoint2> for (Triggering Player).. bla bla
    • Custom script: call RemoveLocation (udg_<yourpoint>)
    • Custom script: call RemoveLocation (udg_<yourpoint2>)
 
Level 10
Joined
Nov 5, 2008
Messages
536
I have created a trigger, but I do not get the starting units to spawn at the location I want.
Can you or anyone else describe a little further how I do to create these units at a random position out of two possible?
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
It is simple. Just do this:
1. Create 2 regions (rect in NewGen)
2. Rename them
3. Implement this trigger:

  • Set TempInteger = (Random integer number between 1 and 2)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempInteger Equal to 1
    • Then - Actions
      • Set TempPoint = <Center of Region 1>
      • Unit - Create 1 <Town Hall> for <Player> at TempPoint facing Default building facing degrees
      • Unit - Create 5 <Worker> for <Player> at TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • TempInteger Equal to 2
    • Then - Actions
      • Set TempPoint = <Center of Region 2>
      • Unit - Create 1 <Town Hall> for <Player> at TempPoint facing Default building facing degrees
      • Unit - Create 5 <Worker> for <Player> at TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
    • Else - Actions
You can make it with ''For Each Integer'' or ''Player Group''.

Note that it is possible to change race names. But it won't work instantly. You have to (after loading your map) join/play another map.

See image:
58739d1245938578-map-start-up-ingame-lobby-proof.jpg
 

Attachments

  • Proof.JPG
    Proof.JPG
    68.9 KB · Views: 199
Level 10
Joined
Nov 5, 2008
Messages
536
I have recreated the trigger you showed me, but unfortunatly there are some few errors that appears.
I would be glad if you or someone could have a look at the triggers and the problems I describe below.

Here is how my triggers look like.

  • Select Race
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Dialog - Clear DialogSelectRace
      • Dialog - Change the title of DialogSelectRace to Select your race:
      • Dialog - Create a dialog button for DialogSelectRace labelled Goblins
      • Set DialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for DialogSelectRace labelled Elves
      • Set DialogButton[2] = (Last created dialog Button)
      • Dialog - Show DialogSelectRace for Player 1 (Red)
      • Dialog - Show DialogSelectRace for Player 2 (Blue)
  • Selected Goblin
    • Events
      • Dialog - A dialog button is clicked for DialogSelectRace
    • Conditions
      • (Clicked dialog button) Equal to DialogButton[1]
    • Actions
      • Set DialogInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 2
        • Then - Actions
          • Set StartPoint2 = (Center of StartRegion2 <gen>)
          • Unit - Create 1 Goblin Fortress for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Unit - Create 5 Worker for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Unit - Create 1 Caravan for (Triggering player) at StartPoint2 facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 1
        • Then - Actions
          • Set StartPoint1 = (Center of StartRegion1 <gen>)
          • Unit - Create 1 Goblin Fortress for (Triggering player) at StartPoint1 facing Default building facing degrees
          • Unit - Create 5 Worker for (Triggering player) at StartPoint1 facing Default building facing degrees
          • Unit - Create 1 Caravan for (Triggering player) at StartPoint1 facing Default building facing degrees
        • Else - Actions
  • Selected Elves
    • Events
      • Dialog - A dialog button is clicked for DialogSelectRace
    • Conditions
      • (Clicked dialog button) Equal to DialogButton[2]
    • Actions
      • Set DialogInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 2
        • Then - Actions
          • Set StartPoint2 = (Center of StartRegion2 <gen>)
          • Unit - Create 1 Elven Roost for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Unit - Create 5 Sprite for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Unit - Create 1 Gold Keeper for (Triggering player) at StartPoint2 facing Default building facing degrees
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 1
        • Then - Actions
          • Set StartPoint1 = (Center of StartRegion1 <gen>)
          • Unit - Create 1 Elven Roost for (Triggering player) at StartPoint1 facing Default building facing degrees
          • Unit - Create 5 Sprite for (Triggering player) at StartPoint1 facing Default building facing degrees
          • Unit - Create 1 Gold Keeper for (Triggering player) at StartPoint1 facing Default building facing degrees
        • Else - Actions
The units are created when I click the button, so I suppose the trigger will soon work, but a few errors appears:

- Even if I select Goblin or Elves, they always spawn at the same location: StartRegion2.

  • Melee Initialization
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Melee Game - Use melee time of day (for all players)
      • Melee Game - Remove creeps and critters from used start locations (for all players)
      • Melee Game - Run melee AI scripts (for computer players)
      • Melee Game - Enforce victory/defeat conditions (for all players)

- Since the winning condition of my map is to destroy all enemy buildings, the game ended instantly when the game started since there are no starting units. But now I have added time - 5 seconds, but even after I have select my race and got the building, the game ends.

I hope you have time and energy to help me solve this, for without this, my map is doomed!
 
Last edited:
Level 9
Joined
Dec 17, 2008
Messages
499
If you're testing it in SP, you should know that computers can't click dialog buttons (unless forced by triggers, I think), thus getting no units/buildings.
 
Level 10
Joined
Nov 5, 2008
Messages
536
You are right about that, that computerplayers cant click the button. But since I can not test the game in multiplayer, I am afraid that the game will end when I play in multiplayer.

But my biggest problem is that I spawn at the same location every time, even thought there are two different spawns. How do I solve this?
 
  • Trigger
  • Actions
    • Set DialogInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 2
        • Then - Actions
          • Set StartPoint2 = (Center of StartRegion2 <gen>)
          • Unit - Create 1 Elven Roost for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Unit - Create 5 Sprite for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Unit - Create 1 Gold Keeper for (Triggering player) at StartPoint2 facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_StartPoint2)
      • Else - Actions
        • Set StartPoint1 = (Center of StartRegion1 <gen>)
        • Unit - Create 1 Elven Roost for (Triggering player) at StartPoint1 facing Default building facing degrees
        • Unit - Create 5 Sprite for (Triggering player) at StartPoint1 facing Default building facing degrees
        • Unit - Create 1 Gold Keeper for (Triggering player) at StartPoint1 facing Default building facing degrees
        • Custom script: call RemoveLocation (udg_StartPoint1)
    • Else - Actions
The chance trigger should be like this for better results.
Plus, you have a chance to make it spawn there, so maybe you get that "2" chance every time?
 
Level 4
Joined
Apr 20, 2009
Messages
106
I wanted to take a crack at making it so comps would be assigned a random race and random location when players are, and this is what I came up with. It uses your DialogInteger, your StartRegions, StartPoint(I rolled your two into one array, easy to change if you don't like it), and then a boolean (I liked this idea, it [should] make it so two people can't get the same starting spot). With that said and done, here's the code. If someone notices and obvious bug that I missed (I'm sure they're there, I didn't test this beast), just say something.


  • RedCompPick
  • Events
  • Time - Elapsed game time is 2.00 seconds
  • Conditions
  • (Player 1 (Red) controller) Equal to Computer
  • Actions
  • Set DialogInteger = (Random integer number between 1 and 2)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DialogInteger Equal to 1
    • Then - Actions
      • Set DialogInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • boolean[1] Equal to False
            • Then - Actions
              • Set StartPoint[1] = (Center of StartRegion1 <gen>)
              • Unit - Create 1 Goblin Fortress for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 5 Worker for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 1 Caravan for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Set boolean[1] = True
              • Custom script: call RemoveLocation(udg_StartPoint[1])
            • Else - Actions
              • Set StartPoint[2] = (Center of StartRegion2 <gen>)
              • Unit - Create 1 Goblin Fortress for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 5 Worker for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 1 Caravan for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Set boolean[2] = True
              • Custom script: call RemoveLocation(udg_StartPoint[2])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • boolean[2] Equal to False
            • Then - Actions
              • Set StartPoint[2] = (Center of StartRegion2 <gen>)
              • Unit - Create 1 Goblin Fortress for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 5 Worker for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 1 Caravan for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Set boolean[2] = True
              • Custom script: call RemoveLocation(udg_StartPoint[2])
            • Else - Actions
              • Set StartPoint[1] = (Center of StartRegion1 <gen>)
              • Unit - Create 1 Goblin Fortress for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 5 Worker for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 1 Caravan for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Set boolean[1] = True
              • Custom script: call RemoveLocation(udg_StartPoint[1])
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DialogInteger Equal to 2
    • Then - Actions
      • Set DialogInteger = (Random integer number between 1 and 2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DialogInteger Equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • boolean[1] Equal to False
            • Then - Actions
              • Set StartPoint[1] = (Center of StartRegion1 <gen>)
              • Unit - Create 1 Elven Roost for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 5 Sprite for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 1 Gold Keeper for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Set boolean[1] = True
              • Custom script: call RemoveLocation(udg_StartPoint[1])
            • Else - Actions
              • Set StartPoint[2] = (Center of StartRegion2 <gen>)
              • Unit - Create 1 Elven Roost for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 5 Sprite for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 1 Gold Keeper for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Set boolean[2] = True
              • Custom script: call RemoveLocation(udg_StartPoint[2])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set StartPoint[2] = (Center of StartRegion2 <gen>)
              • Unit - Create 1 Elven Roost for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 5 Sprite for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Unit - Create 1 Gold Keeper for Player 1 (Red) at StartPoint[2] facing Default building facing degrees
              • Set boolean[2] = True
              • Custom script: call RemoveLocation(udg_StartPoint[2])
            • Else - Actions
              • Set StartPoint[1] = (Center of StartRegion1 <gen>)
              • Unit - Create 1 Elven Roost for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 5 Sprite for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Unit - Create 1 Gold Keeper for Player 1 (Red) at StartPoint[1] facing Default building facing degrees
              • Set boolean[1] = True
              • Custom script: call RemoveLocation(udg_StartPoint[1])
    • Else - Actions
EDIT: Already noticed a small oversight of mine, fixing it.
DOUBLE EDIT: Think I got it now... that's a fun trigger :p
 
Level 10
Joined
Nov 5, 2008
Messages
536
Thanks for your answears! But still, units always spawns at the same location. Is there something I need to do with the variables that I have missed? Shall there be a value in the integer variable that decide the possible two start locations?
 
Level 4
Joined
Apr 20, 2009
Messages
106
That's interesting, as I replicated your triggers (with a few small changes for easier testing), and I got an 11/9 split when it came to spawning spots. It could be you are just getting extremely unlucky, but I don't know.

What you can do is for the last action of the trigger, make it send a message to all players showing if it picked 1 or 2. Then you will be able to see if it is always picking the same number, or if there's a problem.

I also attached my test map onto here, don't mind some of the other random stuff that's on it.

ALSO (last one, I swear :p), I'm going to try and re-write the comp spawning trigger, and maybe even try the player spawning one with the same occupied checker. I'll probably do it in JASS, though, as I need to practice with it more often <.<

I won't say also, so I technically didn't lie... the comp spawn trigger worked how I had it? You should probably set the elapsed time to something longer than 2 seconds for testing purposes, as it will always beat a human reaction time on the draw, rendering the occupational checker useless.
 

Attachments

  • Testmap.w3x
    19.4 KB · Views: 42
Status
Not open for further replies.
Top