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



Reply
 
Thread Tools Search this Thread
Old 04-11-2010, 06:06 PM   #61
MasterofSickness
User
 
MasterofSickness's Avatar
 
Join Date: Feb 2006
Posts: 218

MasterofSickness is on a distinguished road (23)

Question

Ah, so integer level is unused in this example, but already integrated.
If you want process the level you just can start coding the function without changing the function declaration itself. Ok, a comment on that would have been nice...

Hmm, I tried what you said.
I deleted my folder "jasshelper" in "JassNewGenPackv5d", copied and pasted the original "jasshelper"-folder from a backup of "JassNewGenPackv5d". Then I had the original state of JassNewGen. I copied the whole content of "0.A.2.B.jasshelper" and pasted it into the "jasshelper"-folder and replaced some existing files.
I started WE, opened "ABuffSystem1.5.w3x" and tried to save.
The same error I had at first here:
Quote:
EDIT
3) I can't save your map!?
(I use the latest "JassNewGenPackv5d")
I get following error-message:
Attachment

EDIT
When I only replace the "jasshelper.exe" with the new one and the "common.j" and "Blizzard.j" with the extracted ones from the "War3Patch.mpq" from Version 1.24e, then I still get this error (also proof, that the new jasshelper in Version 0.A.2.B. is used):
Click image for larger version

Name:	hm.JPG
Views:	25
Size:	119.5 KB
ID:	48663
Where is the mistake??

Last edited by MasterofSickness : 04-11-2010 at 08:08 PM.
MasterofSickness is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-13-2010, 07:53 PM   #62
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

The errors seem to indicate your Jasshelper still isn't properly updated, since it cannot identify hashtables which were added in a recent patch. I wish I could help you more, but I do not have much experience with such problems, so you are better off making a thread about it in the triggering or the programming forum. All I know is that this is not a problem with DamageEvent since it compiles fine in my NewGen. If it can be of any help, I'm attaching the JassHelper folder from my NewGen to this post.

Edit: old attachment removed. Also, I moved a somewhat off-topic conversation to a new thread.
__________________

Last edited by Anitarf : 06-24-2010 at 06:58 PM.
Anitarf is offline   Reply With Quote
Old 04-13-2010, 08:07 PM   #63
MasterofSickness
User
 
MasterofSickness's Avatar
 
Join Date: Feb 2006
Posts: 218

MasterofSickness is on a distinguished road (23)

Default

Thanks for your kind help Anitarf and great idea to upload your working jassshelper.
I just tried to use your jasshelper folder, but still the problem with the 'Undefined type hashtable'.
I think I will follow your advice and open a new thread since even you and others could not explain this error.
Ok, BTT.

EDIT
I started a new thread about this.

Last edited by MasterofSickness : 04-14-2010 at 10:31 AM.
MasterofSickness is offline   Reply With Quote
Old 09-06-2010, 12:13 PM   #64
sephiroth1234
User
 
sephiroth1234's Avatar
 
Join Date: Dec 2009
Posts: 6

sephiroth1234 has little to show at this moment (0)

Default

What does the DamageModifier(s) do? Sorry can't understand the statement.
sephiroth1234 is offline   Reply With Quote
Old 09-06-2010, 02:54 PM   #65
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by sephiroth1234
What does the DamageModifier(s) do? Sorry can't understand the statement.
I am not sure I can explain it any better than the first post and the system documentation does. It allows you to modify the damage that units take, for example you can use it to make a buff spell that blocks damage.
__________________
Anitarf is offline   Reply With Quote
Old 09-07-2010, 10:49 AM   #66
sephiroth1234
User
 
sephiroth1234's Avatar
 
Join Date: Dec 2009
Posts: 6

sephiroth1234 has little to show at this moment (0)

Default

I get it! TY
sephiroth1234 is offline   Reply With Quote
Old 05-21-2011, 02:52 PM   #67
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

I updated the DamageModifiers library with some minor changes:

Version 1.1 changes:
  • Fixed a bug that would cause an incorrect total damage to be reported back to DamageEvent in some circumstances.
  • GetUnitLife returns 0.0 instead of negative values for for units that are about to die from the stacked damage.
  • Narrowed the criteria for applying the survival ability. It should now only be applied when it is really needed.
  • Improved the documentation.
