• 0

    posted a message on Galaxy++ editor

    @elunder: Go

    I would try it like this:

    string[] names = new string {"Zeratul", "Tychus", "Rory", "Nova", "Tassadar", "Egon"};

    or

    string[] names = {"Zeratul", "Tychus", "Rory", "Nova", "Tassadar", "Egon"};

    I'm not 100% positive those will work, and I don't currently have access to a compiler so I can't check. But I think the second one would probably work, it is the C-style method for initializing arrays. The only difference would be that the memory isn't dynamically allocated. But, since you presumably don't intend to ever delete that array (and it's pretty tiny) it shouldn't make a difference.

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor

    So with the 1.5 patch beta presumably starting soon, I was wondering if you have any idea how long it will take to incorporate the API changes into Galaxy + + ? Too soon to tell?

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor
    Quote:

    For dynamically sized arrays:

    Foo*[] array = new Foo*[42]();

    Just because I recently had difficulty with this, I want expand on that. The above statement only declares the initial array of 42 Foo pointers that don't point to anything (technically I think they are all pointing to the same object, but not important). To actually use the array, you'd have to go through and declare each one in something like:

    array[0] = new Foo();
    array[1] = new Foo();
    
    //or
    
    for(int index = 0; index < 42; index++)
          array[index] = new Foo();
    

    This only applies to arrays of pointers.

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor

    I didn't realize gpp supported casting. That works perfectly!

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor

    Thanks, you were right. I was thinking in terms of C arrays where you would declare an array of objects all in one statement, instead of first declaring the array of pointers, then instantiating new objects for each pointer. I was thinking the second declaration was implicit, not in terms of "pointer to a pointer".

    As a suggestion for a feature, did you consider allowing a conversion from int to fixed, possibly with a warning? I understand you obviously would lose precision, but my experience is largely with C where I have learned not to care. Galaxy provides a function for this already:

    int TruncI ( fixed x )
    

    Or, you could just make me do the type conversion explicitly. :)

    Edit:

    Also, I just found a small bug. I was trying to create an infinite loop by using for(;;), which does appear to be valid in straight Galaxy. This crashes the compilation job. I sent a report via the in-editor tool.

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor

    I'm not sure why that worked for you, but not for me. I tested mine inside of a much larger beast, but this was early enough in execution that it shouldn't have mattered. I wish I could test it more, but unfortunately my work laptop is picky about running the editor.

    Attached is a copy of part of my map code. I believe it is enough. I had to make some adjustments for clarity without the benefit of a compiler to double-check me, but I think it will compile fine.

    Did not know the compiler would handle the string to text conversion on its own, that's cool!

    Also, I would like to mention a small bug that I found the other day. If I do something like:

    /*///////////////////////////////////////////////////
    
                        DATA
    
    ////////////////////////////////////////////////////*/
    

    The code coloration will not catch the last */ . It will list the entire rest of my code as comments. It still compiles (parses?) correctly, it is just the color that's off.

    Posted in: Third Party Tools
  • 0

    posted a message on Galaxy++ editor

    First off, let me say, great project! You are awesome!

    About a year ago I started a map project using Andromeda. I recently returned to working on it, and Andromeda is no longer updated, where your language has grown significantly. As such, I decided to switch my development over to gpp . I'm still trying to get the hang of your language.

    I'm having a problem using arrays of objects. I'm not sure how to create a multidimensional array of objects that works reliably, and I am getting bizarre behavior if I try to create an array of pointers. My testing so far makes me think it is the same for structs and classes. Here is my data declaration:

    HeroData, BaseData, PlayerData - structs UnitList - object

    HeroData[] HERO_DATA;
    BaseData[] BASE_DATA;
    UnitList*[][] SPAWN_LIST_DATA;
    PlayerData[] PLAYER_DATA;
    

    At first, I had tried to do the HeroData declaration as HeroData*[], an array of pointers to a the HeroData struct. However, it seems whenever I do that, all entries in the array point to the same object. The following shows the error:

        PlayerData*[] test;
        
        test[0] = new PlayerData();
        test[1] = new PlayerData();    
        test[0]->heroLimit = 5;
        test[1]->heroLimit = 10;
        TriggerDebugOutput(1, StringToText(test[1]->heroLimit), true);
        TriggerDebugOutput(1, StringToText(test[0]->heroLimit), true);
    

    Am I just using arrays of pointers wrong? The problem did go away for the structs when I declared it as a straight array instead of an array of pointers, but I suspect it is still present in UnitList*[][]. Since that one is a pointer to a class, I am required to declare it as a pointer or else it gives me the "classes must be dynamic" error.

    Let me know if I wasn't clear enough about anything, or if you'd like to see some map code.

    Edit: Apparently using the plusplus operator makes my text appear green? Well that's weird!

    Posted in: Third Party Tools
  • 0

    posted a message on How to put the value "all players"and"any unit" into a trigger

    It depends on how you want to use the "any unit" or "any player" concept. What you are describing seems to be "all units" or "all players" which is a little different.

    When you are creating events for triggers, you are allowed to create them generally for "any unit" just by putting in null for that value. If you mean actions for the triggers, then yes, you would have to use the method described by DaveSilver above.

    Posted in: Triggers
  • 0

    posted a message on Double Arrays

    @Juxtapozition: Go

    No, that isn't the way that arrays work in Galaxy. I think TacoManStan was saying he worded his initial post badly so it sounded like he was saying that.

    My understanding is that all arrays are static in Galaxy. In order to have arrays that could adjust their size in the middle of execution, we would need to have pointers for dynamic memory allocation (because an array is really just a pointer to the first element in the array). No pointers means no dynamic arrays.

    In short: all arrays in Galaxy must be defined to a constant size when you instantiate them, and that size can never change. So, make sure you declare it to be large enough to hold whatever data you need, but not much larger than that because you will start wasting a lot of resources.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Trigger Efficiency

    I have a question regarding the efficiency of triggers. I understand that in general, the fewer the triggers the better. I also understand why it is extremely inefficient to have several triggers with the same conditions (especially vague conditions) running at the same time. However, my question is whether it is better to have several very specific triggers with similar conditions, or one trigger with a general condition that leads to a function with a lot of if/else statements?

    For example, in my map, every time a worker unit dies it respawns at a given player's spawn point. The map starts out by binding the "Unit Dies" event to that specific unit. The "Unit Dies" trigger disables itself when the worker dies, and then a new "Unit Dies" trigger is created for the replacement worker that spawns. I am trying to figure out whether I should have just an "Any Unit Dies" trigger with if/else statements instead, but I'm not sure whether the game's trigger condition system is more efficient than if/else is.

    Any thoughts?

    Posted in: Triggers
  • 0

    posted a message on Detaching a model from a unit

    @Nerfpl: Go

    Thank you, that worked marvelously. I totally missed the Kill Model function. To be more specific, in case somebody else needs this:

    The "Attach Model to Unit" function returns an actor. That actor is the model that you are attaching to the unit. So, if you save that actor in a variable, when you want to remove it later, you use the "Kill Model" function. You just pass it the actor that you saved previously, and it will be destroyed.

    Posted in: Triggers
  • 0

    posted a message on Detaching a model from a unit

    I am trying to make a unit pick up an object and appear to have the object in the unit's hand. I accomplished this using the "Attach Model to Unit" trigger. That part works great, the model shows up on the unit (at attachment point Hardpoint, if it matters) as expected. However, I am at a loss as to how to have the unit drop the object.

    I have tried attaching "null" to the hardpoint to try and override the object, but that doesn't help. I have tried using the Unload Model/Reload Model commands, but that doesn't get rid of the attachment. I also tried the Set Unit Model Variation command, which will change the base model, but the attachment carries over. I considered killing and respawning the unit, but I think that would open the door to a myriad of other bugs.

    Does anybody know how to detach a model from a unit once it has been attached?

    Posted in: Triggers
  • 0

    posted a message on XP for killing allied units

    I am trying to create a system that basically says for every 5 kills by player X, player X receives 100 minerals. I would like both allied and enemy units to count towards getting the minerals. My thought was to set every unit's XP reward to 1, and then create a trigger to listen for every time a unit gains a level. Upon gaining a level, the trigger resets the level/xp of that unit back to 0.

    The problem is that friendly units don't count towards a unit's XP gain. I know I could use more generic trigger "Any Unit Dies" trigger, but there can be heavy fighting between very large armies in my map so I'm trying to avoid "Any Unit Dies" triggers because of lag. Can anybody think of a way to make this work, or an alternate system that would be unlikely to create lag for me?

    Posted in: Data
  • 0

    posted a message on Resurrection of the old maps

    If anybody is interested, I have nearly completed a Siege of Gondor remake. I only need to add another couple of features and test a few complete games to make sure there aren't any major bugs I have overlooked. I expect to have it completed by the end of August. At some point after that I will probably start working on converting Hyrule Catastrophe over.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Are random numbers really random?

    Thanks for your replies. I have another question that is related to this. If I did decide that I was dissatisfied with SC2 random numbers, I imagine it wouldn't be terribly difficult to find a more powerful pseudorandom number algorithm to use instead. However, are there any thoughts on what I could use as a seed? I know the standard is usually number of clock cycles since a given time, but I somehow doubt SC is going to give me access to that. Obviously if I do go this route I won't want to rely on galaxy's built in random number generator since that would defeat the purpose entirely. Any thoughts?

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