• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[SOLVED] Help with lua function 1.2

Ovnyx

Member
Joined
Jul 25, 2017
Messages
163
Solutions
2
Reaction score
7
hi, anyone can help me with or link of some info about lua functions usage, because there are some functions where parameters are hard to understand, im trying to get how to use doCreatureSay 1.0 function in 1.2 TFS, i tried with
Code:
creature:say(text, type[, ghost = false[, target = nullptr[, position]]])

and:

Code:
player:sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])

but they make crash the client when i use them.

Thanks in advice!!!!
Ovnyx
 
Code:
creature:say("message", TALKTYPE_MONSTER_SAY)

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "message")
 
Solution
hi, anyone can help me with or link of some info about lua functions usage, because there are some functions where parameters are hard to understand, im trying to get how to use doCreatureSay 1.0 function in 1.2 TFS, i tried with
Code:
creature:say(text, type[, ghost = false[, target = nullptr[, position]]])

and:

Code:
player:sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])

but they make crash the client when i use them.

Thanks in advice!!!!
Ovnyx

Best way imo is to just use search bar and look up someone elses usage of the function to see how to do it. Sometimes it doesnt register because of syntax issues but just search like "creature:say(".
 
the arguments listed inside of square brackets are optional, if there's an = sign next to it, it means that it's the default value
so doing creature:say("yes", TALKTYPE_MONSTER) is the same as creature:say("yes", TALKTYPE_MONSTER, false, nil, nil)
just so you know, players, monsters, and npcs all inherit the methods (functions) from the creature class.
which means you can also use player:say, npc:say, and monster:say
since say is a method from the creature class
 
@Thexamx wow, thanks thats exactly what i was searching for!!

Best way imo is to just use search bar and look up someone elses usage of the function to see how to do it. Sometimes it doesnt register because of syntax issues but just search like "creature:say(".

i tried with "creature say" so im taking this advice for next occasion, thanks sir! :)

@Static_ wow thats exactly what i was thinking, thanks for this information!! really helpfull

Bless
 
Back
Top