wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-26-2009, 11:59 AM   #1
tamisrah
User
 
tamisrah's Avatar
 
Join Date: Jan 2007
Posts: 168

tamisrah will become famous soon enough (48)tamisrah will become famous soon enough (48)

Question Detect unit state/stop creep aggression

My goal is to create a function that prevents aggro from 0 damage events.
The problem with it is, that units can attack nearby enemies without having the "attack", "smart" or "patrol" order.
The following code is what I got so far.
Expand JASS:

Therefore my question: Is there anyway to check what a unit is currently doing, especially if it is attacking anything?

If you have any other suggestions to improve my code please post them aswell.
Attached Files
File Type: w3x DamageDetectionTest.w3x (57.3 KB, 0 views)
tamisrah is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-26-2009, 12:38 PM   #2
Opossum
User
 
Opossum's Avatar
 
Join Date: Mar 2008
Posts: 205

Submissions (4)

Opossum will become famous soon enough (59)Opossum will become famous soon enough (59)

Default

When units start to attack nearby enemies by themselves they trigger the EVENT_UNIT_ACQUIRED_TARGET event. When they disengage because they're lured too far away from their idle spot then they get a move order.
You can use these two events to determine if a unit is in combat.
Sometimes a unit also disengages without using the move order... then you'd have to check periodically if its current order is "idle".

I wrote a little script that stores information like this and also adds interface functions for several important events that have to do with combat behavior but I haven't really tested it enough to recommend it yet. If you're interested I can pm you my current results though.
Opossum is offline   Reply With Quote
Old 04-26-2009, 02:37 PM   #3
tamisrah
User
 
tamisrah's Avatar
 
Join Date: Jan 2007
Posts: 168

tamisrah will become famous soon enough (48)tamisrah will become famous soon enough (48)

Default

Sounds definitely interesting, I'd love to get that PM.

Already tried to use the approach you suggested.
Expand JASS:

Works, looks nice, but has a flaw I'd like to get rid off.
I currently use a TriggerSleepAction within the onAcquire method to allow the user to force disengage the unit before the unit is detected as engaging.

So I'm still hoping for suggestions on code improvement.

Last edited by tamisrah : 04-26-2009 at 08:33 PM.
tamisrah is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 05:36 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services