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 > Resources > Code Resources > Systems
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-13-2009, 02:14 PM   #76
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Quote:
Originally Posted by Tyrande_ma3x
> call TriggerRegisterAnyUnitEventBJ(DD.T, EVENT_PLAYER_UNIT_SPELL_FINISH)

Shouldn't this be SPELL_EFFECT? Besides, you don't give access to the trigger which is quite bad since you can't disable it for UnitDamageTarget() events...
For the purpose I have, is the same using SPELL_FINISH or SPELL_EFFECT, so no worries.

Let me explain the purpose of those triggers. The idea is that the DD gathers all the units that can receive damage. Damage can be done via attacks and spells so those private triggers gets the units which actually can receive these (AKA the ones that activates those triggers), if the unit is not in the DD group, then it's added and will be susceptible to be affected by the conditions added to the system.

About the main trigger (DD.T), it has to be private because it manage ALL the conditions for ALL the units with DD activated, so giving the possibility to disabling it will imply that ALL the conditions won't be evaluated.

If you need to deal positive or negative bonus damage in the DD conditions, just set the unit life to the proper value. Check the triggered Critical Strike example in the first post to get an idea about to to deal with that situation.

As a conclusion: using UnitDamageTarget() in those DD conditions is something you have to manage very carefully and it's a task of the user to do it properly.
moyack is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-13-2009, 02:29 PM   #77
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

This system looks pretty neat.

I think the best way would be using custom DamageTarget function like Rising Dusk does in his system. Make the system ignore some Special Damage Type.

Or then you could maybe disable damage trigger while you do damage, but I have a feeling that something makes it fail.

Collapse JASS:
scope CriticalStrike initializer init 

private function DoSomeSafeDamageInsideSystem takes unit u, real value returns nothing
    call DisableTrigger(DamageTrigger)
    call UnitDamageTarget( ... ) 
    call EnableTrigger(DamageTrigger)
endfunction

private function DoEffect takes nothing returns boolean
    local real d = GetEventDamage()
    local unit u = GetTriggerUnit()
    call DoSomeSafeDamageInsideSystem(u, d*4.) 
    set u=null
endfunction

private function init takes nothing returns nothing
    call AddDamageCondition(Condition(function DoEffect))
endfunction

endscope
__________________
No Marlo, no game.

Last edited by Viikuna- : 03-13-2009 at 02:30 PM.
Viikuna- is offline   Reply With Quote
Old 03-13-2009, 02:40 PM   #78
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Well, thats not really a problem, because you could just add a static method inside the struct.

But would disabling trigger actually work? ( Events sometimes confuse me, because they register before stuff actually happens, like this DAMAGED event )

edit. IMO there should be 2 options. User either manually adds all the units he needs to the system, or he uses some adding script which adds all units from the game to the system. ( Some Filter would be nice, so you can leave dummies outside the system)
__________________
No Marlo, no game.

Last edited by Viikuna- : 03-13-2009 at 02:45 PM.
Viikuna- is offline   Reply With Quote
Old 03-13-2009, 02:44 PM   #79
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 705

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus
Default

Quote:
Originally Posted by moyack
If you need to deal positive or negative bonus damage in the DD conditions, just set the unit life to the proper value. Check the triggered Critical Strike example in the first post to get an idea about to to deal with that situation.
That's a crappy workaround, it doesn't let the user take armor/armor type into account for the bonus damage.
Fledermaus is offline   Reply With Quote
Old 03-13-2009, 02:58 PM   #80
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Quote:
Originally Posted by xombie
The struct is private, so you wouldn't be able to call a static method from it either.

Oh yea, my memory failed me. Anyways, trigger can be changed to non private or you could add your function to same library as DD struct or something..
__________________
No Marlo, no game.
Viikuna- is offline   Reply With Quote
Old 03-13-2009, 03:08 PM   #81
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

hmnn I have approved my own resources multiple times. If I didn't do that who would? Err. There isn't an explicit rule about not approving your own resources, and the resource section has got nothing to do with contests, does it? If it makes you happy I'll check the system out and see if it deserved approval.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-13-2009, 06:59 PM   #82
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

