Results 1 to 6 of 6

Thread: NPC action does nothing

  1. #1

    Join Date
    Oct 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5

    NPC action does nothing

    Hello,

    I was doing a test and found out it wont buy potions. it works with all other NPC's but somehow not with sigurd :<

    Here's my code:
    Code:
    local npc = findcreature('Sigurd') 
    
    if not npc then 
         gotolabel(wpt.id - 1)
    elseif npc.dist > 3 then 
         reachcreature(npc)
    end 
    
    say("hi")
    wait(300,450)
    end
    while (itemcount(285)+itemcount(284)+itemcount(283)) > 1 do
    npcsay("deposit all")
    wait(900,1350)
    npcsay("yes")
    wait(300,450)
    npcsay("trade")
    wait(900,1350)
    
    end
    
    buyitemsupto(nameMp,maxMp,itemcount(nameMp))
    wait(900,1350)
    buyitemsupto(nameHp,maxHp,itemcount(nameHp))
    wait(900,1350)
    
    end
    somehow it walks up to a WP then it reads the action but does nothing :/


    Kind regards,

  2. #2
    Normal User RafiXWPT's Avatar
    Join Date
    Jun 2012
    Location
    (Poland) http://rafixwptscripts.com
    Posts
    1,602
    Mentioned
    31 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    128 Post(s)
    Reputation
    128
    Rep Power
    9
    try:
    PHP Code:
    local npc findcreature('Sigurd'

    if 
    not npc then 
         gotolabel
    (wpt.id 1)
    elseif 
    npc.dist 3 then 
         reachcreature
    (npc)
    end 

    say
    ("hi")
    wait(300,450)
    while (
    itemcount(285)+itemcount(284)+itemcount(283)) > do
    npcsay("deposit all")
    wait(900,1350)
    npcsay("yes")
    end

    wait
    (300,450)
    npcsay("trade")
    wait(900,1350)

    buyitemsupto(nameMp,maxMp,itemcount(nameMp))
    wait(900,1350)
    buyitemsupto(nameHp,maxHp,itemcount(nameHp))
    wait(900,1350

  3. #3
    iBot User pink_panther's Avatar
    Join Date
    May 2012
    Location
    Australia
    Posts
    4,075
    Mentioned
    49 Post(s)
    Tagged
    1 Thread(s)
    Quoted
    178 Post(s)
    Reputation
    309
    Rep Power
    10
    Quote Originally Posted by Tanochi View Post
    Hello,

    I was doing a test and found out it wont buy potions. it works with all other NPC's but somehow not with sigurd :<

    Here's my code:
    Code:
    local npc = findcreature('Sigurd') 
    
    if not npc then 
         gotolabel(wpt.id - 1)
    elseif npc.dist > 3 then 
         reachcreature(npc)
    end 
    
    say("hi")
    wait(300,450)
    end
    while (itemcount(285)+itemcount(284)+itemcount(283)) > 1 do
    npcsay("deposit all")
    wait(900,1350)
    npcsay("yes")
    wait(300,450)
    npcsay("trade")
    wait(900,1350)
    
    end
    
    buyitemsupto(nameMp,maxMp,itemcount(nameMp))
    wait(900,1350)
    buyitemsupto(nameHp,maxHp,itemcount(nameHp))
    wait(900,1350)
    
    end
    somehow it walks up to a WP then it reads the action but does nothing :/


    Kind regards,
    You have an "end" after it says hi for no reason, and an end after buying items for no season.. jsut take them out. Also, your while function will keep saying Deposit all, yes, trade over n over again while you are carrying empty flasks.... you need to change that..

    Try this instead...


    PHP Code:
    local npc findcreature('Sigurd'

    if 
    not npc then 
         gotolabel
    (wpt.id 1)
    elseif 
    npc.dist 3 then 
         reachcreature
    (npc)
    end 

    say
    ("hi")
    wait(300,450)

    while (
    itemcount(285)+itemcount(284)+itemcount(283)) > do
    npcsay("vials")
    wait(900,1350)
    npcsay("yes")
    wait(300,450)
    end

    wait
    (900,1350)
    npcsay("trade")
    wait(900,1350)

    buyitemsupto(nameMp,maxMp,itemcount(nameMp))
    wait(900,1350)
    buyitemsupto(nameHp,maxHp,itemcount(nameHp))
    wait(900,1350

  4. #4

    Join Date
    Oct 2012
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    5
    Thanks for your help!

    I've had some time to test it again and it still doesnt work

    It manages to skip the first part, finding/reaching sigurd and because of that also doesn't say hi. Without the first part it does say hi but often isnt in range of Sigurd >.>
    I think it has something to do with Sigurd instead of the code since it works fine with all other NPCs

    Sigurd owns the potion shop in kaz and walks around alot in a big area. Can it be done?

    Kind regards,

  5. #5
    Normal User dragonicevo's Avatar
    Join Date
    May 2012
    Location
    canada
    Posts
    1,600
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    65
    Rep Power
    8
    look my thread for basic setup for knight scripts.
    try reach creature as well.
    also have a action to go back if you dont have pots cheers hope this helps.
    Last edited by dragonicevo; 11-03-2012 at 02:49 AM.
    http://www.tibiaibot.com/forum/showt...2925#post42925 for basic setup for knight

    If i helped or you liked my scripts rep + me

    trusted free scripts by pink_panther and 3173654 and acid alchamy and marlhex and spens13

  6. #6
    Normal User
    Join Date
    Feb 2013
    Posts
    17
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    4
    i'm having the same problem as the other guy with sigurd, and i tried this in my script and still nothing...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •