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

[Solved] DisplayTextToPlayer to owner of specific unit?

Status
Not open for further replies.
Level 4
Joined
Aug 16, 2013
Messages
75
Hi, I have been using GUI for a good 10+ years and have finally been trying to move onto using jass with Sharpcraft/WEX.

I had a question about this certain line of code:

JASS:
call DisplayTextToPlayer(GetOwningPlayer('Hpal'), 0, 0, "Hello World")

I want this line of code to show that text to the owners of whoever owns Hpal, which is the Paladin hero.


But I get this error:

"Cannot convert integer to unit in parameter whichUnit in call to GetOwningPlayer"

I don't understand. Hpal is an integer? How can I make this work? Convert Hpal to a unit? What would the function for converting it be? I am totally new at jass so I don't know a lot about it but I have a good understanding of basic programming.


Thank you for your time in reading/helping.
 
Level 4
Joined
Aug 16, 2013
Messages
75
Ahh, okay. I came up with this and it works:

JASS:
call DisplayTextToPlayer(GetOwningPlayer(gg_unit_Hpal_0000), 0, 0, "Hello World")

That's for that specific paladin hero and not for all paladin heroes. If I wanted to show that text to all owners of the Paladin hero, I would do it like in GUI and do: "Pick Every Unit in Unit Group...", convert it to custom text and so on I am assuming. (I am learning jass by converting GUI to custom text).

Thank you for helping me understand, KILLCIDE. :)
 
Last edited:
Status
Not open for further replies.
Top