• 0

    posted a message on Player position on team, and player number?
    Quote:

    Player IDs are tied to the order players join the lobby.

    I assumed this was true for AIs as well.

    It took me a LLLOOOOOOOOOOOOOOOOONNNNGGGGG time to debug a problem I was having which was due to the way AI players are assigned numbers.

    The AIs are given numbers from the last available number forward.

    So if you start a game with 6 player slots available, add 2 AIs and then a human player joins the game lobby will look like this:

    1 - human_1
    2 - computer1
    3 - computer2
    4 - human_2
    5 - empty
    6 - empty

    However the player numbers will be assigned as such:

    1 - human_1
    2 - human_2
    3 - empty
    4 - empty
    5 - computer_2
    6 - computer_1

    Just something you have to look out for as I unfortunately had to learn the hard way

    Posted in: Triggers
  • 0

    posted a message on [Question] Turn-Based Pathing System

    If you are happy only being able to select adjacent tiles to move to and repeat this 20 times for a unit which can move 20 spaces then I would say it is doable for a freshly graduated highschooler who knows his shit. It's still going to be hard work though.

    Obviously there are a million different ways to skin a cat create a program.

    Personally I am thinking something like a really basic version of "The Battle for Westnoth" which can be seen here:

    (GOD DAMN I love that game!)

    Obviously I am biased by how obsessed I was with that game for a while. I'm guessing your vision of what you want would be different in many ways.

    Just brainstorming here but if I were to do it I would make all the units unselectable. Instead I would coat the ground with units with the hexagon decals (like what was done in the map cloud kingdom http://i.imgur.com/Hfqlp.jpg ) with a large selection radius. That way if a player clicks inside a hexagon it will select that hexagon.

    Make each hex invisible and then when a player clicks a hex with a unit on it then the surrounding hexes become visible. If they click on an empty hex nearby then the unit moves to that hex. If the hex they clicked on had another friendly unit then select that unit instead. If it is impassible terrain then don't move the unit. If it contains an enemy unit then get the unit to attack the enemy unit.

    hmmm... giving serious consideration to making a starcraft version of "battle for westnoth" right now! lol

    Posted in: Triggers
  • 0

    posted a message on [Question] Turn-Based Pathing System

    @thequiet: Go

    So after you select the marine do you then click on the destination tile you wish him to move to? If so I'm guessing you would also need to find a path around obsticles as well?

    For this you will need what is called a graph. It can represent a series of discrete locations and the connections between them. To find the path from source to destination you will have to run a path finding algorithm such as a breadth first search to discover what path the unit should take.

    You would also need an array containing each unit and the number of moves it has left in this turn.

    Also I would recomend using hexagons instead of squares. It will not be any harder from a coding perspective and will mean that players can travel diagonally much easier.

    This kind of task would be about 2nd year college/university level. So I would not recomend it for someone without a little experience under their belt.

    An easier task would be letting the user decide the path that the unit takes by only letting them select the tiles adjacent to the current tile. For your example of the marine that can travel 20 tiles that would involve 20 clicks from start to finish though. Or you could not bother with obsticles and let units travel through eachother and the environment. Both of these tasks would be considerably easier.

    Happy to help if you want ideas on how to go about any of this.

    Posted in: Triggers
  • 0

    posted a message on Function/Array/Struct References

    @Mahajarama: Go

    Unfortunately not :(

    I wish you could though

    Posted in: Triggers
  • 0

    posted a message on Triggers That save every unit on field

    @ausgray10: Go

    What do you mean that it "saves your base every 15 seconds"?

    You mean so you can later reload from the save point?

    Posted in: Triggers
  • 0

    posted a message on Random Number Generator
    Quote from MoDTassadar: Go

    Hello, I am just wondering how to make a random number generator since there is not built-in one.

    Have you tried using the random number generator that is built in?

    http://lmgtfy.com/?q=starcraft+2+editor+random+number

    You should try and find answers yourself before asking people on the forum.

    If you DO know how to use the inbuilt random number generator and are asking how to set a better seed for extra randomness or some other related question then you should phrase your question better

    Posted in: Triggers
  • 0

    posted a message on Records inside a Record: How?

    Also, if you are going to do this I would recomend putting all your code in a mod, then adding the mod as a dependancy on your actual map.

    Copy/paste and import/export of code with nested records is buggy and will tend to cause a lot of headaches. I have learned the hard way that it is better creating a mod and adding it as a dependancy. That way if you want to use the code on another map, or if you want to redo the terrain or data stuff from scratch you can just add it without spending an hour fixing up all the broken links.

    Posted in: Triggers
  • 0

    posted a message on HELP - Actor Set Tint to Life Percentage

    Glad you have it solved.

    But it wasn't explained very clearly what you were wanting help with

    Posted in: Triggers
  • 0

    posted a message on HELP - Actor Set Tint to Life Percentage

    There are trigger conditions for when a unit takes damage. There are actions which set the tint of actors...

    Don't see why not.

    Posted in: Triggers
  • 0

    posted a message on [Trigger] [solved]Choices

    @KillerJoe1273: Go

    In the starcraft 2 map editor these are called dialogs (the background for menus) and dialog items which you attach to dialogs (which include buttons, images, text boxes etcetc).

    Happy googling -> http://lmgtfy.com/?q=starcraft+2+galaxy+editor+dialog+tutorial

    :)

    Posted in: Triggers
  • 0

    posted a message on Is this idea possible?

    @xHydrAx74: Go

    First of all I'm unsure what format handles have, I just know that it is a string which is a unique identifier.

    Players handles remain the same even if they change their name so I doubt there is any way you can get a players handle from their name. If you want to keep track of thier name you could store that as well.

    Say you have a list of handles for people who have hacked/spammed/been abusive. I'll use the setup you had above.

    reasons and handles should both be strings

    Variable - Set Names.reason[1] = "Unsporting conduct"
    Variable - Set Names.reason[2] = "AFK (as game started)"
    Variable - Set Names.reason[3] = "Early leaver"
    Variable - Set Names.handle_list[1] = "qwoidu9823yhe"
    Variable - Set Names.handle_list[2] = "987uyhwejkdh"
    Variable - Set Names.handle_list[3] = "0csd98hjk1"

    in the melee init trigger have code simillar to

    int this_player;
    int list_number;
    string handle;
    
    for each (this_player) in player group (all players)
    {
         set variable handle = handle of player (this_player)
         for each (list_number) from 1 to 3 with increment 1
         {
              if Names.handle_list[list_number] == handle
              {
                   text message (combine text (name of player(this_player), "is on the ban list because", Names.Reason[list_number]));
                   /*** put code here to perform actions on people on ban list ***/
              }
         }
    }
    

    Although it requires that you have a bit of familiarity with loops and arrays. If you don't then I would strongly suggest you go and find a tutorial and muck around with the basics first.

    Posted in: Triggers
  • 0

    posted a message on Is this idea possible?
    Quote from SouLCarveRR: Go

    @Stealthsam: Go

    Ban list implies preventing people from getting into the game at all.... removing them in lobby.

    Nothing you do with banks is going to prevent a player from playing prior to the game starting.

    No, but you can prevent them from impacting the game by not giving them any units and removing their chat window from view. About the only way I can think of for them to be disruptive after that is to pause (only works three times) or disconnect.

    OK so you guys don't like banlists (or simillar functionality if you don't want to call it a banlist)... how does deriding someone for asking about it help do anything but drive them away?

    If you want to link them to a reasoned post to dissuade them then do so. But don't just call them stupid for wondering how to implement a common feature and at LEAST try and add something useful to the discussion.

    Posted in: Triggers
  • 0

    posted a message on Is this idea possible?

    Making a banlist is possible. Lots of maps have them and it is not very hard to create one.

    What you are doing is the same principle.

    You cannot convert a text into a string. You need to store the players names and the reasons for being banned in a string and then convert them to text if nescissary.

    The function "player handle" returns a unique string identifier for each person on Bnet. You can store that string along with a string for the reason. When the map starts up get the handle of each player, use it to look up your table and then apply modifications if needed. If you want to print out the reasons then you can easily convert a string into text with the "convert string to text" function.

    Posted in: Triggers
  • 0

    posted a message on [Solved] Detecting how many players started the game ?

    @Skobe: Go

    the built in function "all players" returns a player group with all players. Run it on map initialization and store the result if you need to refer to it later.

    as an example usage:

    int i;
    for each i in player group (all players)
         create command centre for player i
    
    Posted in: Triggers
  • 0

    posted a message on Math Question

    OK, well what I would do is establish a set of points (I'm going to assume 5 points) along a curve. When you issue a command to a unit you can set an option to "after existing orders" which means that you can get it to follow from one point to the next. I'm going to have to assume you have a GOOD understanding of trigonometry, how to use arrays and hopefully understand polar co-ordinate systems otherwise this will be very hard to explain.

    Step 1) defining the shape of the curve

    Forget about unit locations, angles and all that complicated stuff! Just think about the shape you want on a simple x-y plane. Like a graph where x goes from 0-1 and y is the shape of the curve.

    Have one array called curve which is of type "point" with size = 5.
    Set all the x values to [0.2, 0.4, 0.6, 0.8, 1]
    set all the y values so that it forms the curve that you want. for example:
    [0,0,0,0,0] is a straight line,
    curve = [1, -1, 1, -1, 0] would be a zig-zag,
    curve = [0.4, 0.489, 0.489, 0.4, 0] is a semicircle,
    curve = [0.587, 0.951, 0.951, 0.587, 0] is the top part of a sine wave and
    curve = [0.25, 0.5, 0.7, 0.65, 0] is just some numbers that I came up with that I think would look like a boomerang curve.

    step 2) scaling

    now that we have the shape of the curve defined we want to make it the right size for our situation. which means that it needs to be stretched or shrunk depending on the distance between Tasadar and his target.

    so create a function called scale which takes a point P, a real A and returns a point P*A

    function scale(point P, real A)
    {
         x = x value of P;
         y = y value of P;
         return (x*A, y*A);
    }
    

    step 3) rotating

    we need to get our curve to be oriented in the right direction. Rotation of a point by an angle is complex, feel free to bang your head on a wall looking up the proof... but the equation is:
    x' = x*cos(a) - y*sin(a)
    y' = x*cos(a) + y*sin(a)

    where x and y are the coordinates of the point before the rotation and x' and y' are the points after rotation.

    for example the point (1, 0) rotated 0.5*pi (or 90 degrees) is (0, 1)

    wikipedia article: http://en.wikipedia.org/wiki/Rotation_%28mathematics%29

    function rotate(point P, real angle)
    {
         x = x value of P;
         y = y value of P;
         new_x = x*cos(angle) - y*sin(angle);
         new_y = x*cos(angle) + y*sin(angle);
    
         return (new_x, new_y)
    }
    

    step 4) translation

    the curve is in the right direction and right size but needs to be in the right place

    translate(point P, point offset)
    {
         x1 = x value of P;
         y1 = y value of P;
         x2 = x value of offset;
         y2 = y value of offset;
    
         return ((x1 + x2), (y1 + y2));
    }
    

    step 5) combining it all together

    set curve as a global variable with the desired shape of the curve

    {
         integer i;
         point next_point;
    
         distance = distance between Tasadar and target;
         angle = angle between Tasadar and target;
    
         i = 0;
         while(i < 5)
         {
              next_point = scale(curve[i], distance);
              next_point = rotate(next_point, angle);
              next_point = translate(next_point, position of Tasadar);
              order target to move to next_point after existing orders;
              i = i + 1;
         }
    }
    

    This will cause the projectile to arc towards its target in the desired tragectory. In the example above there are only 5 points along the curve but you can make it as detailed as you want to make it a very smooth path.

    PS
    WOW, ok that took a lot longer to explain how to do than I thought it would. I guess it's like most things, once you know how to do it it sounds easy until you have to explain it to someone else and only then do you realize how complicated it is. Hopefully you understood me most of the way through

    Posted in: Triggers
  • To post a comment, please or register a new account.