• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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