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

My spell lags hard

Status
Not open for further replies.
Level 2
Joined
Jul 29, 2011
Messages
7
Ok i made a spell that bloodlust the unit and gives +5 damage per attack while bloodlusted, but the thing is the first time the unit cast the spell it freezes the game very hard (it doesnt lag if i use it for the second time for the same unit). I have no idea why this happens, i have longer spells and none of them lags at all :S
This are the triggers:

2eb4mzr.jpg


EDIT: i realized there is a mistake in the second line (i just learnt how to leak).
 
Last edited:
Level 29
Joined
Mar 10, 2009
Messages
5,016
- for Player1 >>> TriggerPlayer
- Position of triggering unit >>> Posdumyblood
- always save the keys to an integer variable for faster and better performance
- Instead of making another trigger "AddDamage", you could check the
current order of the hero, then the buff in the "Blood Lust End" trigger...

sometimes it's better to do this...
- key triggering unit >>> key of last created unit
- Unit Group Add triggering unit >>> add bloodluster
coz trigger unit key will always overwrite the previous one
 
Level 2
Joined
Jul 29, 2011
Messages
7
- for Player1 >>> TriggerPlayer
- Position of triggering unit >>> Posdumyblood
ye thanks i already changed that

- always save the keys to an integer variable for faster and better performance
Do you mean that i should put something like "Hashtable - Save (Triggering unit) as 3 of (Key ( "Some integer")) in Hastable"?
- Instead of making another trigger "AddDamage", you could check the
current order of the hero, then the buff in the "Blood Lust End" trigger...
i didnt know i could do that, but woulndt that add damage each times it reads the trigger instead of add damage for each attack?

sometimes it's better to do this...
- key triggering unit >>> key of last created unit
- Unit Group Add triggering unit >>> add bloodluster
coz trigger unit key will always overwrite the previous one

I dont really understand what you put here, why should i key the dummy?

thanks for the help :p

BTW by "lags hard" i mean it freezes completely the game for 1 second, and i have a very good computer. Maybe its not much but its annoying.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Leaks. If you remove the leaks I am prety sure performance will increase.

You leak atleast 1 location (the one I see is when you create the unit).
You leak internal values into the hashtable (nowhere do you flush it when instances of the spell end.

You might also get inital cast freeze due to loading units and abilities but that will only happen once per game session.

Further optimizations for better performance.
- More efficient algorthim (using an array based system for data lookup instead of hashtables and groups).
- Optimize code using JASS (GUI creates a lot of bloat code).
- Use shorter variable and function names (as JASS is intrpereted).
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
Do you mean that i should put something like "Hashtable - Save (Triggering unit) as 3 of (Key ( "Some integer")) in Hastable"?

I dont really understand what you put here, why should i key the dummy

make an integer variable, sample >>> ID

then...
  • Custom script: set udg_ID = GetHandleId(GetTriggerUnit())
  • Hashtable - Save BloodON as 1 ID in HashtableRouge
i didnt know i could do that, but woulndt that add damage each times it reads the trigger instead of add damage for each attack?

no, coz it checks if it's the "current" attack order
do something like this...

JASS:
if GetUnitCurrentOrder(YOURUNIT)==851983 then
   //do actions here if your unit has buff
endif
 
Status
Not open for further replies.
Top