The lag spike is probably caused by the debug window. If you go for a performance test, always publish the map and test in battlenet. Using the test button and debug window hurt performance a LOT.
If the boolean doesn't work, you did something wrong. Just like disabling the trigger.
There is a small delay between the trigger and the start of the next trigger, so if you do stuff like
it won't work, because the event for changing the dialog stuff would trigger, after the whole trigger finished. Same, if you did set the boolean before and after the setting.
The debug menu is not the cause of the lag spikes, I started it up AFTER the lag spikes started to try and find a source, it's from then that I noticed that my trigger was running multiple times at once.
There is a small delay between the trigger and the start of the next trigger
After reading what you said I decided to try doing this
Set boolean[player] = false
set dialog item stuff
wait 0.1 seconds
Set boolean[player] = true
And now the trigger no longer loops, the "wait" is very important as it keeps the trigger off for that small delay you mentioned, so I had to make the boolean an array (1 for each player), thank you for telling me that very enlightening piece of information. The only time I see this being an issue is if the player happens to click more than 1 dialog item within a tenth of a second, which I am not worried about. That solves my problem now.
I would suggest to set a global boolean. Add a check to the trigger if (boolean) then set boolean = false and skip remaining actions. Set the boolean before changing the dialog item in the trigger.
Unfortunately I have tried that, and the trigger still fires, and the trigger simply firing creates a spike of lag, and this is only with me testing it, can't imagine 12 players doing it at once.
I don't understand why the "Turn trigger off" doesn't work the same way it did in warcraft 3's editor, if I turned off the trigger there, it's events never fire. Yet this one makes them fire if the trigger trigger's it's own events.
Sorry, I don't have much time to give this full detail, but I have a problem. I can't get a trigger to not trigger it's own event, even after turning it off during the trigger execution.
An example of my Problem is if I have (this is only an example, it's not my trigger)
Event - Any Dialog Item is Used by Any Player type Checked
Action - Used Dialog Item is Checked = true
If I try turning off the trigger before doing the action the trigger still loops on itself, and for some reason I can't get it to not do so. My map has a different looking trigger and each execution is laggy because of this. Anyone have a solution? Again sorry I don't have enough time to fully describe, I hope this is enough detail.
Edit: An FYI, the debug window will show whether or not the trigger is running multiple times as a result of triggering itself.
I would much rather have the option of going higher than 4 resources, a trigger built system is capable of this.
True it would be alot easier just to use the 4, additionally it would be alot easier if blizzard just let us add more resources to work with. But the point of this code is to act as a workaround.
Also, I plan to have certain trigger's that influence resources anyway, so having trigger's reference trigger data will save me the effort of bouncing between windows.
I'd much rather have costs and gathering rates influenced entirely through triggers, rather than trying to hybrid data editor content with trigger content, which has proven to be very time consuming.
More on topic, I found that using the Issue Order event is optimal for handling unit training instead of the use ability execute stage. Some adjustments need to be made to the structure trigger before I finish this however. Once I have got it working I will post what I have.
Well current step I'm on, having difficulty getting unit training to function properly, It's a little more complex than building a structure. Reason being that I need the resources to be deducted and refunded whenever a unit is trained and queued up. Problem is anytime a unit in the training queue moves to slot 1, it fires the execute stage, which in turn causes some issues. I am right now trying to find a workaround.
Well I guess I'll just crop screenshots then, they seem to be the best way to display the code clearly. Going to experiment now and see if I can find more ways to make this easier.
yeah sorry, I don't know the forum controls too well, is there anyway I can setup minimizations for these code segments? Also now that I'm more free than I was I can explain what each part does.
Strange issue at the moment, I can't get an Event to trigger when a building is canceled, is there a special event for that? Because I tried to make the event go off of using ability "Build In Progress - Command Cancel" but it doesn't even fire once.
Edit: Well I feel dumb, the moment I post this reply I found out all I had to do was try the event "Unit issued order"
At any rate I'll post my current setup so I can get some feedback and possible suggestions. Also anyone who views it can use it for themselves
EDIT2: Try using a hidden behavior to account for resources. Set the resource amount in a variable, then apply that number of behaviors to every builder owned by the player. Then you can use "Count Behavior" in Requirements.
Actually count behavior can be detected globally, so I could just have the behaviors counted on a dummy unit in that respect. Only issue with that setup is it ends up requireing work in both the trigger editor and data editor, the solution I need has to either use the data editor entirely, or use the trigger editor entirely.
Thanks for the suggestion though, it was definately worth thinking over.
The title may not summarize this well enough. What I am working on currently is a type of strategy game (think age of empires, rise of nations, empire earth) that uses more than the standard 2 resources provided by starcraft 2. As a result I need to create several more resources to be used for constructing structures and training units.
I already have the syntax I would need for handling the player errors of preventing construction from lack of resources, but I am currently trying to organize an effecient way of applying these variables to each individual unit that I create.
Here is my issue, I need a trigger that checks when a play trains a unit or builds a structure, then the trigger needs to check to see if the player has enough resources for the structure, and if they don't the trigger prevents them from building or training.
I already have the actions for preventing the building and training, however with the event handling, I have not found an effecient way to get the events and conditions to check for EVERY unit in bulk.
Obviously I realize that I will have to declare the custom costs of all the units in structures in the trigger editor as I doubt theres enough variables to use in the data editor. I am prepared to create a select case for each unit and structure to give them their individual costs, my main concern is event handling.
I need the trigger to fire whenever any unit or structure is trained or built, check for the resources, then cancel or allow the action as needed. Additionally, I'll need another trigger to fire when the structure is canceled, to refund the resources.
I like my code to be neat, and I know that the trigger editor has some amazing features for making a task like this very easy to keep clean, and I want to minimalize the work necessary for getting this task done.
Alternatively, if anyone knows of a way to get more than the 4 available resources (minerals, gas, terrazine, credits) to be used in the data editor, it would be great if I could just use those instead.
Here is what I managed to make so far, it works perfectly but I want to try and make it tighter and more effecient, if anyone can think of ways to make this easier to work with please feel free to speak up as I will be very grateful.
This is a custom Action Definition that when used, will cause the unit declared in it's "Unit" parameter, to skip it's current action and continue with the rest of the actions in it's queue. When I couldn't find an action in the list that mimicked this action, I felt it would be appropriate to make one, as I feel I would use this in several more areas than just these couple triggers.
This is a custom Function designed to organize all the different unit types that will have Custom Resource costs applied too them, Units listed in this function are given custom resource costs, and the type of resource in question can be chosen with the functions declaration (Custom Presets are also used to add the names of the resources Credits, Materials, and Development)
Any unit checked that is not listed in this function will turn up 0 for all resources.
However being that starcraft 2 uses build and train orders as abilities, these cannot be used for the train and build orders. But this function is still heavily utilized in the next one.
Just like the previous function, this function lists the Custom Resource costs of every units, but uses an Ability command in the place of a Unit Type for a parameter. This is where all the train and build abilities are listed for every unit and structure. Though being that I'm a programmer at heart, I cannot stand hard coding, so in this function I made sure that it utilized the previous function. This way whenever I make adjustments to costs, I only have to edit 1 field instead of 2.
The downside of having these two functions is every time I add a new unit or structure, I need to add them to this list, which can end up being time consuming. But considering the options it opens up, it's well worth it.
This is simply a trigger used to save me the effort of copying and pasting an event 30 times. The reason that this event is copied 30 times is because abilities cannot have more than 30 commands (or at least as far as I'm concerned) This trigger merely add's the event triggers for whenever a build or train order is started.
This is the primary trigger, it controls what happens when a unit attempts to build a structure that costs a custom resource. The trigger will fire anytime a structure is built, or canceled. The custom resources are spent and refunded immediately when the unit is on the "Build - Approach" ability phase. It then checks to see if the ability is one that uses the custom resources. If the resource requirements are not met, the custom Action is used to cause the builder to skip his current action, if the resource requirements are met however, the custom resource is spent accordingly.
This trigger also functions at 2 other different points, it triggers at the "Generic - Cancel" ability phase, and the "Unit is Issued Order" event. The generic cancel goes off whenever the builder is ordered to do something else before he has placed his building at the blueprint, this causes the resources for the canceled action to be refunded. The issued order event takes place when the player presses the cancel button on the constructing structure, which also refunds the resources. And this is how I currently have my resource management.
Ok for those search function users that are looking for the solution to "Removing an order from queue" for your triggers, I have a little solution for you.
Here is an action definition that you can use to make your life easier.
RemoveUnitCurrentOrderOptions:ActionReturnType:(None)ParametersUnit=NoUnit<Unit>GrammarText:Unitskipsitscurrentaction.HintText:(None)CustomScriptCodeLocalVariablesUnitOrderArray=NoOrder<Order[100]>
NumberOfOrders = 0 <Integer>
i = 0 <Integer>
Actions
Variable - Set NumberOfOrders = (Count of orders on Unit)
General - For each integer i from 1 to NumberOfOrders with increment 1, do (Actions)
Actions
Variable - Set UnitOrderArray[i] = (Unit order at index i)
Unit - Order Unit to ( Stop) (Replace Existing Orders)
General - For each integer i from 1 to NumberOfOrders with increment 1, do (Actions)
Actions
Unit - Order Unit to UnitOrderArray[i] (After Existing Orders)
Simply create this Action Declaration in your trigger editor, and whenever you want to remove the current order from the unit's Queue, just simply use this action and reference the unit in the parameter.
If you need to remove a certain order within the order queue, a little adjustment to the declaration can be made, but aside from that this should allow you to have orders skipped when you need it (such as not having enough custom resources for a structure)
Ok from what I gather, the "return order" function is used to grab the orders from a unit, and it can be indexed to look for specific ones, so I am guessing an order array is used to store every order past the first one, then the unit just has it's orders replaced with the newly made queue.
How to store an order queue? Or remove an order from the order queue of a unit?
Edit: Never mind, you can use an order array... didn't see that array checkbox...
That's great and all that you managed to solve your problem, however it would have been really helpful if you had posted for your solution so that when other people (like me) use the search function for a similar problem, they can see what others have done to solve the problem.
As for me, I am curious primarily how to remove a specific order from a units queue. I am developing a custom resource system (one that uses triggers to check for resources) and I want to setup a trigger so that after the player places a building into a workers build queue, after it checks that the player does not have available resources, it removes the build order from the queue, but continues with the rest of the queue.
Can anyone explain how to remove an order from the queue? I didn't see a single function that served that exact purpose, so I'm wondering what other setup I can use. I am also familiar with the scripting language if it is necessary or makes it easier.
I've actually completed a Dawn of War style squad system for a map I'm working on, so I have a piece of the puzzle. I think your map concept sounds pretty cool, there aren't very many original PvP strategy game concepts on bnet right now, or it doesn't feel that way to me.
I don't think you'd find a data-only solution that would be complete and good. I've looked at some ways to accomplish this sort of thing with data and it seems to me that organizing groups of units like this just seems saner when done with triggers. Everything you've mentioned sounds really straightforward to do with triggers. You could use data if you just want your units to travel in a group, I imagine there'd be a way to have the units issue an order at their commander to follow him, but you can run into some outside cases where units get stuck on one another and things like that that would probably be easier to handle with triggers, possibly a combination.
I agree, even though I posted this in the data forum I felt it might have actually fit better in the trigger forum, but the only reason I went through with posting is because the data editor is more foreign to me so I felt the Data forum would offer me some more research on the parts of the tool. Though I agree even while I was typing up this post I realized inevitably the complexity of my army design would be much easier to manage if it was trigger driven.
The way I'd do it with a trigger-based core, based on my experiences creating a squad-command system: you want to create a very large unit group array. Have a trigger give every commander-type unit a Custom Value, which for internal purposes will be the commander's unit group's ID number. When a unit falls under the leadership of a commander, get the commander's custom value, and place it in the appropriate address in the unit group array, and also give those units the custom value as well just so you have an easy way to figure that out.
Allow me to enlighten you on a technique I use that is actually alot easier to work with, currently my map has an indexing system that allows me to essentially set local variables on to anything, more importantly units. Basically every single unit in the game has a serial number, and that serial number can be referenced in triggers to get specific values related to that exact unit. Each data table entry basically needs a name, the way index each value is to have the name be the unit's unique ID, then after the unique ID I put whatever string I want to act as a name for the variable, essentially creating a local variable on that unit!
This is the current idea that I have in theory, I am intending to have the commander units have a certain way to add and remove units from their army. When a unit is added to the commanders army, I have the trigger first create a Unit Group if the commander hasn't one already, and store it in a data table. Then whenever the commander needs to add a unit to it's army, the commander would just use it's recruit skill on a unit, and the trigger would find the commanders unit group in the data table, and simply add the unit to that unit group.
Example: Army 1 has the unique ID of 106. When it's created it is given it's own unit group, this unit group is stored in the global data table, under the name of "106army" using the function "UnitGetPropertyInt(u, 9000, c_unitPropCurrent);" Or I simplified into it's own little custom function
The army then desides to add units to it's army, each time it does the "106army" is loaded from the data table, units are added, then it gets saved in the data table again.
Here's a rough draft of how I would have my army recruitment skill work on the most basic of level.
@Zackreaver: Go
Once you have the units in groups, you need a way to make them cohere as a unit. The major issue I can think of off the top of my head is - how large are these units? Having the units maintain a visually pleasing coherency is a different task depending on if they're units of 4-6 or 40-60. The most straightforward way is to just have the units follow the commander - literally issue a follow order. Give them a behavior to make them uncommandable and all that. This could be a real clusterf@#$ though with lots of units that travel at different speeds, or with too many units. The way I do my squads is when a unit receives orders, I use a slightly weird process to copy-paste the command units orders to the followers; you could do something similar with move orders. It's the sort of thing you just have to mess with until you get good results.
Everything else is just a matter of applying and removing behaviors.
I think generally its a good idea even if you use data in this way to keep the units in unit groups and keep track of them that way as a back up system. You could do something, for example, like put a "Rally Unit" button, and then when that ability is activated, call a trigger that rubber bands all the units to their commander. Another good thing to do would be to have a trigger that, when a battle starts, makes sure all the appropriate units are present and accounted for.
I think your biggest challenge is going to be aesthetic, and making these theoretical ideas actually play well in practice, the mechanics are pretty straightforward, however you do it.
The pathing at which the units follow the commander is one of the major things I'm here on the forum for, I'm hoping to find some way to make it not a clusterfk, though again I don't even know the scale of how big the armies are going to be, they might not even be that much larger than 20 units per army. As for the speeds, I'm going to have the units all share the same exact speed while following the commander, only changing speeds when they engage in combat, essentially just because an army has motorcycles and jeeps that move several times faster than the tanks, everyones going to stay together until they get deployed.
But generally, the units following behind are merely there for the purpose of cosmetics, essentially I was going to have them all stored in the army like a transport, but then I realized there are plenty of tools available to make the armies more visually realistic. But on the basic sense, the units location while following makes no different, everything will be dependant on the location of the armies leader. When the army actually engages in combat, all of the units essentially get moved instantly near the commander where the player then can assume control of them. The purpose of the army trailing behind the army to begin with, is to give other players a visual understanding of what they are about to face. Also I think it would be cool to watch a massive army slowly traverse across the map towards their destination, with the enemy discovering it and cowering in fear at the sight, panicking to prepare for it, or setup an ambush for it.
But your right, the hardest part will be the aesthetics, making these complex systems all becomes pointless if the execution doesn't bring about the entertaining result. The whole concept is to basically grant players a strategic level of army customization and placement. Also when the battles occur I want the end result to be controlled more by the players tactics rather than their reflexes. The battles will involve some moments of heavy micromanagement, but won't require massive amounts of hotkey mashing.
Simply put, I'm trying to make the game sort of play like an RTS version of civilization with battles that play like in Company of Heroes or Dawn of War 2.
Also on a quick note, my primary goal is to avoid creating systems that effect system performance. In other words, if my idea with indexing Unit Groups causes lag, I would like to know which methods would be more cost effective with resources.
Basically it's a question of what lags more, 50 unit groups with 10 units in each? 1 unit group with 500 units? Or an does an array of units cause more or less lag than a unit group? These are things I won't know until it's already in my map, regardless I want to try and use the most efficient method if I can.
0
The debug menu is not the cause of the lag spikes, I started it up AFTER the lag spikes started to try and find a source, it's from then that I noticed that my trigger was running multiple times at once.
After reading what you said I decided to try doing this
Set boolean[player] = false set dialog item stuff wait 0.1 seconds Set boolean[player] = true
And now the trigger no longer loops, the "wait" is very important as it keeps the trigger off for that small delay you mentioned, so I had to make the boolean an array (1 for each player), thank you for telling me that very enlightening piece of information. The only time I see this being an issue is if the player happens to click more than 1 dialog item within a tenth of a second, which I am not worried about. That solves my problem now.
0
Unfortunately I have tried that, and the trigger still fires, and the trigger simply firing creates a spike of lag, and this is only with me testing it, can't imagine 12 players doing it at once.
I don't understand why the "Turn trigger off" doesn't work the same way it did in warcraft 3's editor, if I turned off the trigger there, it's events never fire. Yet this one makes them fire if the trigger trigger's it's own events.
0
Sorry, I don't have much time to give this full detail, but I have a problem. I can't get a trigger to not trigger it's own event, even after turning it off during the trigger execution.
An example of my Problem is if I have (this is only an example, it's not my trigger)
Event - Any Dialog Item is Used by Any Player type Checked
Action - Used Dialog Item is Checked = true
If I try turning off the trigger before doing the action the trigger still loops on itself, and for some reason I can't get it to not do so. My map has a different looking trigger and each execution is laggy because of this. Anyone have a solution? Again sorry I don't have enough time to fully describe, I hope this is enough detail.
Edit: An FYI, the debug window will show whether or not the trigger is running multiple times as a result of triggering itself.
0
@TwoDie: Go
I would much rather have the option of going higher than 4 resources, a trigger built system is capable of this.
True it would be alot easier just to use the 4, additionally it would be alot easier if blizzard just let us add more resources to work with. But the point of this code is to act as a workaround.
Also, I plan to have certain trigger's that influence resources anyway, so having trigger's reference trigger data will save me the effort of bouncing between windows.
I'd much rather have costs and gathering rates influenced entirely through triggers, rather than trying to hybrid data editor content with trigger content, which has proven to be very time consuming.
More on topic, I found that using the Issue Order event is optimal for handling unit training instead of the use ability execute stage. Some adjustments need to be made to the structure trigger before I finish this however. Once I have got it working I will post what I have.
0
Well current step I'm on, having difficulty getting unit training to function properly, It's a little more complex than building a structure. Reason being that I need the resources to be deducted and refunded whenever a unit is trained and queued up. Problem is anytime a unit in the training queue moves to slot 1, it fires the execute stage, which in turn causes some issues. I am right now trying to find a workaround.
0
@BasharTeg: Go
Well I guess I'll just crop screenshots then, they seem to be the best way to display the code clearly. Going to experiment now and see if I can find more ways to make this easier.
0
@BasicGear: Go
yeah sorry, I don't know the forum controls too well, is there anyway I can setup minimizations for these code segments? Also now that I'm more free than I was I can explain what each part does.
0
Heres what I have currently, and this time I edited it to avoid brain explosions.
Edit: Moved to the first post.
0
Strange issue at the moment, I can't get an Event to trigger when a building is canceled, is there a special event for that? Because I tried to make the event go off of using ability "Build In Progress - Command Cancel" but it doesn't even fire once.
Edit: Well I feel dumb, the moment I post this reply I found out all I had to do was try the event "Unit issued order"
At any rate I'll post my current setup so I can get some feedback and possible suggestions. Also anyone who views it can use it for themselves
0
Actually count behavior can be detected globally, so I could just have the behaviors counted on a dummy unit in that respect. Only issue with that setup is it ends up requireing work in both the trigger editor and data editor, the solution I need has to either use the data editor entirely, or use the trigger editor entirely.
Thanks for the suggestion though, it was definately worth thinking over.
0
The title may not summarize this well enough. What I am working on currently is a type of strategy game (think age of empires, rise of nations, empire earth) that uses more than the standard 2 resources provided by starcraft 2. As a result I need to create several more resources to be used for constructing structures and training units.
I already have the syntax I would need for handling the player errors of preventing construction from lack of resources, but I am currently trying to organize an effecient way of applying these variables to each individual unit that I create.
Here is my issue, I need a trigger that checks when a play trains a unit or builds a structure, then the trigger needs to check to see if the player has enough resources for the structure, and if they don't the trigger prevents them from building or training.
I already have the actions for preventing the building and training, however with the event handling, I have not found an effecient way to get the events and conditions to check for EVERY unit in bulk.
Obviously I realize that I will have to declare the custom costs of all the units in structures in the trigger editor as I doubt theres enough variables to use in the data editor. I am prepared to create a select case for each unit and structure to give them their individual costs, my main concern is event handling.
I need the trigger to fire whenever any unit or structure is trained or built, check for the resources, then cancel or allow the action as needed. Additionally, I'll need another trigger to fire when the structure is canceled, to refund the resources.
I like my code to be neat, and I know that the trigger editor has some amazing features for making a task like this very easy to keep clean, and I want to minimalize the work necessary for getting this task done.
Alternatively, if anyone knows of a way to get more than the 4 available resources (minerals, gas, terrazine, credits) to be used in the data editor, it would be great if I could just use those instead.
Here is what I managed to make so far, it works perfectly but I want to try and make it tighter and more effecient, if anyone can think of ways to make this easier to work with please feel free to speak up as I will be very grateful.
This is a custom Action Definition that when used, will cause the unit declared in it's "Unit" parameter, to skip it's current action and continue with the rest of the actions in it's queue. When I couldn't find an action in the list that mimicked this action, I felt it would be appropriate to make one, as I feel I would use this in several more areas than just these couple triggers.
This is a custom Function designed to organize all the different unit types that will have Custom Resource costs applied too them, Units listed in this function are given custom resource costs, and the type of resource in question can be chosen with the functions declaration (Custom Presets are also used to add the names of the resources Credits, Materials, and Development)
Any unit checked that is not listed in this function will turn up 0 for all resources.
However being that starcraft 2 uses build and train orders as abilities, these cannot be used for the train and build orders. But this function is still heavily utilized in the next one.
Just like the previous function, this function lists the Custom Resource costs of every units, but uses an Ability command in the place of a Unit Type for a parameter. This is where all the train and build abilities are listed for every unit and structure. Though being that I'm a programmer at heart, I cannot stand hard coding, so in this function I made sure that it utilized the previous function. This way whenever I make adjustments to costs, I only have to edit 1 field instead of 2.
The downside of having these two functions is every time I add a new unit or structure, I need to add them to this list, which can end up being time consuming. But considering the options it opens up, it's well worth it.
This is simply a trigger used to save me the effort of copying and pasting an event 30 times. The reason that this event is copied 30 times is because abilities cannot have more than 30 commands (or at least as far as I'm concerned) This trigger merely add's the event triggers for whenever a build or train order is started.
This is the primary trigger, it controls what happens when a unit attempts to build a structure that costs a custom resource. The trigger will fire anytime a structure is built, or canceled. The custom resources are spent and refunded immediately when the unit is on the "Build - Approach" ability phase. It then checks to see if the ability is one that uses the custom resources. If the resource requirements are not met, the custom Action is used to cause the builder to skip his current action, if the resource requirements are met however, the custom resource is spent accordingly.
This trigger also functions at 2 other different points, it triggers at the "Generic - Cancel" ability phase, and the "Unit is Issued Order" event. The generic cancel goes off whenever the builder is ordered to do something else before he has placed his building at the blueprint, this causes the resources for the canceled action to be refunded. The issued order event takes place when the player presses the cancel button on the constructing structure, which also refunds the resources. And this is how I currently have my resource management.
0
@Zackreaver: Go
Ok for those search function users that are looking for the solution to "Removing an order from queue" for your triggers, I have a little solution for you.
Here is an action definition that you can use to make your life easier.
Simply create this Action Declaration in your trigger editor, and whenever you want to remove the current order from the unit's Queue, just simply use this action and reference the unit in the parameter.
If you need to remove a certain order within the order queue, a little adjustment to the declaration can be made, but aside from that this should allow you to have orders skipped when you need it (such as not having enough custom resources for a structure)
0
Ok from what I gather, the "return order" function is used to grab the orders from a unit, and it can be indexed to look for specific ones, so I am guessing an order array is used to store every order past the first one, then the unit just has it's orders replaced with the newly made queue.
Now all thats left is for me to make this work.
0
That's great and all that you managed to solve your problem, however it would have been really helpful if you had posted for your solution so that when other people (like me) use the search function for a similar problem, they can see what others have done to solve the problem.
As for me, I am curious primarily how to remove a specific order from a units queue. I am developing a custom resource system (one that uses triggers to check for resources) and I want to setup a trigger so that after the player places a building into a workers build queue, after it checks that the player does not have available resources, it removes the build order from the queue, but continues with the rest of the queue.
Can anyone explain how to remove an order from the queue? I didn't see a single function that served that exact purpose, so I'm wondering what other setup I can use. I am also familiar with the scripting language if it is necessary or makes it easier.
0
I agree, even though I posted this in the data forum I felt it might have actually fit better in the trigger forum, but the only reason I went through with posting is because the data editor is more foreign to me so I felt the Data forum would offer me some more research on the parts of the tool. Though I agree even while I was typing up this post I realized inevitably the complexity of my army design would be much easier to manage if it was trigger driven.
Allow me to enlighten you on a technique I use that is actually alot easier to work with, currently my map has an indexing system that allows me to essentially set local variables on to anything, more importantly units. Basically every single unit in the game has a serial number, and that serial number can be referenced in triggers to get specific values related to that exact unit. Each data table entry basically needs a name, the way index each value is to have the name be the unit's unique ID, then after the unique ID I put whatever string I want to act as a name for the variable, essentially creating a local variable on that unit!
This is the current idea that I have in theory, I am intending to have the commander units have a certain way to add and remove units from their army. When a unit is added to the commanders army, I have the trigger first create a Unit Group if the commander hasn't one already, and store it in a data table. Then whenever the commander needs to add a unit to it's army, the commander would just use it's recruit skill on a unit, and the trigger would find the commanders unit group in the data table, and simply add the unit to that unit group.
Example: Army 1 has the unique ID of 106. When it's created it is given it's own unit group, this unit group is stored in the global data table, under the name of "106army" using the function "UnitGetPropertyInt(u, 9000, c_unitPropCurrent);" Or I simplified into it's own little custom function
The army then desides to add units to it's army, each time it does the "106army" is loaded from the data table, units are added, then it gets saved in the data table again.
Here's a rough draft of how I would have my army recruitment skill work on the most basic of level.
The pathing at which the units follow the commander is one of the major things I'm here on the forum for, I'm hoping to find some way to make it not a clusterfk, though again I don't even know the scale of how big the armies are going to be, they might not even be that much larger than 20 units per army. As for the speeds, I'm going to have the units all share the same exact speed while following the commander, only changing speeds when they engage in combat, essentially just because an army has motorcycles and jeeps that move several times faster than the tanks, everyones going to stay together until they get deployed.
But generally, the units following behind are merely there for the purpose of cosmetics, essentially I was going to have them all stored in the army like a transport, but then I realized there are plenty of tools available to make the armies more visually realistic. But on the basic sense, the units location while following makes no different, everything will be dependant on the location of the armies leader. When the army actually engages in combat, all of the units essentially get moved instantly near the commander where the player then can assume control of them. The purpose of the army trailing behind the army to begin with, is to give other players a visual understanding of what they are about to face. Also I think it would be cool to watch a massive army slowly traverse across the map towards their destination, with the enemy discovering it and cowering in fear at the sight, panicking to prepare for it, or setup an ambush for it.
But your right, the hardest part will be the aesthetics, making these complex systems all becomes pointless if the execution doesn't bring about the entertaining result. The whole concept is to basically grant players a strategic level of army customization and placement. Also when the battles occur I want the end result to be controlled more by the players tactics rather than their reflexes. The battles will involve some moments of heavy micromanagement, but won't require massive amounts of hotkey mashing.
Simply put, I'm trying to make the game sort of play like an RTS version of civilization with battles that play like in Company of Heroes or Dawn of War 2.
Also on a quick note, my primary goal is to avoid creating systems that effect system performance. In other words, if my idea with indexing Unit Groups causes lag, I would like to know which methods would be more cost effective with resources.
Basically it's a question of what lags more, 50 unit groups with 10 units in each? 1 unit group with 500 units? Or an does an array of units cause more or less lag than a unit group? These are things I won't know until it's already in my map, regardless I want to try and use the most efficient method if I can.