Error upon multiple units using the same spell

keychup

Active Member
Reaction score
34
Error upon multiple units using the same spell [SOLVED]

SOLVED
Acknowledgements : NeuroToxin for introducing Hashtables (So that's what a Hashtable does)
If it's possible to shorten the triggers, or if any corrections need to be made to them let me know.

End Result: View attachment Sprite.w3x (May 22nd, 2011)

-------------------------------------------------------------------------------------------------------
So here's the deal.
The ability works fine when only one hero uses the ability. But for some reason when another unit uses that same ability the game either crashes or the ability won't work at all.

The solution would probably be to not let multiple units with that same ability be on the map.

I'd like someone to help me fix up this skill so that it does allow multiple units with the same ability on the map.

(I'm also looking for leaks and perhaps some tips on posting)

Here's the skill I need help with:
225367_10150304764333574_770333573_9741495_7633204_n.jpg


Union

Unite yourself to an allied unit. You cannot separate from your target while united. Increases both units' ATK, DEX and SPD. This effect can be cancelled and lasts for up to 15 seconds or until negated.

Level 1 - +10% ATK, +20% DEX, +5% SPD.
Level 2 - +20% ATK, +40% DEX, +10% SPD.
Level 3 - +30% ATK, +60% DEX, +15% SPD.
Level 4 - +40% ATK, +80% DEX, +20% SPD.
Level 5 - +50% ATK, +100% DEX, +25% SPD.

Cooldown: 15.0 seconds

Visual Effects:
225253_10150304764818574_770333573_9741500_8302776_n.jpg

Error Message:
227799_10150304775163574_770333573_9741521_1715542_n.jpg
 

SanKakU

Member
Reaction score
21
so its kinda like dota's tether. i think the code should be rewritten using vjass/cjass.

i've not tried to make this exact ability. but it might be fun to try. i think there may have been made a lightningutils library at wc3c.net that would be very handy.

i think bump rule is wait 1-2 days but i forget.
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
I didn't read your code, I just read the problem. Assuming each player can only get one unit which casts the ability (e.g. can only get 1 hero which can cast this), then what you need to do is make it unit-specific. So if it's cast by a player's hero, then you can set the hero to a unit variable called 'PlayerHero' or something like that. All other variables which are affected by different players casting this ability need to be changed to arrays to account for this.

- When the ability does work the game sometimes crashes when caster uses ability on another unit that was previously targeted by the ability.

For this, you need to make sure, at either the end or the beginning of the trigger relating to the actual effects of the ability, that all variables that need to be are set/reset properly.
 

keychup

Active Member
Reaction score
34
so its kinda like dota's tether. i think the code should be rewritten using vjass/cjass.

i've not tried to make this exact ability. but it might be fun to try. i think there may have been made a lightningutils library at wc3c.net that would be very handy.

i think bump rule is wait 1-2 days but i forget.

Thanks. Perhaps one day when you've made your own version that works you could tell me about it. ^_^
 

keychup

Active Member
Reaction score
34
I didn't read your code, I just read the problem. Assuming each player can only get one unit which casts the ability (e.g. can only get 1 hero which can cast this), then what you need to do is make it unit-specific. So if it's cast by a player's hero, then you can set the hero to a unit variable called 'PlayerHero' or something like that. All other variables which are affected by different players casting this ability need to be changed to arrays to account for this.



For this, you need to make sure, at either the end or the beginning of the trigger relating to the actual effects of the ability, that all variables that need to be are set/reset properly.

Yep. I already thought of that. When a player casts Union the caster and target are tagged into their specific roles (caster and target respectively). Arrays are already implemented.
Variables:
ab_union_bool_yn: Boolean Array (12) : Checks when the ability is active.
ab_union_ligtng_eff: Lightning Effect Array (12) : Visual Effects for Ability
ab_union_speff_cas: Special Effect Array (12) : Special Effect on Caster
ab_union_speff_tar: Special Effect Array (12) : Special Effect on CasterTarget
ab_union_timr_int: Timer Array (12) : Time interval which checks when Caster is too far from Target or when one of them loses buff.
ab_union_unit_cas: Unit Array (12) : Casting Unit
ab_union_unit_tar: Unit Array (12) : Target Unit of Ability being cast

In the end of the effect I have already tried cleaning up the variables in this manner:

Trigger:
  • Else - Actions
    • Countdown Timer - Pause ab_union_timr_int[(Integer A)]
    • Special Effect - Destroy ab_union_speff_cas[(Integer A)]
    • Special Effect - Destroy ab_union_speff_tar[(Integer A)]
    • Player - Enable Union (icon) for (Player((Integer A)))
    • Unit - Remove Union (cancel) from ab_union_unit_cas[(Integer A)]
    • Unit - Remove Union buff from ab_union_unit_cas[(Integer A)]
    • Unit - Remove Union buff from ab_union_unit_tar[(Integer A)]
    • Lightning - Destroy ab_union_ligtng_eff[(Integer A)]
    • Set ab_union_unit_cas[(Integer A)] = No unit
    • Set ab_union_unit_tar[(Integer A)] = No unit
    • Set ab_union_bool_yn[(Integer A)] = False
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Why do you use arrays, when hashtables give sufficient MUIness? (My turn to make up words) Arrays are quite limited in this case.
 

keychup

Active Member
Reaction score
34
Why do you use arrays, when hashtables give sufficient MUIness? (My turn to make up words) Arrays are quite limited in this case.

Do tell. I'd like to see what you can teach me about these hashtables. I'm not really sure how you use them. And I can't really try them out to see how they work because I can't even tell if something's happening.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top