• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Xe Damage

Status
Not open for further replies.
Level 12
Joined
Aug 7, 2004
Messages
875
No, if the unit evades the attack, it will not trigger xe damage. Xe damage works when a unit is damaged. If it evades the attack, it is not damaged.

I used a Taunt ability which I recostumized into an "Attack" skill where each time you press it, the hero swings his sword and damages nearby enemy units. I tested on a unit with 100% evasion and the xe damage still bypass the evasion.
 
Level 12
Joined
Aug 7, 2004
Messages
875
On a hypothetical case, lets say

30% chance to miss, if a unit is struck with an xedamage and evasion randomint is in the range of 30%, then do restore the unit's hp of the amount of the xedamage.

However, on circumstances where lets say the unit's hp is 30 and it is about to be struck 40 damage, and lets say it is going to avoid the attack, will it die or will it ignore death?
 
Level 12
Joined
Aug 7, 2004
Messages
875
Sounds like you're doing it wrong. Your word against Vexorians (and in a public system release at that), I wouldn't even have to think about who I would assume is correct.

Lol, this is funny. Do you know how structs are really constructed?

Go for yourself and see the Xedamage script. Inside you'll see the constructor call:

struct xedamage[MAX_SPACE]

Vexorian set MAX_SPACE to 8190 assuming that is a large number. The problem with xedamage instance is that it doesn't get destroyed after created. It just keep filling up until it reaches 8190 instances, and walah, no more xedamage.

Now try making MAX_SPACE into 999,000. First it increases your mapsize by 500 kb... Then try making it 10,000,000, jasshelper will give you a memory overload. Wanna know why?

Because for every variables declared in that struct, the jngp writes 10,000,000 of it! WOW!!!!!

Now why can't we just use arrays... also, why do we even need xedamage, its useless after having this case. The rest of the xe system is fine but I think xedamage is useless... Aside from the damage detection, you can just use a simple UnitDamageTarget and attach a string to the damaged unit that stores the damage type of the damage, attack type, and etc...

Simplicity, not modular bs...
 
Last edited:
Level 11
Joined
Feb 22, 2006
Messages
752
Lol, this is funny. Do you know how structs are really constructed?

Go for yourself and see the Xedamage script. Inside you'll see the constructor call:

struct xedamage[MAX_SPACE]

Vexorian set MAX_SPACE to 8190 assuming that is a large number. The problem with xedamage instance is that it doesn't get destroyed after created. It just keep filling up until it reaches 8190 instances, and walah, no more xedamage.

Now try making MAX_SPACE into 999,000. First it increases your mapsize by 500 kb... Then try making it 1,000,000, jasshelper will give you a memory overload. Wanna know why?

Because for every variables declared in that struct, the jngp writes 1,000,000 of it! WOW!!!!!

Now why can't we just use arrays... also, why do we even need xedamage, its useless after having this case. The rest of the xe system is fine but I think xedamage is useless... Aside from the damage detection, you can just use a simple UnitDamageTarget and attach a string to the damaged unit that stores the damage type of the damage, attack type, and etc...

Simplicity, not modular bs...

I don't even know what you're trying to say.

You don't dynamically instantiate a new xedamage every time you want to deal triggered damage. Did you even read the documentation? You can have a single xedamage instance in your entire map to deal every kind of triggered damage if you wanted to. But the normal thing to do is to use one instance for every different type of damage you need to do (i.e. one instance per spell type or something). And if you're telling me you have thousands of different types of damage in your map, you're either lying or crazy...or both.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
And DoOs, you clearly have no idea how structs are coded on the back end. They use arrays, so with >8190 instances max they have to use a function call rather than an array lookup so that they can look up the right array. Thus, 1000000 instances (if it was possible) would require (1000000-8190)/8191 + 1 = 123 arrays per variable.
 
Level 12
Joined
Aug 7, 2004
Messages
875
I don't even know what you're trying to say.

You don't dynamically instantiate a new xedamage every time you want to deal triggered damage. Did you even read the documentation? You can have a single xedamage instance in your entire map to deal every kind of triggered damage if you wanted to. But the normal thing to do is to use one instance for every different type of damage you need to do (i.e. one instance per spell type or something). And if you're telling me you have thousands of different types of damage in your map, you're either lying or crazy...or both.

Before you even said this, I already tried creating one xedamage, and it still does the same thing, after 30 minutes it stops working. You're obviously the wrong one because you've never test it on a case where the players push an Attack spell that uses xedamage a 100x in 1 minute...

