• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Problem with Script: Get Killing Unit

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,026
Hi, I'm trying to get the game to play a sound specificaly for a player, I need it to play for the owner of the killing unit, im using costum script as directed but its not working.
The map tells me ive made an error and turns the trigger off :/
Here is my Trigger:

Gileneas is Conquered
  • Events
    • Unit - King of Gilneas 0256 <gen> Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Killing unit)) Equal to Player 1 (Red)
          • (Owner of (Killing unit)) Equal to Player 4 (Purple)
          • (Owner of (Killing unit)) Equal to Player 5 (Yellow)
          • (Owner of (Killing unit)) Equal to Player 10 (Light Blue)
    • Actions
      • Trigger - Turn off (This trigger)
      • Wait 5.00 seconds
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetKilling()) then
      • Sound - Play QuestCompleted <gen>
      • Custom script: endif
      • Unit - Remove (Triggering unit) from the game
pls help
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,156
The reason for the error is because you have a JASS syntax error (the script makes no sense to the interpreter).

The native you want...
JASS:
constant native GetKillingUnit takes nothing returns unit
Correct line of script...
JASS:
if GetLocalPlayer() == GetOwningPlayer(GetKillingUnit()) then
 
Level 7
Joined
Jul 1, 2008
Messages
1,026
Thank you for the quick replies, I can't say I'm having any more luck with this, I tried your trigger Pharoh but I'm still getting an error, is there anyone wrong with this still?

  • Gileneas is Conquered
  • Gileneas is Conquered
    • Events
      • Unit - King of Gilneas 0256 <gen> Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Killing unit)) Equal to Player 1 (Red)
          • (Owner of (Killing unit)) Equal to Player 4 (Purple)
          • (Owner of (Killing unit)) Equal to Player 5 (Yellow)
          • (Owner of (Killing unit)) Equal to Player 10 (Light Blue)
    • Actions
      • Trigger - Turn off (This trigger)
      • Set killingunit = (Killing unit)
      • Wait 5.00 seconds
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(udg_Killingunit) then
      • Sound - Play QuestCompleted <gen>
      • Custom script: endif
      • Unit - Remove (Triggering unit) from the game
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
  • Gileneas is Conquered
    • Events
      • Unit - King of Gilneas 0256 <gen> Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Killing unit)) Equal to Player 1 (Red)
          • (Owner of (Killing unit)) Equal to Player 4 (Purple)
          • (Owner of (Killing unit)) Equal to Player 5 (Yellow)
          • (Owner of (Killing unit)) Equal to Player 10 (Light Blue)
    • Actions
      • Trigger - Turn off (This trigger)
      • Set killingunit = (Killing unit)
      • Wait 5.00 seconds
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(udg_killingunit) then
      • Sound - Play QuestCompleted <gen>
      • Custom script: endif
      • Unit - Remove (Triggering unit) from the game
Jass is key-sensitive, so if your variable is named 'killingunit' you have to consider writing it's exact name: 'udg_killingunit', not 'udg_Killingunit'. ;)
 
Status
Not open for further replies.
Top