System Quick Damage Detection

RaiJin

New Member
Reaction score
40
Quick Damage Detection

JASS:
library QDD initializer init requires Event

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$                     Quick Damage Detection                                 $
//$                          Version 1.05                                      $
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$                                                                            $
//$                                                                            $
//$    CREATOR - RaiJin                                                        $
//$                                                                            $
//$    HOW TO IMPORT:                                                          $
//$        Simply make a new trigger rename it to QDD and copy                 $
//$        copy and paste this in                                              $
//$                                                                            $
//$    CREDITS: -Vex for JASS NEWGEN PACK                                      $
//$             - JESUS4LYF for letting me use Event <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile    :)" loading="lazy" data-shortname=":)" />                        $
//$             - Tom Jones for his help                                       $
//$             - Romek for reminding me to add a function                     $
//$                                                                            $
//$                                                                            $
//$    Version 1.02 has a complete new revamp !!!                              $
//$                                                                            $
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


globals
    private trigger QDD_Trigger = CreateTrigger()
    private Event QDD_Event
endglobals

function TriggerRegisterAnyUnitDamaged takes trigger t returns nothing
    call QDD_Event.register(t)
endfunction

private function LoopingThrough takes nothing returns boolean
    call QDD_Event.fire()
    return false
endfunction

private function INIT_GROUP takes nothing returns boolean
    call TriggerRegisterUnitEvent(QDD_Trigger, GetFilterUnit(), EVENT_UNIT_DAMAGED)
    return false
endfunction

private function init takes nothing returns nothing
    local group g = CreateGroup()
    local region r = CreateRegion()
    call RegionAddRect(r, bj_mapInitialPlayableArea)
    call TriggerRegisterEnterRegion(CreateTrigger(), r, Condition(function INIT_GROUP))
    call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Condition(function INIT_GROUP))
    call TriggerAddCondition(QDD_Trigger, Condition(function LoopingThrough))
    set QDD_Event = Event.create()
    call DestroyGroup(g)
    set g = null
endfunction

endlibrary


Heres a link to Jesus4lyfe's Event system Props to him for making it

http://www.thehelper.net/forums/showthread.php?t=126846


JASS:
function TriggerRegisterAnyUnitDamaged takes trigger t returns nothing // like event
//Use the event responses to get the units
 

Romek

Super Moderator
Reaction score
963
You missed out the most essential function of any damage detection:
TriggerRegisterAnyUnitDamaged (or w/e you want to call it).
 

RaiJin

New Member
Reaction score
40
You missed out the most essential function of any damage detection:
TriggerRegisterAnyUnitDamaged (or w/e you want to call it).

shit i knew i was forgetting something loool ill do that right now :D

@Cohadar: exactly :D
 

Jesus4Lyf

Good Idea™
Reaction score
397
>Vex for JASS NEWGEN PACK
This is wrong and (imo) irrelevant. Vex did not write the NewGen pack, just JassHelper.

Once again, like every other system where the author doesn't use Event so far, the event structure is incorrect and will not actually function in the expected manner. I don't know why you made it only run actions either, as these are generally frowned upon anyway. If you can't stand having requirements for this system, at least embed Event into this, but it is preferred to just require it for the sake of reduced code duplication and any updates or anything.

>function TriggerAddAction(QDD_Trigger, function userfunc)
I'd make it TriggerRegisterAnyUnitDamaged and make it take a trigger. Then you can use dynamic triggers... :thup:
 

RaiJin

New Member
Reaction score
40
>Vex for JASS NEWGEN PACK
This is wrong and (imo) irrelevant. Vex did not write the NewGen pack, just JassHelper.

Once again, like every other system where the author doesn't use Event so far, the event structure is incorrect and will not actually function in the expected manner. I don't know why you made it only run actions either, as these are generally frowned upon anyway. If you can't stand having requirements for this system, at least embed Event into this, but it is preferred to just require it for the sake of reduced code duplication and any updates or anything.

>function TriggerAddAction(QDD_Trigger, function userfunc)
I'd make it TriggerRegisterAnyUnitDamaged and make it take a trigger. Then you can use dynamic triggers... :thup:

Ok ill implement Event in this and

>it looks a bit weird
what do u mean? you can at least tell me what looks "weird"
 