And DoOs, you clearly have no idea how structs are coded on the back end. They use arrays, so with >8190 instances max they have to use a function call rather than an array lookup so that they can look up the right array. Thus, 1000000 instances (if it was possible) would require (1000000-8190)/8191 + 1 = 123 arrays per variable.

nope ur wrong, 123 arrays per variable wouldn't initiate a memory overload. The xedamage struct didn't create 123 arrays per variable... it created more loke 1024 arrays for each variable.

Honestly... the original damage natives are as effective as xedamage if you work around it without even creating structs and etc... The damage detection thingy wasn't even anything special, it only detects xedamage not normal damage.

Not to discourage his work, the xe system is marvelous, but I think xedamage aint'

And when you said you're using it wrong implies its usage is only limmited to a particular way...
 
Level 14
Joined
Nov 18, 2007
Messages
816
I think were getting closer to the core.

an Attack spell that uses xedamage a 100x in 1 minute...
Sounds to me like the spell is rigged.

The damage detection thingy wasn't even anything special, it only detects xedamage not normal damage.
That damage detection script could be the culprit as well.

Anyway, its not xedamage thats rigged, its your code. And would you please stop insisting that JassHelper screws around with structs? For one, 1000000 is not acceptable as size for structs. 409549 is the maximum size for structs (Yes, thats exactly 49*8191+8190)

And when you said you're using it wrong implies its usage is only limmited to a particular way...
Yes, where the coder is actually decent and cleans the memory of unneeded instances of objects.
 
Level 12
Joined
Aug 7, 2004
Messages
875
I think were getting closer to the core.

Sounds to me like the spell is rigged.

That damage detection script could be the culprit as well.

Anyway, its not xedamage thats rigged, its your code. And would you please stop insisting that JassHelper screws around with structs? For one, 1000000 is not acceptable as size for structs. 409549 is the maximum size for structs (Yes, thats exactly 49*8191+8190)

Yes, where the coder is actually decent and cleans the memory of unneeded instances of objects.

1st.

The spell ain't rigged, it was a replacement of the original attack feature and it's working fine after I replaced xedamage system with my very own... And plus, xedamage didn't have a soundeffect attachment which I added in my own.

Please, xedamage is not rigged, neither is my spell. The problem here is the limit. Now please, I know you all got some fancy rep, titles, but when I create a thread that asks for help, you guys don't divert it into a DEBATE. A development moderator should know this before he started calling people wrong.
 
Level 14
Joined
Nov 18, 2007
Messages
816
People in this thread showed you how to reduce the number of xedamage instances used. Hell, 8190/3 instances is a LOT.

I dont know what the heck is wrong with your code, since you didnt show ANYTHING. Don't go around calling people wrong. At least prove it (with code).

Yes, since YOU got problems and xedamage normally doesnt cause problems (unless you have some legit bug, you can actually SHOW PEOPLE), your code must be faulty.

I found myself in that situation where i falsely accused other peoples code very often already. But that didnt change the fact that somehow my code always was faulty.

Soundeffect attachment? Are you talking about something similar to what WEAPON_TYPEs do?

Another thing: Your spell may very well be rigged. Why don't you show us the code instead of baselessly claiming another (reputable) guy's code is rigged?
 
Level 12
Joined
Aug 7, 2004
Messages
875
The issue was solved, my code was not rigged, and I wasn't the one who started accusing - and can you point to where I said his system was rigged? I said his particular xedamage was useless after understanding its limmitations!

A development moderator slapped me in the face after saying:

Sounds like you're doing it wrong. Your word against Vexorians (and in a public system release at that), I wouldn't even have to think about who I would assume is correct.

"Ooh, ooh, who the hell are you? You're not bill gates, don't have to assume whos correct, duh BIll Gates OfCourse!!"

I have high standards, I resist someone looking down at me!

Have fun debating...

Ehm...
 
Level 14
Joined
Nov 18, 2007
Messages
816
I said his particular xedamage was useless after understanding its limmitations!
You dont give me the impression you understand the limitations. If you manage to break the limiations of xedamage, your map must either be REALLY complex, or you're just using an inefficient approach.

Its' such a bs, I used it on my map, ppl use the Attack skill like a kazilion times until it reached the limit and the xedamage no longer works... WoW what a system...

[Emphasis is mine]
I'll say it again: xedamage doesnt break unless youre doing it wrong, or youre doing some really complex shit (and somehow i dont believe this applies to you).

I have high standards, I resist someone looking down at me!
And i resist those who lack a clear understanding of what theyre talking about. Accept that there are people who might have a tad more experience than you do, and can tell from that experience that youre wrong.

