| 11-20-2003, 05:28 AM | #1 |
I'm working on a bit of a strange map (a combination of sim city, civilization, and warcraft) and I need some help on various things. I realize I'm inexperienced, but if anyone could help me out I'd appreciate it. In my map, I want to have it so that for certain units, you need to have other units near the building in order to train units. I want it to work that when you click the train unit X button, it checks to see if a unit of type Y is within a certain range of the building. If there's a unit of type Y, training proceeds and that unit Y is removed. If there's no unit of type Y near the building, I want training to immediately cancel. Any ideas? Next, is it possible to change the texture of the blight? This isn't critical, but it could potentially help some things I want to do. On the subject of textures, is it possible to make it so that for a particular building, when it's placed, changes the texture of the surrounding area as well as makes that area unbuildable? I want to make a farm that requires workers to be on the "farmland" in order for it to produce food. How can I make units that appear neutral, but are in fact controlled by another player? I can probably do a workaround using the mechanical critters ability, but if there's an easier way it would really help. I'd like to make it so that allied players can set up a trade route with each other for a profit, sort of like in age of empires II. I'd like it so that if both players have a marketplace, they can build caravan units which will travel back and forth automatically bringing profits with each trip. Are movement speed and attack rate the only auras that can really boost worker productivity? On a similar note, could someone explain to me how auras of the same type stack? If I have one aura giving a 5% boost to speed, and another giving a 10%, does the unit get a 10% or 15% boost? I'd like to have some "encouragement" units to boost productivity. Is it possible to have an aura that boosts a unit's carrying capacity for gold and lumber? That's it for this round of questions. If anyone can help on any of them I'd appreciate it. I expect to be working on this for quite awhile, so I'm sure I'll be back with plenty more if you guys can help. |
| 11-20-2003, 07:32 AM | #2 |
Geez, where to start? Hm here goes. I think for your requiring units nearby for training, I would just write a trigger that ran on Generic Unit Event - A Unit is issued an order with no target, with conditions that made sure it was an order to train and the ordered unit was your building type - then actions that check whether or not the building is allowed to build, and if so, do nothing, but if it's not, cancel the order. Note, though, that there's no "Unit exits region" event, so if you want a unit leaving the area around a building to cancel the building's training, you'll have to do periodic events or some weird regioning. Well, if you want to change the blight textures you can try overriding the .blp files in TerrainArt\ - I don't know whether they're replaceable in import manager but even if they're not you might be able to sub them in with a war3patch.mpq. Er.. to make the area around a building unbuildable... you could make your own pathing map and place custom pathing blockers via triggers. Neutral-appearing units are easy - use the "unit - change color" action, it will change a units color without effecting its owner. I don't think auras of the same type stack at all. It sounds like the best way to do what you want with the auras that change carrying capacity is triggers that add and remove abilities for all units around the things with the aura... Anyway good luck with that... sounds like you've got a lot on your plate! |
| 11-20-2003, 07:48 AM | #3 |
Changing a unit's color won't stop the enemy from auto-aquiring it as a target, right? Same as the name text being Red when you hover cursor. I haven't messed with mechanical critters but that sounds like a good place to start if there isn't a direct method of doing what you want. |
| 11-20-2003, 08:07 AM | #4 |
OH, that kind of "appear neutral." Um... would setting them as invulnerable work? Or not letting any unit types attack wards and setting them as wards? Or do they have to have the yellow selection circle/glowing hand? Hm maybe you could make the unit itself actually neutral, and have the player give orders to them through a dummy unit that had permanent invisibility so the enemy players couldn't see it... |
| 11-20-2003, 04:12 PM | #5 |
I'm unsure exactly what you're suggesting, Ligature. I don't want it simply to be that you have to have a unit nearby to train, rather I want it to be that every time you train a unit, it checks to see if there's a unit type nearby, and if there is, then deletes one of that unit type. In my map, there's going to be children units and schools. At the school, I want the player to be able to queue up "educated villagers" and each time one trains it checks to see if there's a child nearby it can use. If there is, the child is deleted and training commences. If not, training is simply cancelled and the cost is refunded. Is it possible to have a unit type in range of builidng condition rather than only a specific unit in range? If that wouldn't work, then I imagine I could set something up by creating temporary regions around the building every time the trigger activates, checking to see if there's a unit type in that region, then deleting the region when the trigger's done. I have no idea how to set that up, though. I appreciate your help on this. |
| 11-20-2003, 10:13 PM | #6 |
Yeah just have your trigger that catches the train order check whether Unit Group (units within X distance of ordered unit matching condition (unit-type of matching unit equal to your unit-type)) is empty - if it is, don't allow the training; if it isn't, remove a random unit from that same group. |
| 11-20-2003, 11:12 PM | #7 |
heres how i would Event: Generic Unit event- Unit begins training a unit Act: unitgroup- Pick every unit in range of X(however close you want em to be) and do multiple actions. If Picked unit is unit type child and owned by triggering player Then remove picked unit from game Skip remaining actions Else do nothing and then after that there should is some kind of cancel order if i remember right(not on my comp so cant check) put that at the bottom so it will run if a child isn't in range if not it gets skiped. Make sure you set up to give full refunds in gameplay constants. For the nuetral unit if you have less than 6 players playing i'd give each one a dummy race that they have full unit control over and the enamies are nuetral to. Or maybe one race per side if you have 10 players and let all the allies control? If not the mechanicle animal is probably your best bet. i dont know about caravans since i dont play aoe =) I dont think auras stack if they are the same aura type since I seem to remember my archers not getting the extra trueshot bonus when i got that range damage bonus and had the preistest with trueshot. But i could be wrong. You could use custom upgrades to move up unit speed and give bonuses to how much they can carry. You can also increases attack speed to help gather lumber since tree chopping speed is based on attack speed. Hoped some of this helps. Rebel |
| 11-20-2003, 11:21 PM | #8 |
Caravans. Oy. Hard stuff. Doing it in GoE.. The basic concept of it in minimalist form is really easy once ya know what you're gonna do.. I don't want to reveal any trade secrets (ahahha! Get it?! IRony!!...) from GoE.. but.. hum.. I suppose in the simplest form you'd have a marketplace.. and a caravan. You give the order of 'patrol' manually (the player does it) and when it gets to the target, set the custom value of it to 2.. when it comes back to a marketplace of yours, it gives gold and sets the custom value back to 1.. You'll open up a can of worms though involving distance.. You'll have to do some unique custom value assignments so that you know which one your targeting so you can even calculate it.. Or there's another way that I cannot think of off the top of my head. |
| 11-20-2003, 11:48 PM | #9 |
Reb, thanks for the help, but I have that much down already. the problem I'm facing right now is dealing with cancelling the order to train units. I got it to the point where, training goes fine, except in the case where you queue up two units and another thing but only have one child nearby. When that happens, the first unit trains fine, but then the other thing in the queue gets cancelled but training starts on another unit. I need a command to specifically cancel the first item in the queue, rather than the last. As for the trade route, that might be how I have to do it, Norbo. However, this map is going to be insanely loaded down with complexities, so I'm trying to compensate by making the interface as painless to use as possible. Issuing the first command to the caravan unit wont be very time consuming, but when trade routes get disrupted it will be very annoying for the player to have to set up an entirely new patrol everytime the caravan gets off track, taking three clicks, that's two more clicks than he should have to do. What I would ideally like to have happen is that when the caravan is created, you "tie" the caravan to a specific marketplace using a special ability. Then, in order to get the caravan on a route you would simply right click on the allied marketplace. It would only take one click for the player to fix his trade, a big time saver. Also, I plan to have the unit's custom value tieed up into another variable (happiness, specifically) so it won't be availible for caravaning. Rather, I think I'll just change the model when its full and change it back when it unloads. After I get that down, I plan to throw in the distance modifiers as well as other modifiers to encourage trading with more different players. Comparative advantage and all, for you econ students. As always, I would greatly appreciate any help, I'm thoroughyl lost when it comes to these complicated triggers. |
| 11-21-2003, 03:36 AM | #10 |
I've an idea to make it work. It'll take a little explaining though. Any mistakes I make, well I claim indemnity :) I'm away from my WE... And I'll simply any code that I think is obvious enough :P --- Right first off, I'll explain the variables again. assuming, max number of players = maxplayers = 4 max number of caravans per player = maxcaravans = 10 max total number of caravans = maxtotcarvs = 4 x 10 = 40 Variables: Int Plr_Num >> to store the player number of Triggering Player Int CValue >> temp variable to store a Custom Value for multiple usage Int CValueReplace >> temp variable to store a Custom Value for multiple usage when a Caravan dies Int Carv_Total[ maxplayers ] >> the number of caravans a certain player owns Unit Carv_Home[ maxtotcarvs ] >> array to store Home Base of caravan Unit Carv_Target[ maxtotcarvs ] >> array to store target market of caravan Trigger New Caravan Created E: Unit Finishes Construction C: Unit-type of (last created unit) = Caravan A: Plr_Num = Player Number(triggering player) - 1 >> arrays start at 0, player numbers start at 1 Carv_Total[Plr_Num] = Carv_Total[Plr_Num] + 1 CValue = Plr_Num * maxcaravans + Carv_Total[Plr_Num] >> you'll get a value from 0-39 depending on your player number and current number of caravans Custom Value of (Last Created Unit) = CValue Carv_Home[CValue] = Triggering Unit --- Trigger Caravan Given Target Market E: Unit is issued a Order to a Unit C: (Ordered Unit) = Caravan (Target of Order) = Market (Owner of Target of Order) = Ally >> I know it can be done, can't remember how though A: CValue = Custom Value of (Ordered Unit) Carv_Target[CValue] = (Target of Order) --- Trigger Caravan Is Killed >> You need this to move your array data around if any of the Caravan are destroyed E: Unit Dies C: Unit-type = Caravan A: CValue = Custom Value of Unit Plr_Num = CValue / maxcaravans >> integer division, will get you a number from 0 to maxplayers - 1 CValueReplace = Plr_Num * maxcaravans + Carv_Total[Plr_Num] Carv_Home[CValue] = Carv_Home[CValueReplace] Carv_Target[CValue] = Carv_Target[CValueReplace] >> You can ignore the values at CValueReplace, because they will be overwritten by any new caravan data, and will not be called anyway. >> You need to find the Caravan with the Custom Value = CValueReplace to change it to CValue, I'm not sure if there's a more efficient way, but this should work : (remember Plr_Num = Number of Player - 1) Unit Group - Pick every unit of (Unit-type = Caravan) belonging to Player(Plr_Num+1) { If Custom Value of (Picked Unit) = CValueReplace Then Custom Value of (Picked Unit) = CValue Else Do Nothing } >> Now you've successfully replaced the dead caravan with the last caravan of that owner Carv_Total[Plr_Num] = Carv_Total[Plr_Num] - 1 --- Trigger Caravan Reaches EndPoint E: Periodic 5 sec >> I'm a little uncertain what to use for Event - Perhaps Unit Enters Region or Periodic Trigger, see what works, I'm not so sure >> I think Periodic may be good, but may be laggy and the code is very bulky, so check it out. C: There are Caravans in Entire Playing Map A: >> I'm putting the Condition section under Actions because you need to use Variables For A = 1 to maxplayers if (Player Slot is Active) then { Unit Group - Pick Every (Caravan) belonging to Player (Integer A) { Custom Value of Picked Unit = CValue If Distance between (Position of Picked Unit) and (Position of Carv_Target[CValue]) <= 100 Then >> Close to Target, go back to Home Order (Picked Unit) to Move to (Carv_Home[CValue]) if CValue <= maxtotcarvs then Custom Value of (Picked Unit) = CValue + maxtotcarvs else Do Nothing >> If it already has cargo (>maxtotcarvs) then don't add. If no cargo (<maxtotcarvs), then add. Else CValue = CValue - maxtotcarvs ->If ->Distance between (Position of Picked Unit) and (Position of Carv_Home[CValue]) <= 100 ->Then >> Close to Home, add good stuff, and go back to Target ->Custom Value of (Picked Unit) = CValue ->Order (Picked Unit) to Move to (Carv_Target[CValue]) ->Player - <Get whatever good stuff you want, gold I assume> ->Else ->Do Nothing } else Do Nothing >> Ok time to explain. The Custom Value of the individual Caravan stores two possible value, 1 number between 0 - maxtotcarvs which will say that it is going to the Target or between maxtotcarvs and 2*maxtotcarvs where it is going Home with cargo. --- Did I miss anything? Let me know if I should explain anything else. [edit] forgot to remove some preliminary 'thought process'. just did that. |
| 11-21-2003, 03:06 PM | #11 |
...You can store as much info as you like in custom value. Just make each unit that's created have a unique custom value then have a buncha arrays. So to get X unit's happiness just go to the happiness array and look at the spot "Custom value of unit X". To do the caravan thing only let caravans target another marketplace, by checking the issued order. Then, if the caravan is ordered to go to the right place give the caravan to a neutral player, zero its mana, and store its starting area and its destination in some array, and continually order it to move to its destination. When it returns to its starting area add its mana to player X's gold and return control of the caravan to player X. Mana is zeroed because that's what we'll be using to figure out how long it took, and control is taken away from the player so that the player can't make it take too long. Of course, pathing for the caravan would have to be turned off, to make sure the player couldn't trap it between units. There are other ways to fix trapping it (for example; check the distance it moved since X seconds ago...if it hasn't moved far enough, subtract from the player's gold) (Another way to solve it would be to spawn a 2nd unit without pathing to "measure" the real distance to the 2nd marketplace) There are some issues with this method, though none of them are impossible to solve...just a little complicated. (Auras won't affect the caravan, and increasing the caravan's speed would decrease the amount of gold...) |
| 11-21-2003, 09:54 PM | #12 |
Wow, RicFaith, that's one hell of an answer! I'm not very familiar with arrays, but I'm working on trying to modify your setup to suit my map. I'm finding it a bit difficult to set this up to apply to all units, since I have them coming in by lots of methods, not just training. Anyways, I really appreciate your help and I'm sure I'll have questions when I get this bit working. NewHydra, I think I can set it up so that the caravan remains under player control at all times. Besides, it would be a headache for the player if their home market was destroyed, leaving a bunch of useless neutral caravans just sitting there. As for how much the profit is, it seems like it would be more effective to just do a simple distance calculation between the two marketplaces when the caravan drops off gold. Since the home and destination marketplaces are already being stored in arrays, it should be quite simple. My training trigger is giving me the most problems right now (why oh why doesn't WE let you cancel the FIRST item in the queue instead of only the last?). I really appreciate the help I've been getting, thanks. |
| 11-22-2003, 12:04 AM | #13 |
Let me know if it works, or if you need any more help. I find this caravan thing quite intriguing :) Cheers, Ric |
| 11-22-2003, 08:15 PM | #14 |
I'm extremely pleased to say that your method works like a charm, RicFaith! It took me a long time to implement, due to my experience, and I still have, and I still have to add in the profit modifiers and other necessary amenities, but it works! I now have a pack mule who can be built at my marketplace, and can choose any other allied marketplace to trade with, after which he will walk back in forth collecting profit everytime. the next serious challenge for my trade system will be to add in modifers to encourage the player to trade with more allies, rather than just one. That's for another day, though, after I finish implementing the more basic stuff. Thanks tremendously, ricFaith, it would've taken me a long time to get that working without your help. The problem I'm working on now is frustratingly basic. I've successfully set it up so that every unit has a happiness rating and I have it working harmoniously with the arrays for the trade units. This rating goes up and down depending on various crieteria for each unit (my favorite bit is that units turn goldish when happy and red when unhappy). I'm using Grater's custom aura method (except applying it to units based on happiness) and I can't figure out the best way to apply bonuses and penalties to movement speed. I want this to be as invisible as possible, I don't want any new ability icons cluttering up each units UI. How should I do it. |
| 11-22-2003, 09:45 PM | #15 |
Have you tried the Item Move Speed Bonus ability? I believe it's the same ability on the Boots of Speed (ie: stacks with all auras/should not have a command box icon). You can't set it to a %, but if you can make several different strengths and just apply/remove them as needed it should work. |
