| 08-13-2002, 08:01 PM | #1 |
Guest | So I’m working on an RPG map for War3 (who isn’t?) and have several questions that I hope will be answered here. Question 1. Is there any way to know the command a unit is executing? I want to know whether a unit is moving, attacking or standing still. Without this option there is really no way to write a good unit AI (not to be confused with player AI). Question 2. How can I create a unit with the “summon” timer. Say I create a water elemental with a trigger and want it to disappear after certain amount of time, just like the one summoned by an Archmage. And I also want to modify the time it stays alive. Question 3. Is there a way to make a group of units to attack another group of units without issuing the ‘attack unit’ order? Basically, I want a group to attack another just like it belongs to an enemy player. But I don’t want to set the player ‘enemy’ status because it will cause other units on the map to attack each other. Question 4. Can I make units of player A to only attack certain type of units? Let’s say player A should attack grunts of player B, but not headhunters of player B. The only way I can think of is issuing the “attack unit” order, but that’s an ugly solution. Question 5. How can I set the slot in which a certain unit or structure icon appears. Like if I want to switch the Lumber Mill and Farm icons in peasant construction menu. Question 6. I’m trying to make Meat Wagons to automatically pick up dead bodies and move them to a grave yard (is there any way I could patent this idea? j/k :)) There are two problems. I get the wagon to move to the nearest dead body in a region, but it refuses to pick it up even though I issue an order “Undead Meat Wagon – load body” or something like that. It probably would work much better if I could enable automatic pick-up (right-clicking the icon would do that for human player) but I didn’t find a way to switch it on. Also, after the wagon picks up the body it doesn’t move since the unit that got picked up is still considered as the nearest pick up target even though I check the “unit is being transported” condition (to make sure it’s false) when I repopulate my unit group of pending bodies. And finally, the stupid question of the day. How the heck do I convert triggers into text form? I’m a programmer and having to click on dozens of little dialogs to write a single line of code annoys me beyond my sanity limit . I hope these questions will catch someone’s attention. |
| 08-13-2002, 08:17 PM | #2 |
1) Event - Unit is Issued Order (stop) (with no target / targetting a unit / targetting a point) The orders that I know are stop, holdposition, move, attack, smart (which is the order that issued when you right click somewhere). The Events vary based on what target it has. Attacking is issuing 'attack' on a target, while attack-moving is issuing 'attack' on a point, for instance. 2) No clue. 3) The 'attack unit' order only affects the unit to which the order is issued. It won't affect the alliances or enemy settings of any other units. (Even the attacked unit.) 4) Event - Unit Acquires Target Condition - (Event Response - Targetted Unit) is of type (Headhunter) Condition - (Event Response - Targetted Unit) belongs to Player B Action - Issue order (stop) OR maybe cancel order or some other way to get it ignore the target (I don't have WE nearby, these are just estimations.) 5) Tough stuff, no idea. Someone else like Cookie might know. 6) I might be able to figure that out, but I'd need WE. |
| 08-13-2002, 08:31 PM | #3 |
And the last question there, under one of the menus is an option "convert to custom text" select it. |
| 08-13-2002, 08:33 PM | #4 | ||
Guest | Thanks for the quick reply. Quote:
Well, I need to know the current status of the unit from within a trigger. If I pick up a random unit and want to know what it's doing right now(attacking, moving, standing). I guess I could set up an array of integers and then update every time an order is issued. Is there a way to get a unique id of a unit? Quote:
Yeah I know that. I was hoping I can make a group of units to attack some other group without issuing a direct order. So the groups would act like they are hostile to each other even though the players are actually neutral. |
| 08-13-2002, 08:44 PM | #5 |
Guest | Ok let me give you more information. I don't want to give explicit orders for the following reason. I have a unit type that will not attack another unit unless it's attacked first. So let's say you have a footman who is neutral to two riflemen and is standing right between them. One of the riflemen shoots the footman. The footman is ordered to charge the attacker. Now the other rifleman shoots. The footman promptly turns around and runs toward the other attacker. See where it's going? If I could simply mark those riflemen as "enemies" to the footman he could then figure out a way to kill both riflemen without setting a new speed record. Edit: On a related topic, if I use a Hero ability on the same footman (like throw a hammer at him) he will not react since "unit attacked" event does not fire. Is there a way to trigger an event when an ability is used on a unit? |
| 08-13-2002, 08:54 PM | #6 | |
Quote:
You can use the if/then/else action and then use "order comparison" to check for a particular order. If that's not exactly what you're looking for then perhaps you can create a variable of the type 'order', and go from there (do you simply need the status to be displayed, or is it to be the used in a trigger?) One thing to be a bit careful of is that in my (limited) experience, the game sometimes treates a keyboard executed "move" (ie, with the 'm' button) differently than a mouse executed move. |
| 08-13-2002, 08:57 PM | #7 |
You could also give those two riflemen to another player, like neutral hostile, or just another comp, who is enemies with the player owning the footman... |
| 08-13-2002, 09:02 PM | #8 | ||
Guest | Quote:
I want to be able to know a unit's current order within a trigger. Say I pick a random unit. Then I want to see what it's doing right now. If it's just standing there then tell it to get busy and issue some other order. If it's moving somewhere then leave it's alone. That would be enormous help in making computer-controlled units behave realistically. Quote:
Don't really care about that since I only want to manipulate computer-controlled units :) |
| 08-13-2002, 09:07 PM | #9 | |
Guest | Quote:
That's an excellent idea! I could change the owner without switching colors. However it wouldn't work if the riflemen are controlled by a human player. And that could be the case in my RPG. So I need to find another way around. :( Thanks for replying to my "stupid" question though. I knew it had to be something trivial. |
| 08-13-2002, 09:26 PM | #10 | |
Quote:
the flow should be something like: (stop me if you're not sure about any part of this) I'm not at WE right now, so I'm only 99% sure that this is the right thing to do. actions: pick random unit (you can create an array of units, and then randomly pick unit x, where x is a number between 1 and num_units) actually, now that I think about it, this might be the hard part - off the top of my head, I tihnk that this must be done upon the creation of each unit (setting them into the array, that is). Even better, from a programming pov, if they are all created upon initialization, which makes your life a bit easier. if ---> order comparison unit (the one you picked above) is issued order without target ----> if order = (string) stop then [whatever you want to do with a stopped unit] do nothing OR if you actually want a moving unit to say switch direction or some such thing: else if ---> order comparison unit is issued order with target ----> if order = (string) move then [whatever your move trigger/behavior is or do nothing] else do nothing btw, if you plan on cancelling orders of a non-stopped unit, the only thing I've been able to think of is setting his movement to 0 for .01 seconds, stopping him, and then resetting his movement (after storing his original movement in a variable) |
| 08-13-2002, 09:37 PM | #11 | |
Guest | Yes it seems like I'll have to keep an array of issued orders and then check against the array when I need to know what the unit is doing. Now the question is can I get a unique id of a unit to use as the array index. Quote:
True, but that would make my life a lot harder from a map designer pov :D |