Btw., im still waiting for some code. Show me some code that actually proves your point of view, and i can take most of what i said back.
 
Level 11
Joined
Feb 22, 2006
Messages
752
JASS:
scope Damage initializer init

globals
    private xedamage damager
    private unit u1
    private unit u2
endglobals

private function callback takes nothing returns nothing
    call damager.damageTarget(u1, u2, 1)
    call SetWidgetLife(u2, GetUnitState(u2, UNIT_STATE_MAX_LIFE))
endfunction

private function init takes nothing returns nothing
    local timer t = CreateTimer()
    set damager = xedamage.create()
    set damager.damageAllies = true
    set u1 = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    set u2 = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    call TimerStart(t, 0.1, true, function callback)
endfunction

endscope

You can run that for hours and nothing breaks. If you will notice, only one xedamage is instantiated, ever, and it can deal damage however many times it wants. If you actually look through the code, you will notice that xedamage.damageTarget() does not ever instantiate any struct it doesn't clean up, meaning you can call that method as many times as you want without struct instance limitations ever being a factor.

And for each struct type, jasshelper creates:

1 + (([struct storage size] - 8190) / 8191 + 1) * [member count]

arrays.
 
Level 12
Joined
Aug 7, 2004
Messages
875
You dont give me the impression you understand the limitations. If you manage to break the limiations of xedamage, your map must either be REALLY complex, or you're just using an inefficient approach.

I'll say it again: xedamage doesnt break unless youre doing it wrong, or youre doing some really complex shit (and somehow i dont believe this applies to you).

And i resist those who lack a clear understanding of what theyre talking about. Accept that there are people who might have a tad more experience than you do, and can tell from that experience that youre wrong.

Btw., im still waiting for some code. Show me some code that actually proves your point of view, and i can take most of what i said back.

I'm way more expirienced than you kiddo; www.jade-wars.com


JASS:
scope Damage initializer init

globals
    private xedamage damager
    private unit u1
    private unit u2
endglobals

private function callback takes nothing returns nothing
    call damager.damageTarget(u1, u2, 1)
    call SetWidgetLife(u2, GetUnitState(u2, UNIT_STATE_MAX_LIFE))
endfunction

private function init takes nothing returns nothing
    local timer t = CreateTimer()
    set damager = xedamage.create()
    set damager.damageAllies = true
    set u1 = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    set u2 = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
    call TimerStart(t, 0.1, true, function callback)
endfunction

endscope

You can run that for hours and nothing breaks. If you will notice, only one xedamage is instantiated, ever, and it can deal damage however many times it wants. If you actually look through the code, you will notice that xedamage.damageTarget() does not ever instantiate any struct it doesn't clean up, meaning you can call that method as many times as you want without struct instance limitations ever being a factor.

And for each struct type, jasshelper creates:

1 + (([struct storage size] - 8190) / 8191 + 1) * [member count]

arrays.

Yes that is what I did, I created a single xedamage instance for normal type damages, but still after 30-45 minutes of a full game, 5v5, the damage output disapeared.

JASS:
library Weapon initializer init

    globals
        xedamage xd
    endglobals
    
    private function init takes nothing returns nothing
        set xd = xedamage.create()
        set d.damageAllies=false                       
        set d.exception = UNIT_TYPE_FLYING                
        set d.dtype = DAMAGE_TYPE_NORMAL
        call d.useSoundEffect(gg_snd_MetalMediumSliceFlesh1,150.)
        call d.useSpecialEffect("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl","chest")
    endfunction
    
endlibrary

library Sword initializer init requires Weapon

    globals
        integer attack_sword = 'A008'
    endglobals

    function SwordAttack takes nothing returns nothing
        local location l = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()), 150.00, GetUnitFacing(GetSpellAbilityUnit()))
        call SetUnitAnimation(GetSpellAbilityUnit(),"Attack Alternate")
        call PlaySoundOnUnitBJ( gg_snd_HeroShadowhunterMissileLaunch1, 300, GetSpellAbilityUnit() )
        call QueueUnitAnimation(GetSpellAbilityUnit(),"Stand Ready Alternate")
        call xd.damageAOELoc(GetSpellAbilityUnit(),l,150.,30)
        call RemoveLocation(l)
        set l = null
    endfunction
    
    private function condition takes nothing returns boolean
        return GetSpellAbilityId() == attack_sword
    endfunction
    
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t,Condition(function condition))
        call TriggerAddAction(t,function SwordAttack)
        set t = null
    endfunction

endlibrary

