• 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.

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,258
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
 
  • 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