__________________
Anitarf is offline   Reply With Quote
Old 05-23-2011, 01:53 PM   #68
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Why not take advantage of the AutoCreate and AutoDestroy modules when creating such a system (talking about DamageEvent here)? Would it be less efficient or something?

Here's what I'd do:
Collapse Zinc:
//! zinc
library DamageEvent requires AutoIndex {

    constant real DAMAGE_THRESHOLD = 0.0;

    public type damageResponse extends function(unit, unit, real);
    
    damageResponse responses[];
    integer responseCount = 0;
    
    public function RegisterDamageResponse(damageResponse whichResponse) {
        responses[responseCount] = whichResponse;
        responseCount += 1;
    }
    
    struct eventStruct {
    
        private trigger mainTrigger;
        
        private static method createFilter(unit enteringUnit) -> boolean {
            return true;
        }
        
        private method onDestroy() {
            DestroyTrigger(this.mainTrigger); 
            this.mainTrigger = null;
        }

        private static method onDamage() -> boolean {
            unit damagedUnit = GetTriggerUnit(), damageSource = GetEventDamageSource();
            real damageAmount = GetEventDamage();
            integer loopCount = 0;
            while (damageAmount > DAMAGE_THRESHOLD) {
                static if (LIBRARY_xedamage) { if (xedamage.isDummyDamage) { break; }}
                static if (LIBRARY_DamageModifiers) { damageAmount = RunDamageModifiers(); }
                while (loopCount < responseCount) {
                    responses[loopCount].evaluate(damagedUnit, damageSource, damageAmount);
                    loopCount += 1;
                }
                break;
            }
            damagedUnit = null; damageSource = null;
            return false;
        }

        private method onCreate() {
            this.mainTrigger = CreateTrigger();
            TriggerRegisterUnitEvent(this.mainTrigger, this.me, EVENT_UNIT_DAMAGED);
            TriggerAddCondition(this.mainTrigger, Condition(function thistype.onDamage));
        }
        
        module AutoCreate; module AutoDestroy;
    }
}
//! endzinc

Also, a tiny suggestion:
Collapse JASS:
static if (LIBRARY_LightLeaklessDamageDetect) then
    private function DamageC takes nothing returns boolean
        call Damage() // Used to interface with LLDD.
        return false
    endfunction
endif // Now this function won't even exists unless it is actually needed.

Anyway, DamageModifiers is indeed the most robust damage modification system available. Magnificent job, Anitarf.
BBQ is offline   Reply With Quote
Old 05-23-2011, 03:47 PM   #69
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by BBQ
Why not take advantage of the AutoCreate and AutoDestroy modules when creating such a system (talking about DamageEvent here)? Would it be less efficient or something?
I am not certain regarding the efficiency of the thing, as far as I know the two approaches are equivalent in this regard.

The reason I chose a single trigger approach in lieu of a trigger per unit was that at the time, dynamic triggers were associated with some nasty unexplained bugs, the so called handle stack corruption. That may still be the case, at least I am not aware of anyone conclusively showing what the cause of those bugs was, so I avoided and continue to avoid using dynamic triggers like that.

Even when using a single trigger, it needs to be periodically destroyed to remove unneeded events, but this can be easily turned off if any ugly bugs do show up in the map. It was also hypothesized that the bug occurs if a trigger is destroyed while instances of it are running, that's why I destroy the trigger in DamageEvent with a delay. Writing code based on speculation like this is not really ideal, but it's better than being hit by handle stack corruption which, even though obscure and not entirely understood, has been demonstrated to occur.

Edit: also, we didn't have AutoIndex back when I developed this, so managing the triggers for each unit would have been a lot more work. Even now that we have AutoIndex, I don't wish to add a dependency to the library if it it can be written just as well without it.

Quote:
Also, a tiny suggestion:
Collapse JASS:
static if (LIBRARY_LightLeaklessDamageDetect) then
    private function DamageC takes nothing returns boolean
        call Damage() // Used to interface with LLDD.
        return false
    endfunction
endif // Now this function won't even exists unless it is actually needed.
As far as I'm aware, the map optimizer already removes unused functions from the map script. If that's not the case, I can add the static ifs.
__________________

