• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Help with Dirac's Damage Struct

Status
Not open for further replies.
Level 6
Joined
Jun 16, 2007
Messages
235
Advice: Don't make spells that need damage detection systems.
You can make cool stuff with simple triggers.
 
Level 6
Joined
Jun 16, 2007
Messages
235
I am not a dude, dude.

And I am serious about this.
Using complicated stuff in your map does not make your map any better.
I have seen countless maps that failed because they used complicated game mechanics that new players could not understand.

You are better off thinking about a good content for your map, than using a overly complicated triggering just so you can make 2 custom spells.
 
Level 7
Joined
Oct 11, 2008
Messages
304
@Cohadar

Damage Detect System is not complicated things. Is something necessary for a map, like Index system.

@Mr_Bean987

Global damage detect (detect any damage dealt/take and execute the function 'func'):
- function RegisterGlobalDamage takes code func returns triggercondition

Using DamageId:
- function RegisterDamageById takes code func, integer damageId returns triggercondition

Uses:

call RegisterDamageById(function Callback, DAMAGE_ID_MELEE)
call RegisterDamageById(function Callback, DAMAGE_ID_RANGED)
 
Level 6
Joined
Jun 16, 2007
Messages
235
@Cohadar

Damage Detect System is not complicated things. Is something necessary for a map, like Index system.

I created damage detection system (ORBEngine)
And unit indexing system (PUI)
They are both used in ElementalTD for example.

So I know what I am talking about.
 
Level 11
Joined
Nov 15, 2007
Messages
781
Using complicated stuff in your map does not make your map any better.
I have seen countless maps that failed because they used complicated game mechanics that new players could not understand.

AoE critical strike is complicated and hard for new players to understand...?
 
Level 7
Joined
Oct 11, 2008
Messages
304
@Cohadar

Detect damage and Index is not complicated things...

No matter what you did, they are necessary things for any map that use unit and damages (spells or attack, no matter).

Players will not know the existance of the Index, it really don't matter.

Also, detect when a damage happen is complicated why? It's so simple, unit deals damage -> run event. Done.

Nothing else needed.

Oh, and Elemental TD don't exist anymore on Warcraft (at least not updated), they moved to SC2 :) and PUI is hyper outdated >.>
 
Level 6
Joined
Jun 16, 2007
Messages
235
AoE critical strike is complicated and hard for new players to understand...?

No, but when new mappers get their hands on damage detection engine, they start imagining all kind of weird stuff.

Now lets take a moment from this off-topic discussion and return to the first post to see what this mapper really wants.

A spell that does something in AOE when a unit attacks?
Why you can do that by registering unit attack trigger, no need for damage detection at all.

Now you can say that it is not precise and whatnot but the truth is that in game no player will notice or care about the difference if this is done with simple attack event or with complicated damage detection system.

Hence my advice: Do not complicate it unless you have to.
It is really a good general purpose advice, I don't understand why you have a problem with it.
 
Level 6
Joined
Jun 20, 2011
Messages
249
And you should know how to avoid that.

With a damage engine right?
Plus with "attack detection" how would you know how much damage the unit deals with a basic attack? There are many factors that have a say on this such as
  • Base damage
  • Attributes
  • Item/Abilties Bonuses
  • Buffs
  • Armor Reduction
Thinking that "not learning because it's too complicate" it's the dogma of the philosophy of ignorance.
 
Level 6
Joined
Jun 16, 2007
Messages
235
With a damage engine right?
...blah blah blah...
Thinking that "not learning because it's too complicate" it's the dogma of the philosophy of ignorance.

No, the old school way: with an orb ability and buff detection.
Which would be a real learning experience.

Just using some other peoples functions hardly qualifies as learning.
It is more in the RTFM category.
 
Level 4
Joined
Mar 27, 2008
Messages
112
No, the old school way: with an orb ability and buff detection.
Which would be a real learning experience.

Just using some other peoples functions hardly qualifies as learning.
It is more in the RTFM category.

That you use other people functions does not automaticly mean you're not learning, you're creating your own stuff with those function so you're still learning if you create new things (new for you).
Also I started with using other systems and when I got at a level capable of coding those things I coded my own system that does the same as the others, but now I wrote it myself so I learned something new.
Also why overcomplicate stuff with orbs when a damage detection system is 100000x easier.
 
Level 7
Joined
Oct 11, 2008
Messages
304
On Attack is bad, this is fact.


Using the thing which you said, buff, will not work right, when you attack, the trigger fire, but the buff is applied before damage dealt.

On Attack - Apply Buff - On Damage.

Your 'method' will fail and just will work if unit attack again the target with buff :) and it can be bugged too by using the stop order.