no comment from xombie will be taken into account in this thread, due to the biased attitude showed recently.

Cleaning up the thread.
moyack is offline   Reply With Quote
Old 03-14-2009, 12:27 AM   #84
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Quote:
Originally Posted by Fledermaus
That's a crappy workaround, it doesn't let the user take armor/armor type into account for the bonus damage.
If you get the damage via GetEventDamage(), this value takes in account the armor and bonus damage.

Quote:
Originally Posted by Litany
Back on topic: there's another way to add infinite loop safety without compromising damage detection, using a custom damage function, or resorting to an array + sort method like IDDS. All you have to do is take advantage of actions as well as conditions. If damage-dealing functions are registered to the system as actions and everything else is registered as conditions that return false, an additional condition that returns true only for damage dealt outside the system will prevent the infinite loop yet still allow damage dealt from within the system to be registered.
hmmm... I'll have to think about this option.
moyack is offline   Reply With Quote
Old 03-14-2009, 01:31 AM   #85
Fledermaus
default string
 
Fledermaus's Avatar
 
Join Date: May 2006
Posts: 705

Submissions (1)

Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)Fledermaus is a jewel in the rough (194)

Send a message via MSN to Fledermaus
Default

Quote:
Originally Posted by moyack
If you get the damage via GetEventDamage(), this value takes in account the armor and bonus damage.
What if you want to deal bonus magical damage off of an attack (that isn't magical damage type)?
Fledermaus is offline   Reply With Quote
Old 03-17-2009, 03:00 AM   #86
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Shit!!! I can't upload the new version code :(

Changelog

(16/03/2009):
- Added a new function: DoNonDetectableDamage(). It takes the same arguments as UnitDamageTarget() but it prevents the infinite damage loop. It must be used only if using UnitDamageTarget function causes this specific game freeze.
- Added to the test map spell examples: a triggered Critical Strike (Check NE archer attacks, it uses the new function) and a triggered Evasion (Check Ghouls)
- Now the DD struct uses EVENT_PLAYER_UNIT_SPELL_EFFECT instead of SPELL_FINISH to catch faster suitable units



Quote:
Originally Posted by Fledermaus
What if you want to deal bonus magical damage off of an attack (that isn't magical damage type)?
Now you can do it :)

Download the test map here: http://www.wc3c.net/attachment.php?a...1&d=1237256876

EDIT: uploaded in first post.

Last edited by moyack : 03-17-2009 at 03:30 AM.
moyack is offline   Reply With Quote
Old 03-25-2009, 07:15 PM   #87
Viikuna-
User
 
Viikuna-'s Avatar
 
Join Date: Feb 2009
Posts: 203

Viikuna- will become famous soon enough (44)Viikuna- will become famous soon enough (44)

Default

Im just implementing this thing to my map, and its looking good.

edit. Hm, I would rather have a non private function AddUnitToDamageDetection or something like that..
__________________
No Marlo, no game.

Last edited by Viikuna- : 03-25-2009 at 07:24 PM.
Viikuna- is offline   Reply With Quote
Old 04-10-2009, 05:27 PM   #88
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

Updated
moyack is offline   Reply With Quote
Old 04-10-2009, 05:41 PM   #89
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

I have always disliked how the damage detection is integrated in the first post to the recycler system. The recycling system itself is great and I would approve it right now, but I do not approve of users copying the whole thing to their map with the possibility of them using another damage detection system by accident.

If you can split the two, rename the thread to "UnitRecycler" and then have the "Simple Damage Detection System" as a supplementary library at the bottom of the post (Similar to how LastOrder has AbortSpell as a supplementary library), I will approve this with my full blessing.
__________________

Last edited by Rising_Dusk : 04-10-2009 at 05:42 PM.
Rising_Dusk is offline   Reply With Quote
Old 04-11-2009, 09:55 PM   #90
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

I'm agree with Rising_Dusk, and i'm also curious to see the damage detection code (i can't open a war3 map for the moment)

Last edited by Troll-Brain : 04-11-2009 at 09:57 PM.
Troll-Brain 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 02:58 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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