[SOLVED] Help with lua function 1.2

Discussion in 'Requests' started by Ovnyx, Aug 13, 2017.

  1. Ovnyx

    Ovnyx Premium User Premium User

    Joined:
    Jul 25, 2017
    Messages:
    65
    Likes Received:
    5
    Best Answers:
    0
    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 (Text):
    1.  
    2. creature:say(text, type[, ghost = false[, target = nullptr[, position]]])
    3.  
    and:

    Code (Text):
    1.  
    2. player:sendTextMessage(type, text[, position, primaryValue = 0, primaryColor = TEXTCOLOR_NONE[, secondaryValue = 0, secondaryColor = TEXTCOLOR_NONE]])
    3.  
    but they make crash the client when i use them.

    Thanks in advice!!!!
    Ovnyx
     
  2. Best Answer:
    Post #2 by Thexamx, Aug 13, 2017
  3. Thexamx

    Thexamx worst coder

    Joined:
    Sep 7, 2015
    Messages:
    1,179
    Likes Received:
    285
    Best Answers:
    21
    Best Answer
    Code (Text):
    1.  
    2. creature:say("message", TALKTYPE_MONSTER_SAY)
    3.  
    4. player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "message")
    5.  
     
    Ovnyx likes this.
  4. Apollos

    Apollos Mapper/Lua Scripter

    Joined:
    Apr 22, 2009
    Messages:
    216
    Likes Received:
    131
    Best Answers:
    8
    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(".
     
    Ovnyx likes this.
  5. Static_

    Static_ Premium User Premium User

    Joined:
    Feb 14, 2015
    Messages:
    2,955
    Likes Received:
    1,243
    Best Answers:
    170
    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
     
    Apollos likes this.
  6. Ovnyx

    Ovnyx Premium User Premium User

    Joined:
    Jul 25, 2017
    Messages:
    65
    Likes Received:
    5
    Best Answers:
    0
    @Thexamx wow, thanks thats exactly what i was searching for!!

    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
     
    Apollos likes this.

Share This Page

Loading...