Page 1 of 1

hudPrints from specific party members

Posted: Fri Oct 23, 2015 8:57 am
by FeMaiden
okay, i'm sure this question has already been answered somewhere and it's probably really simplistic but I can't find the answer
I tried searching the forums already.


how do I make the game call up a champion's name and then display it next to text in a hudPrint

I know how to do a hudPrint and put a message and i was just doing something like hudPrint ("party: I have a bad feeling about this")

but what if I wanted to have the game pull the name of the champion in the first slot so that it a text pops up saying something
and then another message pops up with another party member's name like they are having a conversation

so it looks like this

Femaiden : I have a bad feeling about this
Jenni : you always say that
Femaiden : that's because i'm always right
(that's just a made up example, I probably won't use those exact words lol)

but then if someone else is playing and they name their champions like Bob and Susan or something then it will substitute those names instead.


I know it has to do with the getChampion and getName commands but I keep getting crashes because i'm not using proper syntax maybe? I dunno.

I pulled this from another post and tried it

hudPrint(party.party:getChampion(1):getName()"hello")

and i have an error message says "attempt to call a string value X"

Re: hudPrints from specific party members

Posted: Fri Oct 23, 2015 10:08 am
by THOM
You were close...

Code: Select all

hudPrint(" "..party.party:getChampion(1):getName().." important message")
But therfore a champion could be not alive I prefer this:
if party.party:getChampion(1):isAlive() then
hudPrint(" "..party.party:getChampion(1):getName().." important message")
else
hudPrint("important message")
end

Re: hudPrints from specific party members

Posted: Fri Oct 23, 2015 10:18 am
by FeMaiden
THOM wrote:You were close...

Code: Select all

hudPrint(" "..party.party:getChampion(1):getName().." important message")
But therfore a champion could be not alive I prefer this:
if party.party:getChampion(1):isAlive() then
hudPrint(" "..party.party:getChampion(1):getName().." important message")
else
hudPrint("important message")
end
so you have to put those double periods before party and after getName? I kind of thought those were just the person overusing ellipses...

Re: hudPrints from specific party members

Posted: Fri Oct 23, 2015 10:45 am
by minmay
.. is the operator to concatenate strings in Lua.