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 05-25-2008, 08:46 PM   #16
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Quote:
This system is only applicable if all of the damage from spells in your map is triggered.
Shouldn't this be called "obvious damage detection system" ? I mean, it is probably nice and all that it finally became a system, instead of a concept hidden in very specialized maps like the ones I made, but the whole reason for attack detect systems to exist was actually to avoid this method. At least that's the reason I made mine.

You know, If you actually have control over all the spell damage, you can handle the damage "event" without even declaring EVENT_UNIT_DAMAGED triggers and leaking events.
__________________
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
Sponsored Links - Login to hide this ad!
Old 05-25-2008, 08:49 PM   #17
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

I don't see why you call it a "brute force method" nor why you assume people who want triggered damage would create their units at runtime. The GroupEnumUnitsInRect method has no downside.
grim001 is offline   Reply With Quote
Old 05-25-2008, 08:55 PM   #18
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Quote:
If you couldn't tell, I wanted to avoid such brute force crap; most mapmakers that want to trigger all damage will create their units at runtime anyways.
My bet is that an enum in the library is most likely to be 3 times faster than making the event before the call to preplace units.

You can use //! inject main to force library initializers to execute before preplaced units btw.
__________________
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 05-25-2008, 08:59 PM   #19
Rising_Dusk
Obscurity, the Art


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

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

The other way to deal with it would be to swap the "CreateAllUnits()" function in 'main' to be under the library's initializer. I dislike the GroupEnumUnitsInRect particularly because the alternative solution is so much easier, but is a preprocessor oversight if anything. I'll still do it, but the reason I didn't before is because I would much rather see the option to move the initializer call as an alternative.

EDIT: Vex posted.
Quote:
Originally Posted by Vexorian
My bet is that an enum in the library is most likely to be 3 times faster than making the event before the call to preplace units.
That doesn't make sense, why would changing the position of the call change anything about how efficient it is?

Quote:
Originally Posted by Vexorian
You know, If you actually have control over all the spell damage, you can handle the damage "event" without even declaring EVENT_UNIT_DAMAGED triggers and leaking events.
No, you have to remember that all spell damage is triggered, not all damage. The only damage that is not triggered is from attacks, which is exactly how the system knows if the damage is from an attack or not. If you triggered attacks rather than using the WC3 UI and having the units themselves deal the damage, yes, you could eliminate the damage events. However, that would require you trigger attacks within the system, which oftentimes is not desirable and currently is not required by the system.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-25-2008, 09:02 PM   #20
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Quote:
Vex should allow this in the next jasshelper version
Give me syntax to do that that actually makes more sense than //! inject init.

Quote:
That doesn't make sense, why would changing the position of the call change anything about how efficient it is?

All right, so what you want is to use the enter region event to automatically add the event to the trigger. Even if it is a preplaced unit. If you do that, then for every preplaced unit:
- Wc3 detects there is a region event in the position.
- Wc3 calls the region event, which probably at least a TriggerEvaluate() at least, in your case, you are using an action, so it is Execute(). So for every preplaced unit, you are executing a trigger.

Now, the alternative:
- GroupEnum, these beasts are optimized to reduce the call overhead, a simplistic view would be that there is only one call for all those units. Compare it to 1 Execute per unit.

I am just saying a single GroupEnum is probably better than executing a trigger on all the preplaced units.
__________________
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 05-25-2008, 09:15 PM   #21
Rising_Dusk
Obscurity, the Art


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

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

Collapse JASS:
library MyLibraryName initializer MyInit inject main needs X, Y, Z
That's what I'd like, though you'll say it makes less sense or something.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-25-2008, 09:27 PM   #22
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

I don't think that one makes any sense at all. Why inject main?

Collapse JASS:
function TriggerRegisterDamageEvent takes trigger trg, code actionFunc, boolexpr conditions returns boolean
I don't get why you want to allow these things to be dynamic, in my opinion this function should only take a trigger, let the guy care about the actionFunc and condition, just like normal triggers.

Else it should only take an actionfunc and conditions, and returns some object that will allow you to unregister that stuff in O(1), right now unregistering takes O(n) and I think that's because it receives the trigger.

I actually think the optimal solution would have been to take the listener approach and just use an interface, that's the only time in which making this dynamic would make sense since it would have allowed true MUI. But right now I think it makes more sense as a way for static triggers.

A cheap workaround to justify dynamic triggers here and stick to the odd design would be to allow an integer tag in the TriggerRegisterDamageEvent function, so you could use that one to attach stuff to it.

Edit: Even then, to justify that you can make it dynamic you would also need a way to specify a trigger to work only for a specific unit.
__________________
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 05-25-2008, 09:32 PM   #23
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Quote:
Originally Posted by Vexorian
I actually think the optimal solution would have been to take the listener approach and just use an interface

Then it would pretty much be my system. I think this is meant for people who don't want to use structs or interfaces.
grim001 is offline   Reply With Quote
Old 05-25-2008, 09:36 PM   #24
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


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

Submissions (37)

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

Hero Contest #3 - 2nd Place

Default

Heh, god save them when I release the successor for collisionmissiles.

Anyway, I was trying to say that there's little sense that it allows dynamic triggers, when the functions right now only allow static applications.
__________________
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 05-25-2008, 09:41 PM   #25
Rising_Dusk
Obscurity, the Art


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

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

