• 🏆 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!

[Trigger] System fix

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello, I am trying to fix my system: http://www.hiveworkshop.com/forums/spells-569/gui-mana-health-transfer-system-2-0-4-a-269200/

However, I cannot find the solution to this problem:
If a unit moves out of range, then the lightning gets destroyed, but if I then recast the spell on the unit, then visuals are not working anymore for any unit if it moves.

The system is quite complex and messy, I hope you can help me with it.

Additionally, could someone help me fix the leaks ? It seems any of my approaches bug the whole system and I have no idea why.

Triggers
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,468
Avoid destroying GUI triggers. Undestroyed but released TriggerActions were at one point known to corrupt the handle stack, so it's all or nothing :/

In your loop at the bottom of the config trigger, you're using both TempInteger and TempInteger2 in the hashtable and in several other cases you're repeating the same index, making things more complex than the otherwise could be. I recommend rewriting this to an array-based indexing method, which will improve readability (for debugging), improve speed (minor benefit) and while you rewrite you may see errors in your code which you missed the first time.
 

Ardenian

A

Ardenian

Oh, I thought I found a nice way to increase efficiency with destroying triggers :/

I did not use an array-based method on purpose.
It used to use it, but the lightning refresh bugged as the reference between supplier, receiver and lightning were not clear if using arrays. Therefore I had to use the exact reference method using hashtable.

I will do some additional debugging and see what's the issue you mention with the TempInteger, thanks
 

Ardenian

A

Ardenian

As I said before, any Unit Indexing method using arrays will not work appropriate, as the relation is not read correctly. That was the issue with a previous version.
Everything was correct, but the update, the reading of the relation using arrays was false.
 

Ardenian

A

Ardenian

Hmm how were you doing it originally? i figured that you add suppliedUnit[Custom value of suppliedUnit] to unitGroup[Custom value of supplier]. It would all be easy reference, right?

I don't know, I might added wrong conditions or the conditions referred only to one receiver.

I don't get the problem. Just check if a unit gets out of range then?
There is a check. If you go to the supply loop, there is a ITE checking if the unit is alive or in range. In case it is not, then it should be removed from the supply. However, it bugs the lightning refresh of all other receivers of that generator, the lightning stop moving with the receivers.
 
Status
Not open for further replies.
Top