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 05-13-2009, 07:22 PM   #31
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

It would be a good idea for a debug option, but AutoIndex sets the UserData as soon as units come into the map. It wouldn't be able to detect if some other system changed it after that, without doing something crazy like attaching the index the unit is "supposed" to have to the unit using Table. Then there is the fact that the UserData version doesn't need Table, and the Table version wouldn't have this problem to begin with.
grim001 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 05-13-2009, 08:19 PM   #32
Mr.Malte
User
 
Mr.Malte's Avatar
 
Join Date: Apr 2008
Posts: 286

Submissions (2)

Mr.Malte is on a distinguished road (11)

Default

My system works the same way like.
If a debug value is activated, and a unit enters the map, I save initiali Index and Unit.

so Index[ind] = ind
set Unit[ind] = IndexedUnit

And every 30. seconds I loop through all stored Indexes.
If GetUnitUserData of the Indexed unit isnt the stored Initial Index, UnitUserData was affected...
Mr.Malte is offline   Reply With Quote
Old 05-14-2009, 05:46 PM   #33
Tyrande_ma3x
User
 
Tyrande_ma3x's Avatar
 
Join Date: Feb 2009
Posts: 185

Submissions (1)

Tyrande_ma3x is on a distinguished road (12)

Default

I'm really glad with the newest changes and I'm happy to say that this system works like a charm.

There was a little inconsistency in your first post, though:
Quote:
Originally Posted by First Post
You can use RegisterUnitEntersMap/RegisterUnitLeavesMap to execute specific functions
Those functions were replaced with different names, right?
Tyrande_ma3x is offline   Reply With Quote
Old 05-14-2009, 11:06 PM   #34
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

Fixed.

I also posted new versions, the last ones were perfectly fine, but I was forced to make an incredibly small change to make AutoIndex compatible with the approved version of StatusDetect. You should update if you plan to use StatusDetect.
grim001 is offline   Reply With Quote
Old 05-17-2009, 07:29 PM   #35
Tyrande_ma3x
User
 
Tyrande_ma3x's Avatar
 
Join Date: Feb 2009
Posts: 185

Submissions (1)

Tyrande_ma3x is on a distinguished road (12)

Default

Ok, there's something really wrong about this - now it unassigns indexes right after a unit's death ... That shouldn't work like that... After some unit dies (I tested with Heroes mainly), GetUnitId returns 0 for it.

Last edited by Tyrande_ma3x : 05-17-2009 at 07:30 PM.
Tyrande_ma3x is offline   Reply With Quote
Old 05-17-2009, 09:07 PM   #36
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 can't get it to do that. Will you post code or a test map?

New versions posted. RemoveUnitEx is gone. I found the most insane hack of a way to detect RemoveUnit. It also now handles units with Locust correctly. I would appreciate if people test the new version to see if there are any fixes that need to be made, I would like to declare AutoIndex to be done sometime soon.

Last edited by grim001 : 05-18-2009 at 12:06 AM.
grim001 is offline   Reply With Quote
Old 05-20-2009, 11:58 AM   #37
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

New version is posted. Tyrande_ma3x's bug is fixed. Turns out that repeatedly killing and reviving heroes could cause them to get deindexed.

The entire removal detection part has actually been redone from scratch as the aforementioned flaw was unresolvable with the old method. I like the new way of doing it much better, although it relies on a crazy UnitState glitch that I found, it really does make everything work better.
grim001 is offline   Reply With Quote
Old 05-20-2009, 04:04 PM   #38
wraithseeker
User
 
Join Date: Feb 2009
Posts: 406

wraithseeker is on a distinguished road (17)

Default

Grim I'm not sure if that AutoData module you posted to me works or not, check it out in the Triggers and Scripts. Might be a problem with it or maybe CustomStun system just bugs.
wraithseeker is offline   Reply With Quote
Old 05-20-2009, 05:04 PM   #39
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Collapse JASS:
private static method removeCheck takes nothing returns boolean
            set .removing[GetUnitId(GetTriggerUnit())] = not .removing[GetUnitId(GetTriggerUnit())]
            call SetWidgetLife(GetTriggerUnit(), .1)
            //Please don't ask me to explain what this method is doing, it would take way too long.
            //It's a crazy UnitState glitch that makes it possible to notice units being removed.
        return false
    endmethod