Quote:
Originally Posted by Vexorian
I don't get why you want to allow these things to be dynamic, in my opinion this function should only take a trigger, let the guy care about the actionFunc and condition, just like normal triggers.
That's a valid point I suppose. I can do that, it puts (minimally) more work on the user, but it makes the system shorter.
Quote:
Originally Posted by grim001
Then it would pretty much be my system. I think this is meant for people who don't want to use structs or interfaces.
Yes, this system is intended for people who don't want to deal with all of that stuff. I know I'd never use Grim's system because it's too convoluted for my tastes (Not to say it isn't efficient just that my reasons for disliking it are mostly esoteric). I think ease of use and ease of understanding are critical for a system like this, which is in particular why Vex's comment above about the function only taking a trigger is a valid one and something I'll adjust. There is little sense for dynamic triggers within the system, it can be user-monitored.
Quote:
Originally Posted by Vexorian
I don't think that one makes any sense at all. Why inject main?
Main was a mistype because you confused me with your prior post, just the keyword inject would move it to the top of the 'main' function.
Collapse JASS:
library MyLib initializer LibInit inject needs X, Y
EDIT:
Could also move it in front of the initializer keyword, would make more sense.
Collapse JASS:
library MyLib inject initializer LibInit needs X, Y
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-25-2008, 10:31 PM   #26
Rising_Dusk
Obscurity, the Art


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

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

There, edited the first post per everyone's comments.
  • Now works for pre-placed units
  • Includes a custom critical strike ability as an example
  • Registering the event no longer takes actions and conditions as these are now handled externally (Like normal triggers)
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-25-2008, 10:50 PM   #27
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

Quote:
Registering the event no longer takes actions and conditions as these are now handled externally (Like normal triggers)
I was kind of wondering why you hadn't done it like that in the first place. It kind of confused me.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt

darkwulfv is offline   Reply With Quote
Old 05-25-2008, 10:54 PM   #28
Rising_Dusk
Obscurity, the Art


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

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

In retrospect, I'm not sure why I did either.
__________________
Rising_Dusk is offline   Reply With Quote
Old 05-25-2008, 10:58 PM   #29
Here-b-Trollz
Corkscrew Chainsaw!!!
 
Join Date: Jun 2006
Posts: 711

Here-b-Trollz has a spectacular aura about (149)

Hero Contest #2 - 2nd Place

Default

Great system. Quite awesome, actually.

I love how configurable it is. Now we can actually give custom damage types EFFECTS. Like, erwt's Element AoS, which calls for all the effects on damage. That becomes HELLA easier.

Collapse Example:
library damagetypeEXTRA initializer Init requires DamageSystem
globals
    integer DAMAGE_TYPE_EXTRA //This is set in Init
endglobals

private function Conditions takes nothing returns boolean
    return GetTriggerDamageType() == DAMAGE_TYPE_EXTRA
endfunction

private function Actions takes nothing returns nothing
    local unit u = GetTriggerDamageSource()
    local texttag te = CreateTextTag()
    local real d = GetTriggerDamage()

    call SetTextTagText(te, I2S(R2I(d)+"!", 0.024)
    call SetTextTagPos(te, GetUnitX(u), GetUnitY(u), 0.00)
    call SetTextTagColor(te, 255, 0, 0, 255)
    call SetTextTagVelocity(te, 0, 0.04)
    call SetTextTagVisibility(te, true)
    call SetTextTagFadepoint(te, 2)
    call SetTextTagLifespan(te, 5)
    call SetTextTagPermanent(te, false)
    
    set te = null
    set u = null
endfunction

private function UniqueID takes nothing returns integer
    local location loc=Location(0,0)
    return loc
    return 0
endfunction

private function Init takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerRegisterDamageEvent(trg)    
    call TriggerAddCondition(trg, Condition(function Conditions))
    call TriggerAddAction(trg, function Actions)
    set DAMAGE_TYPE_EXTRA = UniqueID()
endfunction
endlibrary

Now, any time you damage a unit using 'DAMAGE_TYPE_EXTRA', it displays the damage done with a bright red text tag.

I can see a great future of little 'add-on' modules which add in a damage type, and an effect to go with it. If only we could get a way to assign a unique ID to each damage type and still have it be a constant, then we could set up these damage type libraries. Until then, they'll have to be non-constant :<
__________________
By reading this signature, you agree that I cannot be held accountable for anything that I might say or do.
Here-b-Trollz is offline   Reply With Quote
Old 05-25-2008, 11:07 PM   #30
Rising_Dusk
Obscurity, the Art


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

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

Quote:
Originally Posted by Here-b-Trollz
If only we could get a way to assign a unique ID to each damage type and still have it be a constant, then we could set up these damage type libraries. Until then, they'll have to be non-constant :<
Inherently, all of the damage types defined in the system already have a unique ID that is constant, otherwise there would be conflicts to begin with. How I would approach what you wanted to do in the last post would be as follows:
Expand JASS:
-- with DAMAGE_TYPE_EXTRA defined within the system itself like in the first post. You don't even need to obtain a unique ID from another source, it's already a given. (You predefine those types in the system configuration)

Quote:
Originally Posted by Here-b-Trollz
I can see a great future of little 'add-on' modules which add in a damage type, and an effect to go with it.
Oh yeah, totally. Something like Erwt's elemental AoS as you mentioned is virtually done for you by using this system, since for that you'd have to trigger the damage anyways. Just define all of the elements as damage types, and you can deal bonus/reduced damage based on elemental interactions within some library that takes this system's as a requirement. Voillah, done.
__________________
Rising_Dusk 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 09:30 PM.


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