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

Kill X units quest...

Status
Not open for further replies.
Level 4
Joined
Feb 25, 2008
Messages
58
Can someone help me optimize this?

  • Killing Spiders
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Spider
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) controller) Equal to User
          • SpidersKilled[(Player number of (Owner of (Killing unit)))] Less than (SpidersRequirement[(Player number of (Owner of (Killing unit)))] - 1)
          • QuestSpider[(Player number of (Owner of (Killing unit)))] Equal to started
        • Then - Actions
          • Set SpidersKilled[(Player number of (Owner of (Killing unit)))] = (SpidersKilled[(Player number of (Owner of (Killing unit)))] + 1)
          • Game - Display to (Player group((Owner of (Killing unit)))) the text: ((Spiders killed: + (String(SpidersKilled[(Player number of (Owner of (Killing unit)))]))) + (/ + (String(SpidersRequirement[(Player number of (Owner of (Killing unit)))]))))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • QuestSpider[(Player number of (Owner of (Killing unit)))] Equal to started
            • Then - Actions
              • Set SpidersKilled[(Player number of (Owner of (Killing unit)))] = SpidersRequirement[(Player number of (Owner of (Killing unit)))]
              • Game - Display to (Player group((Owner of (Killing unit)))) the text: ((Spiders killed: + (String(SpidersKilled[(Player number of (Owner of (Killing unit)))]))) + (/ + (String(SpidersRequirement[(Player number of (Owner of (Killing unit)))]))))
              • Game - Display to (Player group((Owner of (Killing unit)))) the text: Quest Complete!
              • Set QuestSpider[(Player number of (Owner of (Killing unit)))] = requirementcomplete
            • Else - Actions
              • Do nothing
I don't know if this is leakless or not, but if someone could help me clean it up and whatnot, that'd be great!
Thanks!
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
I think this leaks:

  • Game - Display to (Player group((Owner of (Killing unit)))) the text: ((Spiders killed: + (String(SpidersKilled[(Player number of (Owner of (Killing unit)))]))) + (/ + (String(SpidersRequirement[(Player number of (Owner of (Killing unit)))]))))
Since it is a Player Group.

You can fix it with:

  • Set TempForce is (Player group((Owner of (Killing unit))))
  • Game - Display to TempForce the text: ((Spiders killed: + (String(SpidersKilled[(Player number of (Owner of (Killing unit)))]))) + (/ + (String(SpidersRequirement[(Player number of (Owner of (Killing unit)))]))))
  • call DestroyForce(udg_TempForce)
 
Level 4
Joined
Feb 25, 2008
Messages
58
Alright cool..
Also, could I convert this to custom text and turn all the globals into locals or would that cause the entire thing to stop working? I guess I'll go try that now!
 
Status
Not open for further replies.
Top