Results 1 to 3 of 3

Thread: Tutorial action travel()

  1. #1
    iBot User
    Join Date
    Feb 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    11
    Rep Power
    5

    Lightbulb Tutorial action travel()

    Sup BROS

    long time since my last post, but this is a great opportunity to show my action to travel between citys..


    so
    1 STEP: Open your SETUP and paste this script in anywhere(preference at the end):
    PHP Code:
    --ACTIONS AND VARIABLES
    function travel(city)
    if 
        
    maround('Captain Bluebear') > 0  
    then
        npc 
    'Captain Bluebear'
        
    elseif
        
    maround('Captain Greyhound') > 0  
        then
        npc 
    'Captain Greyhound'
            
    elseif
            
    maround('Captain Fearless') > 0  
            then
            npc 
    'Captain Fearless'
                
    elseif
                
    maround('Captain Seagull') > 0  
                then
                npc 
    'Captain Seagull'
                    
    elseif
                    
    maround('Captain Seagull') > 0  
                    then
                    npc 
    'Captain Seagull'
                        
    elseif
                        
    maround('Captain Breezelda') > 0  
                        then
                        npc 
    'Captain Breezelda'
                            
    elseif
                            
    maround('Captain Seahorse') > 0  
                            then
                            npc 
    'Captain Seahorse'
                                
    elseif
                                
    maround('Captain Sinbeard') > 0  
                                then
                                npc 
    'Captain Sinbeard'
                                    
    elseif
                                    
    maround('Karith') > 0  
                                    then
                                    npc 
    'Karith'
                                        
    elseif
                                        
    maround('Jack Fate') > 0  
                                        then
                                        npc 
    'Jack Fate'
                                            
    elseif
                                            
    maround('Chemar') > 0  
                                            then
                                            npc 
    'Chemar'
                                                
    elseif
                                                
    maround('Gewen') > 0  
                                                then
                                                npc 
    'Gewen'
                                                    
    elseif
                                                    
    maround('Iyad') > 0  
                                                    then
                                                    npc 
    'Iyad'
                                                        
    elseif
                                                        
    maround('Melian') > 0  
                                                        then
                                                        npc 
    'Melian'
                                                            
    elseif
                                                            
    maround('Pino') > 0  
                                                            then
                                                            npc 
    'Pino'
                                                                
    elseif
                                                                
    maround('Uzon') > 0  
                                                                then
                                                                npc 
    'Uzon'
    end
        reachcreature
    (npc)    
        
    say('hi')
        
    wait(500)
        
    npcsay(city)
        
    wait(500)
        
    npcsay('yes')
        
    wait(500)
    end 
    2 STEP: Create your action on waypoint list to travel:
    PHP Code:
    travel('yalahar') --- here you put the city 
    3 STEP: activate the waypoint and the scritp will reach the npc and travel where you want.



    IF YOU LIKE AND UNDERSTAD PLZ REP+
    Last edited by Shainy; 06-14-2013 at 01:01 AM.

  2. #2
    Normal User
    Join Date
    May 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    10
    Rep Power
    4
    Do not expel it would do with the library?

  3. #3
    Normal User xavizus's Avatar
    Join Date
    Jun 2013
    Location
    Japan
    Posts
    87
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    18
    Rep Power
    4
    Hi Shainy,

    As Rider_WPT said - it should be in the library instead
    Though You could make it much shorter - Programmers are lazy
    example:
    PHP Code:
    function travel(city)
    local NPCS = {"Captain Bluebear""Captain Greyhound"} -- And so on.

    for 
    _NPC in ipairs(NPCS) do
        if(
    maround(NPC) >0then
            REACHEDNPC 
    NPC
            
    break
        
    end
    end

    reachcreature
    (REACHEDNPC)    
    say('hi')
    wait(500)
    npcsay(city)
    wait(500)
    npcsay('yes')
    wait(500)
    end 
    Edit: Saw an error in the above script - Update

    PHP Code:
    function travel(city)
    local NPCS = {"Captain Bluebear""Captain Greyhound"} -- And so on.
    while(
    true)
    for 
    _NPC in ipairs(NPCS) do
        if(
    maround(NPC) >0then
            REACHEDNPC 
    NPC
            
    break
        
    end
    end
    end
    reachcreature
    (REACHEDNPC)    
    say('hi')
    wait(500)
    npcsay(city)
    wait(500)
    npcsay('yes')
    wait(500)
    end 
    Last edited by xavizus; 06-14-2013 at 10:18 AM.

Posting Permissions

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