• 🏆 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] Custom Hero Creation and Lag

Status
Not open for further replies.
Level 3
Joined
Jul 14, 2007
Messages
34
Alright, I searched and spent a decent amount of time building off of a system I saw Vexorian explaining in another thread; I'm trying to let a hero buy an item that will eventually translate into giving a hero the levelable corresponding spell for that item, right now I have it so that when the unit enters a region it converts all his items into spells by removing the item from the inventory and replacing it with a tome that has the ability based off of the tinker's enhancement ability (like Vexorian was talking about in this thread). The system works fine, but it lags ALOT. I don't really know much about JASS or exactly what the term "Leaking" really means, but any suggestions to get around this lag would help and I'm willing to look into JASS if it provides a good way to get around the lag, here's the trigger:

  • Set
    • Events
      • Unit - A unit enters End1 <gen>
      • Unit - A unit enters End2 <gen>
      • Unit - A unit enters End3 <gen>
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Entering unit) in slot 1)) Equal to SkillsArray[(Integer A)]
                  • (Item-type of (Item carried by (Entering unit) in slot 2)) Equal to SkillsArray[(Integer A)]
                  • (Item-type of (Item carried by (Entering unit) in slot 3)) Equal to SkillsArray[(Integer A)]
                  • (Item-type of (Item carried by (Entering unit) in slot 4)) Equal to SkillsArray[(Integer A)]
            • Then - Actions
              • Hero - Create AddSkillsArray[(Integer A)] and give it to (Entering unit)
              • Item - Remove (Item carried by (Entering unit) of type SkillsArray[(Integer A)])
            • Else - Actions
              • Do nothing
I set the arrays as the two items (item they buy and tome used to give them the skill) in different triggers at map initialization.

PM me if you would like the map to see exactly what I'm talking about
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
It lags ? I'd think something like this will defiantly either crash the game or not work at all.

There are no 10 inventory slots in warcraft...

Use a loop from 1 - X (slot numbers you want, I do not see why not use 6) , then use a loop inside it (loop b) that will determine what item it is.

And remove the item before the unit gets the new one so it will have no chance to throw it on the ground because of no-space problems.
 
Level 3
Joined
Jul 14, 2007
Messages
34
The loop was for the array containing the skills, but you're right looping 1-4 for slots would be good for items and then another loop for the item. Also, under the circumstances the hero can only pick up four items at a time, that's why four works. Thanks for the input, but no help about the lag? And why exactly would this crash it?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Oh sorry my mistake, thought I read "(Item carried by (Entering unit) in slot [Integer A])" lol.
Anyway, just do what I said and then check
  • (Item-type of (Item carried by (Triggering Unit) in slot [Integer A)) Equal to SkillsArray[(Integer B)]

You should try using Triggering Unit whenever you can. Other forms can bug with waits and some other things.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
(Item-type of (Item carried by (Entering unit) in slot 1))
and things like this may cause small speed reduction
doing it for 10 times may make lag
Set those 4 to a variable in beggining of actions and use those variables inside actions

And add a Skip Remaning Actions to end of your "Then" Actions
 
Level 3
Joined
Jul 14, 2007
Messages
34
Nah, didn't reduce the lag anything noticable GhostWolf, thanks for that tip about triggering unit though, didn't know that and would changing do nothing to skip remaining actions do anything even though there are no remaining actions?

If this system will always lag any suggestions for a different system? I don't know if yall have played "Terminus Arena" but the custom hero creation in that game is sorta what I'm going for.
 
Status
Not open for further replies.
Top