| 08-25-2007, 07:28 PM | #1 |
Ok I am making a survival map (like ENFO) (Basically a tower defense just no towers but heroes) and I have waves and waves of monsters that spawn from portals, walk some predefined paths and try to go into other portal while heroes attack them. (monsters also attack heroes) Now the problem is that whenever a hero stuns a monster or something the monster gets stupid and just stands around until attacked. What it should do is continue to the exit. Now I DO have a periodic attack order for all monsters on the map, but it is every 15 sec and in the mean time stupid monsters just stand around. Can someone think of a better way to make monsters smarter ? (except reducing periodic attack timer period) |
| 08-25-2007, 07:55 PM | #2 |
u can check their order with event: unit issued an order and check if tat order equal to attack move to the destinition it should be heading, if its ordered to walk other way then order it to move right again :) |
| 08-25-2007, 08:01 PM | #3 |
better to give monsters timed life, soo players will be forced to attack em. |
| 08-25-2007, 08:06 PM | #4 |
That won't work, because the unit isn't getting an order when he's stunned, he's just losing the order he had. I can't think of a way to make the units smarter and I don't think it's possible either. The unit is given an a-move order once, loses the order and there is no AI to give it the order again. So if we conclude that it has to be done manually, then a timer is the only solution. The only thing I can think of is reduce the period for the timer, but make its workload VERY small. For example, you could put every unit that is somehow being affected by a spell which causes order cancelling into a group. Then every 0.5 seconds you check that group and give all units in it an a-move order and remove them from the group. Now this would only be feasible if you're only using custom spells and you would have to call an additional function in every order-cancelling spell (call UnitOrderCancelled(target). The reason this would work is because you won't have to check every unit in the game (which is the reason, I assume, you now have a 15 sec timer), but only iterate through a small group of units. Would this work? |
| 08-25-2007, 08:16 PM | #5 |
this is simple, units will try to attack damage source, just add some harmfull unit in base, units will move to attack it . |
| 08-25-2007, 08:26 PM | #6 |
If you use blu_da_noob's Custom Stun system you'll know the duration of all stuns on the map. Then, simply store the stunned in something attached to a timer. Last, start a timer that has a timeout time equal to that of the stun + a little bit more and that, in the timer callback, orders the unit to attack-move to the base. |
| 08-25-2007, 08:39 PM | #7 | |
Quote:
|
| 08-25-2007, 08:47 PM | #8 | |
Quote:
Oh this worked sooo god. Tnx man. Explanation: Ordering units to attack over long distances is very expensive operation. This is because every unit has to calculate the labyrinth path to its destination. Now GroupIssueOrder calculates one path for all units in a group, but I could not use that because I have over 400 units sometimes an ForGroup hits trigger operation limit. But this: JASS:
if GetUnitCurrentOrder(u) != ATTACK then
call IssuePointOrderById(u, ATTACK, x, y)
endif
calculates the path only for units that are not attacking i.e. just units that turned dumb because of stuns and similar. And since their number is very small this is running oh so good. EDIT: I cannot give you rep but I can give respect. |
| 08-25-2007, 09:04 PM | #9 |
I would also do the Check current order thing, think that should do. Though Dusks idea sounds good, I really have no clue how to do it. :) |
| 08-25-2007, 09:09 PM | #10 | |
Quote:
|
| 08-25-2007, 09:20 PM | #11 | |
Quote:
|
| 08-25-2007, 09:24 PM | #12 |
Even I think that is funny... damn. |
| 08-26-2007, 12:32 PM | #13 | ||
I see the issue has been resolved, I just have a couple of comments: Quote:
Quote:
|
| 08-26-2007, 01:07 PM | #14 | |
Quote:
Nice. |
