  | 
     | 
      | 
   
  
     | 
    
        Xarin 
        Nowy
 
  
            Dołączył: 07 Lis 2006 
            Posty: 19 
            Przeczytał: 0 tematów
  Ostrzeżeń: 0/10 Skąd: Poland
        
         
        
     | 
     | 
   
  
      | 
     | 
      | 
   
  | 
    
      
         Wysłany: Śro 16:02, 08 Lis 2006    Temat postu: Heal NPC i Trening Monk | 
            | 
       
      
        
  | 
       
      
        
            
            Healing NPC
 
 
 
Kod:
 
 
focus = 0
 
talk_start = 0
 
target = 0
 
following = false
 
attacking = false
 
 
function onThingMove(creature, thing, oldpos, oldstackpos)
 
 
end
 
 
 
function onCreatureAppear(creature)
 
 
end
 
 
 
function onCreatureDisappear(cid, pos)
 
   if focus == cid then
 
          selfSay('Good bye then.')
 
          focus = 0
 
          talk_start = 0
 
   end
 
end
 
 
 
function onCreatureTurn(creature)
 
 
end
 
 
 
function msgcontains(txt, str)
 
   return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
 
end
 
 
 
function onCreatureSay(cid, type, msg)
 
   msg = string.lower(msg)
 
 
   if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
 
   selfSay('hello ' .. creatureGetName(cid) .. ' I am a monk sent by GM Nick to help all the citizens of Okara. If u need help just ask me.')
 
   focus = cid
 
   talk_start = os.clock()
 
 
   elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
 
   selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
 
 
elseif focus == cid then
 
talk_start = os.clock()
 
 
if msgcontains(msg, 'monk') then
 
                                          selfSay('Yes i am a monk.')
 
                           elseif msgcontains(msg, 'heal') then
 
                                          selfSay('Let me heal you so you will be ready for more adventures!')
 
                                          selfSay('exura sio "' .. creatureGetName(cid) .. '')
 
                           elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
 
selfSay('Goodbye young traveler.')
 
focus = 0
 
talk_start = 0
 
end
 
end
 
end
 
 
 
function onCreatureChangeOutfit(creature)
 
 
end
 
 
 
function onThink()
 
   if (os.clock() - talk_start) > 30 then
 
   if focus > 0 then
 
   selfSay('May Nick bless your adventures.')
 
   end
 
   focus = 0
 
   end
 
if focus ~= 0 then
 
if getDistanceToCreature(focus) > 5 then
 
selfSay('Be careful in your quests of Okara.')
 
focus = 0
 
end
 
end
 
end
 
 
 
>><<<
 
Trening Monk
 
 
Kod:
 
 
<?xml version="1.0"?>
 
<monster name="Trainer" level="20" maglevel="50" experience="200" pushable="0" armor="25" defense="30" canpushitems="1" staticattack="50" changetarget="238">
 
    <health now="100000" max="100000"/>
 
    <look type="57" head="20" body="30" legs="40" feet="50" corpse="3128"/>
 
    <combat targetdistance="1" runonhealth="0"/>
 
 
    <attacks>
 
        <attack type="melee" maxdamage="100"/>
 
        <attack type="instant" name="exura vita" exhaustion="10" cycleticks="100" probability="100"/>
 
    </attacks>
 
 
    <defenses>
 
        <defense immunity="invisible"/>
 
    </defenses>
 
 
    <voices>
 
    </voices>
 
 
    <loot>
 
    </loot>
 
</monster>
 
 
 
Pamiętajcie: zawsze nazwy potworów dodajcie do pliku montsers.xml.[color=darkred][/color]
            
  Post został pochwalony 0 razy
         | 
       
     
 |