• 🏆 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] Need Lag Help!!

Status
Not open for further replies.
Level 3
Joined
Apr 7, 2007
Messages
48
I have a hero who has an ability which causes him to sacrifice 50% of his life for agility, when I use this ability for the first time, it lags violently any time after that, i get no lag whatsoever, any ideas on what is causing this. I have tried initializing the two variables at map start up, but that doesn't seem to to anything, advice appreciated.
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
You should always post your full trigger here. On the RIGHT window, right-click the papper icon with your trigger name, and click the Copy as Text. When posting, use the [ TRIGGER ] [ /TRIGGER ] tags, with no spaces. Afterwards, left-click between the two tags, and Press Ctrl + V together. Example:

[TRIGGER="GUI Trigger"]Melee Initialization
Events
Map initialization
Conditions
Actions
Melee Game - Use melee time of day (for all players)
Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
Melee Game - Set starting resources (for all players)
Melee Game - Remove creeps and critters from used start locations (for all players)
Melee Game - Create starting units (for all players)
Melee Game - Run melee AI scripts (for computer players)
Melee Game - Enforce victory/defeat conditions (for all players)
[/TRIGGER]
 
Level 3
Joined
Apr 7, 2007
Messages
48
Ok done, sorry about that, im new here.
  • Blood Sacrifice
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blood Sacrifice
    • Actions
      • Set sachp = ((Life of (Triggering unit)) x 0.50)
      • Set sacunit = (Triggering unit)
      • Set tmp_sacloc = (Position of (Triggering unit))
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Life of (Triggering unit)) x 0.50))
      • Unit - Add Agi Bonus to (Triggering unit)
      • Unit - Set level of Agi Bonus for (Triggering unit) to (Integer((sachp / 100.00)))
      • Floating Text - Create floating text that reads ((String((Integer((sachp / 100.00))))) + ( Agi + !)) at tmp_sacloc with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Wait (30.00 + ((Real((Level of Blood Sacrifice for (Triggering unit)))) x 10.00)) seconds
      • Unit - Remove Agi Bonus from sacunit
      • Custom script: call RemoveLocation( udg_tmp_sacloc )
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
You should set sacunit first and always use it instead of Triggering Unit. It is possible that the mass use of Triggering Unit causes the lag. Not sure, I think a guy had a similar problem once and using the Unit variable solved it.

Additionally, how many levels do you have set for Agi Bonus? It is also possible that many levels for the ability take some time to read. For what I understood, you get the lag once and never again afterwards.


(off-topic) Although I fear you might be IhateArthas, if you are not, you might want to visit the Introductions Forum to introduce yourself to The Hive.

Perhaps if you post in the Introductions forum you might have some more links.
 
Level 3
Joined
Apr 7, 2007
Messages
48
Thank you, I didn't realize about the reading of the ability there are 100 levels (^^; lol) Thats the cause of the lag. Realizing a unit will never get 10,000 hit points to sacrifice its safe to say I can cut those down by alot. I also replaced all the calculations with variables. The trigger looks like this now:

  • Blood Sacrifice
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blood Sacrifice
    • Actions
      • Set sacunit = (Triggering unit)
      • Set sachp = ((Life of sacunit) x 0.50)
      • Set sacagibonus = (Integer((sachp / 100.00)))
      • Set tmp_sacloc = (Position of sacunit)
      • Unit - Set life of sacunit to ((Life of sacunit) - sachp)
      • Unit - Add Agi Bonus to sacunit
      • Unit - Set level of Agi Bonus for sacunit to sacagibonus
      • Floating Text - Create floating text that reads ((String(sacagibonus)) + ( Agi + !)) at tmp_sacloc with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 32.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Custom script: call RemoveLocation( udg_tmp_sacloc )
      • Wait (30.00 + ((Real((Level of Blood Sacrifice for sacunit))) x 10.00)) seconds
      • Unit - Remove Agi Bonus from sacunit
(Off-topic) I'm not this IhateArthas guys, whoever he is, you can clock my IP or whatever you need to, this is the same name as my account on US East.
 
Level 11
Joined
Oct 13, 2005
Messages
233
Also, do you need the ability? You're able to add to the hero's agility through an action, I don't know the exact GUI function for that. Also, I bet your lag is coming from giving a unit the agility ability for the first time. To fix that, on map initialization, create a unit, give it the ability, and then remove the unit. Since it's during map initialization, no lag will be experienced.
 
  • Like
Reactions: Rui
Level 3
Joined
Apr 7, 2007
Messages
48
Yup, thats the source of the lag. Its fixed now, I gave that ability and a host of others that were causing some lag to a unit at startup, now it lags a bit in the beginning but thats no problem. Better than in the middle of a big fight. The ability I like because it shows the green bonus and that looks better than randomly adding to the base agi. Also I can change the scaling on the ability a lot easier if I need to buff (or nerf) the ability.

Also, on a side note but also for this map, is there a way, that once a building sells a unit that the unit dissapears from the building forever? I don't know how to do this and its driving me crazy, there doesnt appear to be a function for it in the actions section.
 
Status
Not open for further replies.
Top