There's nothing to discuss here, a Damage Detect System is always better then On Attack native event. This is a fact.
 
The easiest method to detect if it is not a spell is just to trigger everything. By that, I don't mean that you necessarily have to go and modify every bit, you just need to make it so that the damage event knows when a spell is cast.

Here is the setup:
JASS:
globals
    boolean isMagic = false
endglobals

Then, on the triggers for registering spell damage, just use set isMagic = true before dealing damage. (or just place it in your trigger if you have the damage set in the object editor, but that may lead to some problems of instanceability)

Then, edit the damage detection system you use. After it has fired the triggers, just set isMagic = false. Then you are done. If you need to detect if some damage was not from a spell, then you just use if (not isMagic) and GetEventDamage() > 0 then and follow it up with your actions. It is not a generalized solution, but for most people's needs it will work perfectly fine with the least amount of annoying work. (unless you have like 500 spells)

Buffs work but Nestharus has already stated the problems with it in Advanced Damage System. For something like this, it is truly much easier just to trigger it yourself in accordance to your map. =)

EDIT: Also add what Dirac said in post #19. I forgot about recursion.
 
Last edited:
Level 6
Joined
Jun 20, 2011
Messages
249
What purge says is true.
Also, to make the magic detection even more accurate do this
JASS:
local boolean prevType = isMagic
set isMagic=true
//do some damage
set isMagic = prevType
Reason: if damage is done when a damage event fires the isMagic boolean would remain true/false when not supposed to, that would prevent collision.
 
Level 6
Joined
Jun 16, 2007
Messages
235
@Laiev
Game known as :spit: dota :spit: uses onAttack + buff.
That is why orb attacks do not stack, check open-dota map if you don't believe me.
(You made me use proof-by-dota, I will hate you for ever)

The easiest method to detect if it is not a spell is just to trigger everything.
Yeah, just what a new mapper needs, advice how to spend 6 months on a map instead of 6 weeks.

I can't help but notice that thread creator has no entries in this discussion and that you are all doing thread hijacking just because you don't agree with my views.

My advice still stands MrBean: Keep it simple.
The only thing your map needs is to be fun, everything else is optional.
 
The problem with an orb effect is that you can't use it with artillery, barrage or bouncing missiles. Nestharus developed Advanced Damage Event which uses Damage-detect + orb to detect physical, but all three of those bugs will occur which is why his is not as popular as other damage-modifier systems. Plus because it is a frost-orb buff that he uses (so it can stack with other orbs) it occasionally slows the unit for a moment.
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
Update:
I know it's been a long time, but I have decided to try to make another spell using the same system. I managed to get RegisterGlobalDamage and it works. However, RegisterDamageById does not. It saves, but when I test the map, no debug message shows like it did for RegisterGlobalDamage.

JASS:
scope Test initializer InitTrigger

    private function Actions takes nothing returns nothing
        call BJDebugMsg("Damaged!")
    endfunction

    private function InitTrigger takes nothing returns nothing
        local trigger t = CreateTrigger()
        call RegisterDamageById(function Actions, DAMAGE_ID_MELEE)
        set t = null
    endfunction

endscope
 
Level 6
Joined
Jun 20, 2011
Messages
249
If you mean how do you know which is the unit dealing the damage there are many ways...
If you read the API you would find the "Damage.source" readonly unit variable, it keeps the value of the unit dealing the damage.
If you wish to register the damage dealt by one single unit then you can type RegisterUnitDamageDealtEvent(unit, code)
That way the code would ONLY fire for the registered unit.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
@Laiev
Game known as :spit: dota :spit: uses onAttack + buff.
That is why orb attacks do not stack, check open-dota map if you don't believe me.
(You made me use proof-by-dota, I will hate you for ever)

Quote:
Originally Posted by PurgeandFire111 View Post
The easiest method to detect if it is not a spell is just to trigger everything.
Yeah, just what a new mapper needs, advice how to spend 6 months on a map instead of 6 weeks.

I can't help but notice that thread creator has no entries in this discussion and that you are all doing thread hijacking just because you don't agree with my views.

My advice still stands MrBean: Keep it simple.
The only thing your map needs is to be fun, everything else is optional.

If you need to bring DotA into the conversation that only means you are being stubborn. Instead of having a 50-post thread this could have been reduced into a 5-post thread.

I'm sure if Mr Bean987 wanted your personal advice he would ask for it, but he's here asking a specific question. The least you could do is give a specific answer.

Either that or you could go back to wc3c.net and preach there. Strange how that community died because of answers like yours, and now you're here using the same strategies. Good luck with that.
 
Status
Not open for further replies.
Top