Sorry, but i have to ask.
Troll-Brain is offline   Reply With Quote
Old 05-20-2009, 05:30 PM   #40
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

Just consider all of the following stuff:

Turns out that UNIT_STATE_LIFE and undefend orders are the two triggers that will fire for a unit after RemoveUnit is used on a unit but before it leaves the game. Using the combination of those, I was able to find a pattern that is unique to units that had RemoveUnit used on them.

If a unit has multiple UNIT_STATE_LIFE events registered, and one of them is for = 0. life, all of the unit state events registered for a value lower (but not equal to) the unit's max health will fire when the unit dies. So when the 0 life event fires, it makes the = 0.7923512 event fire, for no reason at all. And somehow the events behave differently if you change the unit's life to not-zero during the event, and that difference is what makes units being removed by RemoveUnit distinguishable.

It is possible for a unit that is not being removed to have the method you quoted fire twice, the solution was to use a boolean and make it negate itself. So only when it runs once will the unit be considered removed.

It is really just a horrible hack, the code makes no sense, but it empirically produces the correct result. What is amazing is that I can't figure out a way to break the detection anymore. So go ahead and try.

Last edited by grim001 : 05-20-2009 at 05:46 PM.
grim001 is offline   Reply With Quote
Old 05-20-2009, 05:50 PM   #41
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Really interesting and nice discovery.
However could you make the user able to use a defend based ability or a magic defence based ability ?
If you do it i will use that instead of UnitIndexingUtils.

Sure i could edit it myself, but it's not mine.
Troll-Brain is offline   Reply With Quote
Old 05-20-2009, 05:52 PM   #42
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

Nowhere in the documentation does it mention that you can't use defend based abilities, having multiples of them on the same unit hasn't broken the detection for the past several versions.
grim001 is offline   Reply With Quote
Old 05-20-2009, 05:57 PM   #43
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Quote:
Originally Posted by grim001
Nowhere in the documentation does it mention that you can't use defend based abilities, having multiples of them on the same unit hasn't broken the detection for the past several versions.
Hmm i was pretty sure you needed to use custom functions to manage them in past several functions, which was quite annoying, anyway it seems you don't need it (anymore ?) so i will definitely switch to this.
Troll-Brain is offline   Reply With Quote
Old 05-20-2009, 06:04 PM   #44
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 Troll-Brain
Hmm i was pretty sure you needed to use custom functions to manage them

That was in the first couple versions. Once I got rid of that, the tradeoff was that you had to use RemoveUnitEx. But then it turns out it broke when dealing with killing/reviving heroes. The old method turned out to be a dead end, that hero bug seemed unfixable. So I found the UNIT_STATE_LIFE idea and wound up with this new version. There have been a lot of changes that are probably confusing to people who've been visiting this thread.

The current version has no drawbacks at all, it really is the fully automatic indexing/deindexing I wanted from the start. But it needs heavy duty public testing to make sure no one finds a way to break it.

Last edited by grim001 : 05-20-2009 at 06:16 PM.
grim001 is offline   Reply With Quote
Old 05-20-2009, 06:31 PM   #45
Troll-Brain
User
 
Join Date: Oct 2006
Posts: 1,490

Submissions (1)

Troll-Brain has a spectacular aura about (134)

Default

Made some tests and i THINK i've found a way to break it. (didn't test)

Quote:
If a unit has multiple UNIT_STATE_LIFE events registered, and one of them is for = 0. life, all of the unit state events registered for a value lower (but not equal to) the unit's max health will fire when the unit dies. So when the 0 life event fires, it makes the = 0.7923512 event fire, for no reason at all.
Actually it's not about the unit's max health but the current life of the unit.

For example if you register a 0.7923512 life and a 10.0 life if the unit had more than 10 hp before get killed the two events will fire, but if the unit had less than 10 hp, only the 0.7923512 life event will fire.

So guess what happens if the unit got 0.6 hp for during more that instantly and get killed after.
Or maybe in the current version it handles this case, i've not really thought about it.

So if i'm right you should probably only use 0.405 or use a trigger witch detect the dead event, this last option is more sure/stable if you can use it.

Sorry if i've misunderstood you.

Last edited by Troll-Brain : 05-20-2009 at 06:39 PM.
Troll-Brain 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 01:48 PM.


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

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