I'm don't know what went wrong, but to me, this code ain't rigged. And its a "public released" map at this point, I don't want to risk this type of bug screwing people's games so I said it already, I replaced it with this:

JASS:
function UdU takes real amount, unit source,unit target, string fx, sound sx returns nothing
        call PlaySoundOnUnitBJ(sx,150,target)
        call DestroyEffect(AddSpecialEffectTarget(fx,target,"chest"))
        call UnitDamageTarget(source,target,amount,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    endfunction
    
    function AOEdu takes real amount, unit source, string fx, sound sx, group g returns nothing
        local unit u = FirstOfGroup(g)
        local group y = CreateGroup()
        call GroupAddGroup(g,y)
        loop
            exitwhen(u==null)
            call UdU(amount,source,u,fx,sx)
            call GroupRemoveUnit(y,u)
            set u = FirstOfGroup(y)
        endloop
        call DestroyGroup(y)
        set u = null
        set y = null
    endfunction
    
    function FilterIsEnemy takes nothing returns boolean
        return IsPlayerEnemy(GetOwningPlayer(GetSpellAbilityUnit()),GetOwningPlayer(GetFilterUnit())) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 and GetUnitAbilityLevel(GetFilterUnit(),'Avul') == 0
    endfunction

Now after realizing this, what makes xedamage more efficient and effective, than those three functions I provided???

Though combining xeeffect, collider, cast was very useful, I created nearly 30 awesome custom spells in the game with it, still I am reasonable enough to say that xedamage is useless and quote "xedamage" not the whole XE!!!
 
Level 12
Joined
Aug 7, 2004
Messages
875
And yet you show later in your code that you can't competently handle either leaks or trigonometry, among a variety of other things.

For your information, there are no leaks, and I think I'm way more expirienced than you too after responding to your false judgement, Mr. Development Moderator.

PS. Trigonometry is a math subject dealing with triangles. I suppose you meant, "Geometry". Lol, I can't believe this guy is trying to prove himself to me...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
JASS:
local location l = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()), 150.00, GetUnitFacing(GetSpellAbilityUnit()))
Oh look, a leak.

JASS:
    function AOEdu takes real amount, unit source, string fx, sound sx, group g returns nothing
        local unit u = FirstOfGroup(g)
        local group y = CreateGroup()
        call GroupAddGroup(g,y)
        loop
            exitwhen(u==null)
            call UdU(amount,source,u,fx,sx)
            call GroupRemoveUnit(y,u)
            set u = FirstOfGroup(y)
        endloop
        call DestroyGroup(y)
        set u = null
        set y = null
    endfunction
Why not just add a terribly done and fluffy group loop while we're at it?

PS. Trigonometry is a math subject dealing with triangles. I suppose you meant, "Geometry". Lol, I can't believe this guy is trying to prove himself to me...
Someone knows nothing about PolarProjectionBJ, I take it? Oh, and it's funny you should mention geometry, because trigonometry is geometry.
 
Level 12
Joined
Aug 7, 2004
Messages
875
Oh look, a leak.

Why not just add a terribly done and fluffy group loop while we're at it?

Brb, for a sec.

LOL!!!!

I'm telling you guys, this guy is inexpirienced!

PurplePoot... what if you call

AOEdu() on a group that you still wan't to use later? That wouldn't make sense if you destroy the group inside that call wouldn't it?

JASS:
function Test takes nothing returns nothing
	local group g = CreateGroup()
	call AOEdu(30.,DoOs_101,PurplePoot,"BLOOD!",die.wav,g)
	call IWannaDoSomethingElseWith G!
	call DestroyGroup(g)
	set g = null 
endfunction

Lol...
 
Level 12
Joined
Aug 7, 2004
Messages
875
I don't even know what you're talking about any more. I was referring to your nulling of u and bad FirstOfGroup placement primarily.

Lol keep going, ur obviously the "highlight" at this moment.

Wait a minute, wait... OMG! Bad Placements! BAD! help me jass moderator!

lol :grin:

Oh, and trigonometry is about triangles, I suppose if you're referring to the BJ call, I am lazy, and I'm happy blizzard added that leverage for me...

Oh wait, he edited the post, another "also"...

well you know what, it works, leakless, having alot of parameters in a function call to my habit is ok, since in Java or PHP I get that alot too.

To the rest, feel free to use it, the answer to the question, solved.

lol... bye2
 
Level 14
Joined
Nov 18, 2007
Messages
816
Did you properly debug your code? Like seeing if the spell is triggered? There are actually a lot of things that can go wrong, and not every time its related to some external system.