Azlier

Old World Ghost
Reaction score
461
You may want to know that this doesn't work with the latest patch. Blizzard killed H2I.
 

Romek

Super Moderator
Reaction score
963
> WAAAAH REALLY? omg that sucks lol !
No it doesn't.

There's a native H2I, as well as 96 other new natives, and a new handle type.
 

RaiJin

New Member
Reaction score
40
oh interesting lol

> theres a native H2I, as well as 96 other new natives, and a new handle type.
really? so blizzard updated the editor?
 

Romek

Super Moderator
Reaction score
963
See the announcement for more information.
 

Sevion

The DIY Ninja
Reaction score
413
JASS:
function QDD_DisableUnit takes unit whichUnit returns nothing
function QDD_EnableUnit takes unit whichUnit returns nothing


Um. Why?

JASS:
function QDD_ConfigUnit takes unit whichUnit, boolean switch returns nothing
    if whichUnit == null then
        debug call BJDebugMsg(&quot;NULL UNIT !! make sure its not&quot;)
        return
    endif
    set disable[GetUnitValue(whichUnit)] = switch
endfunction
 

Sevion

The DIY Ninja
Reaction score
413
JASS:
function TriggerRegisterAnyUnitDamaged takes trigger t returns nothing
    debug if t == null then
    debug   call BJDebugMsg(&quot;Null trigger passed!!!&quot;)
    debug   return
    debug endif
    set trigger_execute[trigger_count] = t
    set trigger_count = trigger_count + 1
endfunction


Why debug?

You're going to allow them to pass null triggers?

JASS:
function TriggerRegisterAnyUnitDamaged takes trigger t returns nothing
    if t == null then
debug   call BJDebugMsg(&quot;Null trigger passed!!!&quot;)
    return
    endif
    set trigger_execute[trigger_count] = t
    set trigger_count = trigger_count + 1
endfunction
 

RaiJin

New Member
Reaction score
40
JASS:
function TriggerRegisterAnyUnitDamaged takes trigger t returns nothing
    debug if t == null then
    debug   call BJDebugMsg(&quot;Null trigger passed!!!&quot;)
    debug   return
    debug endif
    set trigger_execute[trigger_count] = t
    set trigger_count = trigger_count + 1
endfunction


Why debug?

You're going to allow them to pass null triggers?

JASS:
function TriggerRegisterAnyUnitDamaged takes trigger t returns nothing
    if t == null then
debug   call BJDebugMsg(&quot;Null trigger passed!!!&quot;)
    return
    endif
    set trigger_execute[trigger_count] = t
    set trigger_count = trigger_count + 1
endfunction

who would pass a null trigger in the first place?
 

Artificial

Without Intelligence
Reaction score
326
JASS:
//
    set LastDamagedUnit = GetTriggerUnit()
    set LastDamagingUnit = GetEventDamageSource()
    set LastDamageCount = GetEventDamage()

You know, they could just use the event responses directly. ^_^

I think you should make sure the trigger isn't disabled before evaluating/executing it (otherwise damaging a unit inside an action/condition of a trigger evaluated/executed by this will cause an infinite loop even if you disable the trigger).

And why did you make it not register buildings? o_o Did they offend you? ;o

And IMO this seems to be rather similar to this (dunno if anyone else feels this way, though). x)
 

RaiJin

New Member
Reaction score
40
JASS:
//
    set LastDamagedUnit = GetTriggerUnit()
    set LastDamagingUnit = GetEventDamageSource()
    set LastDamageCount = GetEventDamage()

You know, they could just use the event responses directly. ^_^

I think you should make sure the trigger isn't disabled before evaluating/executing it (otherwise damaging a unit inside an action/condition of a trigger evaluated/executed by this will cause an infinite loop even if you disable the trigger).

And why did you make it not register buildings? o_o Did they offend you? ;o

And IMO this seems to be rather similar to this (dunno if anyone else feels this way, though). x)

WAAAH it actually does loool xD and event responses would still work? ill update it soon then

@sevion then whats the point?
 

Sevion

The DIY Ninja
Reaction score
413
The point is, users can pass null triggers...

And guess what? The last time I checked, that ISN'T good.

Do you follow me?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top