NPC Mission

Discussion in 'Programming & Scripting' started by Limos, Mar 10, 2014.

  1. Itutorial

    Itutorial Active Member

    Joined:
    Dec 23, 2014
    Messages:
    976
    Likes Received:
    159
    Best Answers:
    12
    A way to set the distance for an NPC to listen to a play? TFS 1.2
     
  2. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
  3. Itutorial

    Itutorial Active Member

    Joined:
    Dec 23, 2014
    Messages:
    976
    Likes Received:
    159
    Best Answers:
    12
    That doesn't seem to change anything
     
  4. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
    Did you restart the server?
     
  5. Itutorial

    Itutorial Active Member

    Joined:
    Dec 23, 2014
    Messages:
    976
    Likes Received:
    159
    Best Answers:
    12
    of course :p
     
  6. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
    what if i need to do alot of monsters? i understood the creatureevents one.
     
  7. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
  8. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
  9. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
    What kind of example do you mean, can you be more specific about what you are looking for?
     
  10. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
    I'm using tfs 0.4 and i've mitrox script so what i need is like this
    Code (Text):
    1.   [1] = {monsters= {
    2.      {name = hydra, count = 12},
    3.      {name = demon, count = 20},
    4.  
     
  11. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
    The script I linked has this.
    Code (Text):
    1.  
    2. [2] = {
    3.    monsters = {
    4.      {name = "Rats", count = 20, storage = 21900},
    5.      {name = "Rotworms", count = 26, storage = 21901}
    6.    },
    7.    message = "Thanks, for your next mission kill",
    8.    level = 30,
    9.    rewarditems = {
    10.      {id = 2160, count = 5}
    11.    },
    12.    rewardexp = 40000
    13. },
    14.  
     
    Activity likes this.
  12. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
    So for tfs 0.4 i must use this one
    http://pastebin.com/frSUfSrp
    Code (Text):
    1. local config = {
    2.      ['dragon'] = {amount = 5, storage = 19000, startstorage = 5002, startvalue = 1},
    3.      ['dragon lord'] = {amount = 3, storage = 19001, startstorage = 5002, startvalue = 1}
    4. }
    5. function onKill(cid, target)
    6.      local monster = config[getCreatureName(target):lower()]
    7.      if isPlayer(target) or not monster or isSummon(target) then
    8.          return true
    9.      end
    10.  
    11.      if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount and getPlayerStorageValue(cid, monster.startstorage) >= monster.startvalue then
    12.          setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
    13.          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Task message: '..(getPlayerStorageValue(cid, monster.storage)+1)..' of '..monster.amount..' '..getCreatureName(target)..'s killed.')
    14.      end
    15.      if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
    16.          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and completed the '..getCreatureName(target)..'s mission.')
    17.          setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
    18.      end
    19.      return true
    20. end
     
  13. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
    Yes, and change the storages so they match with the ones in the NPC script.
     
    Activity likes this.
  14. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
    Last thing, Like this?
    Code (Text):
    1.   [2] = {
    2.                 monsters = {
    3.                         {name = "Rats", count = 20, storage = 21900},
    4.                         {name = "Rotworms", count = 26, storage = 21901}
    5.  
    But what about Start value?
     
    Last edited: Apr 13, 2016
  15. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
    The startstorage should be the NPC storage, so 45551, the names of the monsters in the creaturescript should be without capital and s, so just rat and rotworm, the monster storage is correct.
     
    Activity likes this.
  16. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
    thanks, gonna try it.
     
  17. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0
    @Limos I've did all what you said and this is the result
    Code (Text):
    1. local config = {
    2.      ['rat'] = {amount = 20, storage = 21900, startstorage = 45551, startvalue = 1},
    3.      ['rotworm'] = {amount = 26, storage = 21901, startstorage = 45551, startvalue = 1},
    4.      ['dragon lord'] = {amount = 25, storage = 21902, startstorage = 45551, startvalue = 1}
    5. }
    6. function onKill(cid, target)
    7.      local monster = config[getCreatureName(target):lower()]
    8.      if isPlayer(target) or not monster or isSummon(target) then
    9.          return true
    10.      end
    11.  
    12.      if (getPlayerStorageValue(cid, monster.storage)+1) < monster.amount and getPlayerStorageValue(cid, monster.startstorage) >= monster.startvalue then
    13.          setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
    14.          doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Task message: '..(getPlayerStorageValue(cid, monster.storage)+1)..' of '..monster.amount..' '..getCreatureName(target)..'s killed.')
    15.      end
    16.      if (getPlayerStorageValue(cid, monster.storage)+1) == monster.amount then
    17.          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and completed the '..getCreatureName(target)..'s mission.')
    18.          setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
    19.      end
    20.      return true
    21. end
    when i'm trying to kill a monster that's what i found.
    [​IMG]
    and the monster being like this when i kill rotworm.
    [​IMG]
     
  18. Limos

    Limos Premium User

    Joined:
    Jun 7, 2010
    Messages:
    10,017
    Likes Received:
    2,927
    Best Answers:
    6
  19. StreamSide

    StreamSide Joseluis Gonzalez

    Joined:
    Aug 31, 2007
    Messages:
    2,748
    Likes Received:
    567
    Best Answers:
    8
    Code (Text):
    1. function isSummon(cid)
    2.         return (isCreature(cid) == TRUE and (getCreatureMaster(cid) ~= cid)) and TRUE or FALSE
    3.     end
     
    Activity likes this.
  20. Activity

    Activity Member

    Joined:
    Apr 7, 2016
    Messages:
    159
    Likes Received:
    22
    Best Answers:
    0

Share This Page

Loading...