I'm way more expirienced than you kiddo; www.jade-wars.com
Well, you might actually have more experience coding an actual game, but w/e. That hardly has any influence.

JASS:
library Weapon initializer init

    globals
        xedamage xd
    endglobals

    private function init takes nothing returns nothing
        set xd = xedamage.create()
        set d.damageAllies=false
        set d.exception = UNIT_TYPE_FLYING
        set d.dtype = DAMAGE_TYPE_NORMAL
call d.useSoundEffect(gg_snd_MetalMediumSliceFlesh1,150.)
        call d.useSpecialEffect("Objects\\Spawnmodels\\Human\\HumanBlood\\HumanBloodFootman.mdl","chest")
    endfunction

endlibrary
Syntax errors right here. Also, bad scoping and dependency construction.

JASS:
    function SwordAttack takes nothing returns nothing
        local location l = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()), 150.00, GetUnitFacing(GetSpellAbilityUnit()))
        call SetUnitAnimation(GetSpellAbilityUnit(),"Attack Alternate")
        call PlaySoundOnUnitBJ( gg_snd_HeroShadowhunterMissileLaunch1, 300, GetSpellAbilityUnit() )
        call QueueUnitAnimation(GetSpellAbilityUnit(),"Stand Ready Alternate")
        call xd.damageAOELoc(GetSpellAbilityUnit(),l,150.,30)
        call RemoveLocation(l)
        set l = null
    endfunction
As mentioned earlier, that thing leaks and uses locations. Way to go, EXPERIENCED guy.

JASS:
    globals
        integer attack_sword = 'A008'
    endglobals
Why the fuck is that thing public? Also, naming conventions.

having alot of parameters in a function call to my habit is ok, since in Java or PHP I get that alot too.
Just because youre doing it a lot in PHP and Java doesnt mean you should do it in vJass too.

Oh, and trigonometry is about triangles, I suppose if you're referring to the BJ call, I am lazy, and I'm happy blizzard added that leverage for me...
Awesome shit right here. Yeah, you dont even know how that thing works, yet you use it. Ever tried programming correctly? It helps your codes efficiency a lot.
EDIT: Awww shit, youre coding in Java.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
well you know what, it works, leakless, having alot of parameters in a function call to my habit is ok, since in Java or PHP I get that alot too.
I was evidently referring to the fact that your bad joke call of the function involving our names and various other fields had more arguments than the number of parameters the function wanted.
 
Level 16
Joined
Feb 22, 2006
Messages
960
I just want to say... this thread is rly epic.
I just can say... PurplePoot wanted to help you solving your problem, but you are just
of the opinion that he has no clue what he's talking about and that's a big fault. He is one
of the few members here who rly can help you.
But you can run again and again through the wall
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
Brb, for a sec.

LOL!!!!

I'm telling you guys, this guy is inexpirienced!

PurplePoot... what if you call

AOEdu() on a group that you still wan't to use later? That wouldn't make sense if you destroy the group inside that call wouldn't it?

JASS:
function Test takes nothing returns nothing
	local group g = CreateGroup()
	call AOEdu(30.,DoOs_101,PurplePoot,"BLOOD!",die.wav,g)
	call IWannaDoSomethingElseWith G!
	call DestroyGroup(g)
	set g = null 
endfunction

Lol...

Always empty your group before you destroy it.

And if you're just here to talk shit to poot, one again you're in the wrong forum game.
 
Level 8
Joined
Aug 6, 2008
Messages
451
Hrm, dont know whats happening here, but your group usage can be improved a lot.

You only need a one group, created at map init, for all your GroupEnum -needs.
I suggest you to get GroupUtils from wc3c.net script section as well as read that thread.

Always empty your group before you destroy it.

Bullshit. DestroyGroup sucks, dont use it at all. Recycle your groups. Recycling saves the environment ey.
 

Cokemonkey11

Spell Reviewer
Level 29
Joined
May 9, 2006
Messages
3,531
61705a26be35aa516e4cbeb0937e93e9.png
 
Level 11
Joined
Feb 22, 2006
Messages
752
@codemonkey11:

epic.

and if you actually look at the code for PolarPojectionBJ:

JASS:
function PolarProjectionBJ takes location source, real dist, real angle returns location
    local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
    return Location(x, y)
endfunction

you'll understand why this:

JASS:
local location l = PolarProjectionBJ(GetUnitLoc(GetSpellAbilityUnit()), 150.00, GetUnitFacing(GetSpellAbilityUnit()))

leaks.
 
Status
Not open for further replies.
Top