• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Problem with Script: Get Killing Unit

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,025
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 64
Joined
Jan 18, 2005
Messages
27,207
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,025
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
 
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