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

Need a lil help

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I have this custom script:
JASS:
function SetPlayerPrefix takes unit hero returns nothing
    local string txt
    local player player_owner = GetOwningPlayer(hero)
    local integer player_owner_id = GetPlayerId(player_owner)
    set txt = udg_PlayerName[player_owner_id] + " (" + GetUnitName(hero) + ")"
    call SetPlayerName(player_owner, txt)
    set txt = null
    set player_owner = null
endfunction

Now i have this trigger that calls it forth:
  • Events
    • Unit - a unit enters HeroSelection
  • Conditions
    • ((Entering unit)Belongs to an ally of Player 10 (Light Blue) equal to True
    • (Unit-type of (Entering unit)) equal to HeroSelector
  • Actions
    • Unit - Remove (entering unit) from the game
    • Camera - Pan camera for (owner of (Entering unit)) to (center of Light Teleport Base) facing Default building facing (270.0) degress
    • Set RandomUnitLight = Random unit from LightHeros
    • Unit - create 1 unit-type RandomUnitLight for triggering player at Center of Light Teleport Base) facing Default building facing (270) degrees
    • Custom script: call SetPlayerPrefix(udg_RandomUnitLight)
    • Set Players_Hero [(Player number of (triggering player))] = (last created unit)
    • Unit-Group - RandomUnitLight from LightHeros
    • Set RandomUnitLight = no unit
    • Player - add 250 to (Owner of (entering unit) current gold
    • Cinematic - Fade in over 2 seconds using texture Dream and color (100.0%, 100.0%, 100.0%)with 0% transparency
The trigger works fine. As far as i know, the custom script works fine as well. When i try calling the Custom script though (Yes i know it's a suffix), and test it... There is no hero suffix that appears. Any ideas??
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Maybe you mean this one?
native GetHeroProperName takes unit whichHero returns string
instead of "GetUnitName(whichUnit)"
Maybe that works
Cause, do you want the Proper name or the Hero Type (Like Paladin or ArchMage)?
 
Level 9
Joined
Jun 7, 2008
Messages
440
I would like the hero type. Like for instance, The RandomUnitLight was set to Yolandus the Firemage.
Players name would show:
"CrueIIntentions(Firemage): Mornin Fellas - HAPPY APRIL FOOLS DAY!"
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Like this (I think):

JASS:
function SetPlayerPrefix takes unit hero returns nothing
    local string txt
    local player player_owner = GetOwningPlayer(hero)
    local integer player_owner_id = GetPlayerId(player_owner)
    set txt = udg_PlayerName[player_owner_id] + " (" + GetObjectName(GetUnitTypeId(hero)) + ")"
    call SetPlayerName(player_owner, txt)
    set txt = null
    set player_owner = null
endfunction
 
Level 9
Joined
Jun 7, 2008
Messages
440
Okay. The hero selection system i had did not work with that particular custom script. I had to tweak the trigger a bit, but it works fine. Thanks for the help anyways guys. I wonder should i post the finished product for others who may have the same problem or no?
 
Status
Not open for further replies.
Top