• 0

    posted a message on Random Hero Trigger Help

    You have

    Variable - Set Hero Selection - Hero Picked[x] = True
    

    Looks like that should be

    Variable - Set Hero Selection - Hero Picked[Random Number] = True
    

    instead.

    Posted in: Triggers
  • 0

    posted a message on Script load failed: Syntax error when map starts?

    In your last file, you have an if without parenthesis.. that wouldn't be valid in galaxy++ either.

    Also, in same file, you use UIDisplayMessage with something of type string passed in last argument. In galaxy, you would have to convert it to a text.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Some Galaxy Discoveries

    Functions called libNtve_gf... are not actually native functions - they are galaxy functions located in the native lib.

    Native functions are those you find defined like

    native playergroup PlayerGroupAll ();
    

    Without an implementation.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Unit scoring help.

    I'm not sure how lava kills, but add

            (Killing player) != (Triggering player)
    

    to the conditions of your unit dies trigger. It ensures that a player can't get points for killing his own units.

    Also.. having a trigger pr player, where the only difference is the player number is generally bad style. You should join them together into one trigger, by making your global kills variable be an array big enough to have an index pr player, and then index the array with the player number. Like so

    Modify Kills
        Events
            Unit - Any Unit dies
        Local Variables
        Conditions
            (Killing player) != (Triggering player)
            (Killing player) != -1
        Actions
            Variable - Modify Kills[(Killing player)]: + 1
            Leaderboard - Set Kills Leaderboard item text at column 2 and row (Killing player) to (Text(Kills[(Killing player)]))
    
    Posted in: Triggers
  • 0

    posted a message on StarCode outside SC2

    Since galaxy script is so close to c++, it doesn't take much energy to convert a script to a c++ program.. Just copy the script, and make some c++ functions that does the same as the native functions.

    I did it for that starcode library.. Didn't take long.

    Posted in: Triggers
  • 0

    posted a message on How to start

    All you really need to learn then is the syntax and the names of the functions.. You can learn that by staring at some code, if you know what it is doing.

    One way of doing it is to write something in GUI, and then looking at the generated script (ctrl-F11 in the triggering editor), to figure out what GUI corresponds to what galaxy code.

    Also, a while back, I made some videos about the features of galaxy++.. The language has changed a bit since then, but you should still be able to learn from them..
    http://www.sc2mapster.com/forums/development/galaxy-scripting-and-trigger-lib/23993-intro-videos-to-galaxy/
    Do note the red text at the start of the thread ;)

    Those videos obviously doesn't show you pure galaxy, but I would recommend g++ over pure galaxy, simply because it removes some annoyances, and makes things easier..
    But then - I created it, so a recommendation from me is not saying much.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Vertical scroll bar for dialog

    I used the resolution library to calculate click positions before. its quite simple..

    int clickX = 1200*EventMouseClickedPosXUI()/GetRes.gv_getResolution_PlayerResolution[EventPlayer()][1];
    int clickY = 1200*EventMouseClickedPosYUI()/GetRes.gv_getResolution_PlayerResolution[EventPlayer()][1];
    

    I did encounter some problems on the right side of the screen.. There seems to be an area there where all points get same x coordinate.

    Yeah, it would be waaay easier to not have a scroll bar.. But if you really want a scroll bar, that is the way I would do it.

    Performance wise, the latency on bnet will cause the scroll bar to be a bit slow to respond. I did something similar, where I made it possible to move dialogs around with the mouse - like windows applications. I don't remember it to be too bad on bnet. Still - even when not on bnet, don't expect it to be fully responsive.

    Posted in: Triggers
  • 0

    posted a message on Vertical scroll bar for dialog

    You can code it yourself by having an image for your scroll bar (must be non clickable), then when the player presses mouse down, you get the coords, and calculate if it was on the image. If so, you enable the scroll trigger which listens for mouse move events, and moves the scroll bar accordingly (move scroll bar image down, and everything else up, or vice verca). Put "everything else" into a transparent dialog to get cut offs with stuff out of the window.
    Disable the scroll trigger if the scrolling players release the mouse button.

    It takes a bit of coding, but I'm sure it can be done.

    Posted in: Triggers
  • 0

    posted a message on Unit choose and skip not playing player

    While your at it. I would change your global variables from having one pr player to having an array. That way you can index the array with the player number, and it will be easier to make general triggers.

    Try something like this

     //Init theese at map init or something
     Mini FFA = No Region <Region[5]>
     Grouppi Mini FFA = (Empty unit group) <Unit Group[5]>
    
     
     
     Events
            Dialog - Any Dialog Item is used by Any Player with event type Clicked   <<------------- Changed to any player
        Local Variables
            x = 0 <Integer>                         <<---------------- Added x
        Conditions
            Or
                Conditions
                    (Used dialog item) == Marine Nappi
                    (Used dialog item) == Marauder Nappi
                    (Used dialog item) == Reaper Nappi
        Actions
            General - Switch (Actions) depending on (Used dialog item)
                Cases
                    General - If (Marine Nappi)
                        Actions
                            General - Repeat (Actions) 30 times
                                Actions                                    <<-------------- Canged global variables to use arrays ------------->
                                    Unit - Create 1 Marine for player (Triggering player) at (Center of Mini FFA[(Triggering player)]) using default facing (No Options)
                                    Unit Group - Add (Last created unit) to Grouppi Mini FFA[(Triggering player)]
                            UI - Display ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color)))) + " Choose Marine.") for (Players on team 2) to Subtitle area <<---------- Not sure why you have team 2 here..
                            Unit Group - Pick each unit in Grouppi Mini FFA[(Triggering player)] and do (Actions)
                                Actions
                                    Unit - Pause (Picked unit)
                    General - If (Marauder Nappi)
                        Actions
                            General - Repeat (Actions) 15 times
                                Actions
                                    Unit - Create 1 Marauder for player (Triggering player) at (Center of Mini FFA[(Triggering player)]) using default facing (No Options)
                                    Unit Group - Add (Last created unit) to Grouppi Mini FFA[(Triggering player)]
                            UI - Display ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color)))) + " Choose Marauder.") for (Players on team 2) to Subtitle area
                            Unit Group - Pick each unit in Grouppi Mini FFA[(Triggering player)] and do (Actions)
                                Actions
                                    Unit - Pause (Picked unit)
                    General - If (Reaper Nappi)
                        Actions
                            General - Repeat (Actions) 30 times
                                Actions
                                    Unit - Create 1 Reaper for player (Triggering player) at (Center of Mini FFA[(Triggering player)]) using default facing (No Options)
                                    Unit Group - Add (Last created unit) to Grouppi Mini FFA[(Triggering player)]
                            UI - Display ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color)))) + " Choose Reaper.") for (Players on team 2) to Subtitle area
                            Unit Group - Pick each unit in Grouppi Mini FFA[(Triggering player)] and do (Actions)
                                Actions
                                    Unit - Pause (Picked unit)
                
            Dialog - Hide Yksikko valinta for (Player group((Triggering player)))
            <<-------------- Changed all your if then else to one if then, inside a for. ----------------->>
            General - For each integer x from ((Triggering player) + 1) to 4 with increment 1, do (Actions)
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        (Status of player x) == Playing
                    Then
                        Dialog - Show Yksikko valinta for (Player group(x))
                        UI - Display ((Text (Name of player x) with color (Color((Current player x color)))) + " Choose unit. Please wait.") for (All players) to Subtitle area
                        General - Skip remaining actions
            
            <<------------- Also put this inside a for, just to make it more compact ------------>
            General - For each integer x from 1 to 4 with increment 1, do (Actions)
                Unit Group - Pick each unit in Grouppi Mini FFA[x] and do (Actions)
                    Actions
                        Unit - Unpause (Picked unit)
            UI - Display "Game has started!" for (All players) to Subtitle area
    
    Posted in: Triggers
  • 0

    posted a message on Physics Engine Help

    Well, it depends on your engine.. That code, for example, comes from a space game simulator, where people can fly around with 3rd person camera (controlling all of yaw, pitch and roll). In that scenario, to rotate actors, I can't use units, I have to create raw actors in triggers instead. Therefore I made the projectiles purely in triggers.

    But if you do have units, you could make an ability that launches a missile to some target point/unit when used, and then make the unit use that ability from triggers. Ask in the data section for the specifics of making the ability and mover.. How to make movers do as I want has always been confusing for me :)
    Having a periodic event running multiple times pr seconds is not the most efficient way of moving a projectile. I haven't done it, but you could try and make a test map to check the performance online on bnet. Of course, if it is a single player map, then performance shouldn't be a problem.

    Posted in: Triggers
  • 0

    posted a message on Physics Engine Help

    I'm not sure exactly what your asking, but if you're trying to make your own projectile flight paths from units, then I suggest you look at the movers category of the data editor, since that seems to be what is dedicated to this stuff.. I can't help you much there though, since I'm more of a script guy :)

    Anyway, doing it in script, I would do something like, create an actor for the model of your projectile, and have a struct which contains the relevant data for your projectile (actor, position, velocity and stuff), then you can update the data in a periodic trigger. Like every 0.1 seconds.

    I would model the position and velocity with the point variable type (consider it a 3d vector). Every update, you add acceleration to your velocity (if any - like gravity). Then add the velocity to your position, and update the position of your actor.

    struct StrProjectile
    {
        actor a;
        point position;
        point velocity;
        point acceleration;
    }
    StrProjectile Projectile;
    
    void Init()
    {
        Projectile.position = PointFromXYZ(0, 0, 0);
        Projectile.velocity = PointFromXYZ(0, 5, 5);
        Projectile.acceleration = PointFromXYZ(0, 0, -0.982);
        Projectile.a = CreateModelAtPoint("IonCannonsWeapon", Projectile.position);
    }
    
    Trigger Update
    Event:
        Every 0.1 seconds
    Actions:
        Projectile.velocity = PointFromXYZ(PointGetX(Projectile.velocity) + PointGetX(Projectile.acceleration), ...);
        Projectile.position = PointFromXYZ(PointGetX(Projectile.position) + PointGetX(Projectile.velocity), ...);
        ActorSend(a,"SetPositionH "+FixedToString(PointGetX(Projectile.position),6)+","+FixedToString(PointGetZ(Projectile.position),6)+" "+FixedToString(PointGetZ(Projectile.position),6));
    

    I apologize that the pseudo code is closer to custom script than triggers, but it is based on my own project, and I don't feel like writing it in GUI. I hope that you can get something from it anyway. But unless you are somehow prevented from using the data editor, I would suggest you try and use that first.

    Posted in: Triggers
  • 0

    posted a message on Dialog item variable problem

    You can refference global variables from events (with custom script atleast). But it wouldn't make sence, since GUI events are added to triggers at map init, and at that point in time, your variable will have the value "No dialog item" - which is not what you want. Regardless of what the variable will be in the future, it is the value it has when the event is registered that counts.
    I'm guessing this is why blizzard decided not to show them on the list - to avoid confusion.

    The only way to do it in pure GUI is as suggested, use conditions. The only downside is that if you have 50 buttons, and one of them is pressed, 50 triggers will be run, and 49 of them will fail the conditions. Where with custom script, you can add the events after you create the button, and then only have 1 trigger run when you press the button.

    For most cases, this is not an issue. It will probably be a tiny bit faster with just one trigger, but it will most likely be unnoticeable. Some people have been getting errors about too many triggers running at the same time when using the GUI way, but I think you will need to create a lot of dialog triggers before you run into that problem.

    Posted in: Triggers
  • 0

    posted a message on Galaxy++ editor

    Yeah, I haven't been very active on this for some time - due to christmas, exams and swtor that I wanted to try. I should be able to get some work done on it soon though - just one nasty exam left, and I don't play as much swtor now that I really only need to raid.

    The server was down for maintenance for a while.. It happens from time to time.

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor

    You got a lot of code, and very few green lines.
    As I understand it. You want to implement delegates using triggers instead of if-sentences, and add support for interfaces, both of which seems doable.

    I want to get the dialog part finished before moving on to something else though.

    Posted in: Third Party Tools
  • 0

    posted a message on Dialog Drag and Drop designer

    @FuzzYD: Go

    I don't know how familiar you are with g++, but if you look in the designer, you will see that the dialog is created inside a class, and this class has a field for each dialog/button/image/etc. So referring to an image you called image1 is just writing

    Newdialog* dialog = new Newdialog();
    dialog->image1
    

    That will return the integer handle for the image.

    If you would rather use regular galaxy, set maximum number of instance for the dialog to something, like I do in the video, then in the output script, you will see a struct with an int for each dialog/button/etc, an array of this struct, and a function that creates a dialog when given an index into that array.

    Also note that everything has a "name" property, where you can change the name, if you don't like them to be image1, button1, etc.

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