Last edited by Anitarf : 05-23-2011 at 03:52 PM.
Anitarf is offline   Reply With Quote
Old 05-23-2011, 04:57 PM   #70
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Quote:
Originally Posted by Anitarf
The reason I chose a single trigger approach in lieu of a trigger per unit was that at the time, dynamic triggers were associated with some nasty unexplained bugs, the so called handle stack corruption. That may still be the case, at least I am not aware of anyone conclusively showing what the cause of those bugs was, so I avoided and continue to avoid using dynamic triggers like that.
You're right; the handle stack gets corrupted quite easily, but only when trigger actions are used in conjunction with dynamic triggers. As you can see from the example code, I used trigger conditions, and I am yet to see anyone reproduce that bug without the use of trigger actions.

If memory serves me well, Jesus4Lyf's Damage is coded quite similarly, except that it uses AIDS structs instead of AutoCreate and AutoDestroy.

Quote:
Originally Posted by Anitarf
Even now that we have AutoIndex, I don't wish to add a dependency to the library if it it can be written just as well without it.
I'll have to agree with you on this one.

Quote:
Originally Posted by Anitarf
As far as I'm aware, the map optimizer already removes unused functions from the map script. If that's not the case, I can add the static ifs.
Yes, the optimizer should do that, but I have seen people who prefer not to use it; justified by the fact that it screws up some stuff, most notably the UnitAlive(unit) native.

Nevertheless, this thing is definitely fine as it is, and I just wanted to point out the possibility of using AutoIndex here (although I'm very sure that you had already thought of it).

Last edited by BBQ : 05-23-2011 at 04:57 PM.
BBQ is offline   Reply With Quote
Old 06-09-2011, 11:24 PM   #71
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by BBQ
You're right; the handle stack gets corrupted quite easily, but only when trigger actions are used in conjunction with dynamic triggers. As you can see from the example code, I used trigger conditions, and I am yet to see anyone reproduce that bug without the use of trigger actions.
Well, it's possible trigger conditions are perfectly safe. Normally, we assume things we use are safe until proven otherwise but when it comes to dynamic triggers I prefer to err on the side of caution. It helps that dynamic triggers don't seem to be particularly essential. I don't see a drawback in my implementation of DamageEvent compared to one that uses a trigger per unit so even if handle stack corruption were not an issue, the trigger-per unit approach could at best be equal to mine.

Quote:
Yes, the optimizer should do that, but I have seen people who prefer not to use it; justified by the fact that it screws up some stuff, most notably the UnitAlive(unit) native.
Yeah, that is messed up. Not the optimizer, the fact that people would write/use code that prevents their map from taking advantage of one of the best modding tools we have at our disposal. What's so good about the UnitAlive native anyway? Never mind, that's a discussion for a different place.

Quote:
Nevertheless, this thing is definitely fine as it is, and I just wanted to point out the possibility of using AutoIndex here (although I'm very sure that you had already thought of it).
It took me a while to get on the AutoIndex bandwagon (but then again, it also took a while for AutoIndex to become as awesome as it is today), so most of my code does not use it. As noted above, I still don't see a particular use for it in DamageEvent, however DamageModifiers can make great use of AutoCreate/AutoDestroy modules.
__________________
Anitarf is offline   Reply With Quote
Old 06-10-2011, 09:15 AM   #72
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

You can fix any optimizer bug by editing the war3map.j file after it's run. There are good mpq tools that let you do that.

And it's only "shorten names" that's broken, the rest of the stuff works quite well.
Bribe is offline   Reply With Quote
Old 11-01-2011, 11:13 AM   #73
codart
User
 
Join Date: Jan 2011
Posts: 15

codart has little to show at this moment (0)

Default

a question please! What can i do if i just need block damage once on the trigger, no need the whole DamageModifiers struct?
codart is offline   Reply With Quote
Old 11-01-2011, 06:13 PM   #74
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by codart
a question please! What can i do if i just need block damage once on the trigger, no need the whole DamageModifiers struct?
I'm not sure what you mean. If you want to block damage with this system, you have to use a DamageModifier, it does not matter if you're doing it once or repeatedly. What exactly did you have in mind?
__________________
Anitarf is offline   Reply With Quote
Old 11-03-2011, 12:49 AM   #75
BBQ
User
 
Join Date: May 2011
Posts: 85

Submissions (2)

BBQ will become famous soon enough (30)BBQ will become famous soon enough (30)

Default

Anitarf, what do you think of the following implementation of DamageEvent:
Expand DamageEvent:

Last edited by BBQ : 11-03-2011 at 07:35 AM.
BBQ 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:04 PM.


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

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