• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help with Actions/script and Npc's

2sexy

New Member
Joined
Nov 25, 2007
Messages
18
Reaction score
0
Hello everybody well iv been working on my server for a very long time, and for some reason i decided to work with TFS as i changed servers allot cuz not every one was good neither working!
Well now i have worked on this TFS some time and some succes and some not ofc ;) thats life.

My Problems! Really need to fix this!

First Problem
Well i have this problem when im trying to Put my Actions from another server to TFS, well its loading good and all but when playing on the server nothing works, seems like its not working togheter with the server. Well its from a 7.92 server can be the reason, Its Poi,annih etc you know, My Question here is how can i put all this scripts in Actions in TFS with the result that they will Work. As i think many has done this before or either the poi will not work.

Second Problem!

Fixed! thanks for helping


Yeah that was all for now,if u need more information just tell me. they are the only big problems i gott with my server atm. Would be great if YOU out there would like to help me. Feel free to write fokes.

Thanks in advance!
 
Last edited:
It is true that the guild master will not work for the forgotten server, but that's just because you don't need one, it has a built-in guild system, just say !createguild to make a guild and then you will see at the MOTD in the guild channel what you will be able to write later, also, please post your scripts so that people can take a look at them and fix them.
 
@Empty: Thank u for the reply. Oh i see in commands! why dident i see that comming ;) thanks. Yeah allright ill post the npc's witch are not working!

First Npc's whos not working is!
Addoner:

SCRIPT!
PHP:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local 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 sell the first addon for 250k and the second addon for 500k.')
  		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, 'first addon') then
			selfSay('Do you want to buy the first addon for 250k?')
			talk_state = 1

		elseif msgcontains(msg, 'second addon') then
			selfSay('Do you want to buy the second addon for 500k?')
			talk_state = 2	
		
		elseif talk_state == 1 then
			if msgcontains(msg, 'yes') then
				if pay(cid,250000) then
					addon(cid, 1)
				else
					selfSay('Sorry, you don\'t have enough money.')
				end
 			end
			talk_state = 0

		elseif talk_state == 2 then
			if msgcontains(msg, 'yes') then
				if pay(cid,500000) then
					addon(cid, 2)
				else
					selfSay('Sorry, you don\'t have enough money.')
				end
 			end
			talk_state = 0
			
		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
	end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
	doNpcSetCreatureFocus(focus)
	if (os.clock() - talk_start) > 30 then
  		if focus > 0 then
  			selfSay('Next Please...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Good bye then.')
 			focus = 0
 		end
 	end
end


The Next npc!
Runemaker:

SCRIPT!
PHP:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local 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)
  	local msg = string.lower(msg)

  	if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
  		selfSay('Hello ' .. creatureGetName(cid) .. '! I sell runes, wands, rods, and whole bps with runes.')
  		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, 'runes') then
			selfSay('I sell hmms (100gps), uhs (150gps), gfbs (100gps), explosions (225gps), sds (300gps), blank runes (10gps).')
		elseif msgcontains(msg, 'wands') then
			selfSay('I sell wand of inferno (5k), plague (1k), cosmic energy (3k), vortex (Free) and dragonbreath (100gp).')
		elseif msgcontains(msg, 'rods') then
			selfSay('I sell quagmire (3k), snakebite (Free), tempest (5k), volcanic (1k) and moonlight rod (100gp).')

		elseif msgcontains(msg, 'inferno') then
			buy(cid,2187,getCount(msg),5000)
		elseif msgcontains(msg, 'plague') then
			buy(cid,2188,getCount(msg),1000)
		elseif msgcontains(msg, 'cosmic energy') then
			buy(cid,2189,getCount(msg),3000)
		elseif msgcontains(msg, 'vortex') then
			buy(cid,2190,getCount(msg),100)
		elseif msgcontains(msg, 'dragonbreath') then
			buy(cid,2191,getCount(msg),100)

		elseif msgcontains(msg, 'quagmire') then
			buy(cid,2181,getCount(msg),3000)
		elseif msgcontains(msg, 'snakebite') then
			buy(cid,2182,getCount(msg),100)
		elseif msgcontains(msg, 'tempest') then
			buy(cid,2183,getCount(msg),5000)
		elseif msgcontains(msg, 'volcanic') then
			buy(cid,2185,getCount(msg),1000)
		elseif msgcontains(msg, 'moonlight') then
			buy(cid,2186,getCount(msg),100)

		elseif msgcontains(msg, 'bp sds') then
			buyContainer(cid,2003,2268,2,3000)
			
                elseif msgcontains(msg, 'bp hmms') then
			buyContainer(cid,2001,2311,5,1000)			
                
                elseif msgcontains(msg, 'bp manafluids') then
			buyContainer(cid,3940,2006,7,1000)                
                
                elseif msgcontains(msg, 'bp uhs') then
			buyContainer(cid,2002,2273,2,2000)		
 		
                elseif msgcontains(msg, 'bp gfbs') then
			buyContainer(cid,2000,2304,3,2000)               
		
                elseif msgcontains(msg, 'bp explosions') then
			buyContainer(cid,2001,2313,4,2500)                
 		
                elseif msgcontains(msg, 'bp blank') then
			buyContainer(cid,1988,2260,1,200)
		
		elseif msgcontains(msg, 'bp magic walls') then
			buyContainer(cid,1999,2293,4,4000)
		
		elseif msgcontains(msg, 'bp fire bombs') then
			buyContainer(cid,2000,2305,3,2000)
	
		elseif msgcontains(msg, 'bp destroy fields') then
			buyContainer(cid,2003,2261,3,1000)               
                

		elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			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('Next Please...')
  		end
		
		focus = 0
  	end
	
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Good bye then.')
 			focus = 0
 		end
 	end
	
end


There u have the two npc witch are not working!

@The problem with the Action/scripts is still not solved, if u know what to do, please give a reply!

Thanks!
 
lol, I remember me copying the very same npc scripts from evolutions to tfs. The problem is that almost every function used in them are not valid for tfs. I had to rebuild them all by looking at these functions: http://otland.net/showthread.php?t=1244&highlight=functions

Look, for example, that CreatureGetName(cid) now is getCreatureName(cid), and so on...

I fear you will have to convert some functions...
 
Aight, I've taken some time to remake the runemaker into Jiddo's NPC system, I haven't tested it yet, but it should work. Here it is:

runes.xml
Code:
<npc name="Mike" script="data/npc/scripts/runes.lua" autowalk="1" floorchange="0" access="5" level="1" maglevel="1">
    <health now="150" max="150"/>
    <look type="130" head="39" body="122" legs="125" feet="57" corpse="2212"/>
    <parameters>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. Would you like to buy runes, wands or rods?" />
        <parameter key="message_needmoremoney" value="You do not have enough money." />
        <parameter key="message_decline" value="Is |TOTALCOST| gold coins too much for you? Get out of here!" />
        <parameter key="keywords" value="offer;runes;wands;rods" />
        
        <parameter key="keyword_reply1" value="I can sell you runes, wands and rods." />
        <parameter key="keyword_reply2" value="I sell hmms (100gps), uhs (150gps), gfbs (100gps), explosions (225gps), sds (300gps), blank runes (10gps)." />
        <parameter key="keyword_reply3" value="I sell wand of inferno (5k), plague (1k), cosmic energy (3k), vortex (10) and dragonbreath (100gp)." />
        <parameter key="keyword_reply4" value="I sell quagmire (3k), snakebite (Free), tempest (5k), volcanic (1k) and moonlight rod (100gp)." />
    </parameters>
</npc>
runes.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)



-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addBuyableItem({'wand of inferno', 'inferno'},                 2187, 5000,     'Wand of Inferno')
shopModule:addBuyableItem({'plague wand', 'plague'},                     2188, 1000,      'Plague wand')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'},     2189, 3000,     'wand of cosmic energy')
shopModule:addBuyableItem({'wand of vortex', 'vortex'},                 2190, 10,         'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'},     2191, 100,         'wand of dragonbreath')

shopModule:addBuyableItem({'quagmire rod', 'quagmire'},                 2181, 3000,     'quagmire rod')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'},                 2182, 100,        'snakebite rod')
shopModule:addBuyableItem({'tempest rod', 'tempest'},                     2183, 5000,     'tempest rod')
shopModule:addBuyableItem({'volcanic rod', 'volcanic'},                 2185, 1000,     'volcanic rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'},                 2186, 100,         'moonlight rod')

shopModule:addBuyableItem({'sudden death', 'sd'},                         2268, 300,     1,     'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'},                             2260, 10,         'blank rune')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'},                 2311, 100,     10,    'heavy magic missile rune')
shopModule:addBuyableItem({'explo', 'explosion'},                         2313, 225,     6,     'explosion rune')
shopModule:addBuyableItem({'great fireball', 'gfb'},                     2304, 100,     4,     'great fireball rune')

npcHandler:addModule(FocusModule:new())

But since I don't know how the addon NPC works, I didn't make that. Hope this helps you!
 
Last edited:
@SaLeM: Yeah i see, exacly what i tought to, that there are two diffrent systems. thats whats making it difficult :D damn that looks like MUCH WORK. well thank you for your reply.

@Empty: Thank you once again for the help. and i appreciate that you took your time to help me. I tested that npc and it works GREAT ;) thank u.


Thread is not Closed yet one problem not fixed!

First Problem
Well i have this problem when im trying to Put my Actions from another server to TFS, well its loading good and all but when playing on the server nothing works, seems like its not working togheter with the server. Well its from a 7.92 server can be the reason, Its Poi,annih etc you know, My Question here is how can i put all this scripts in Actions in TFS with the result that they will Work. As i think many has done this before or either the poi will not work.


This problem is Left! Thanks for helping with the other problem! But gott this left, and as i think this is one of the biggest problem i need to solve! HELP ;)

thanks!
 
@Jonern: Yeap that was what i tought. Thats the tricky part,
as i am not a good scripter myself. and dont really know, what functions i must change and stuff ;)

Well hmmm, dunno what im going to do :O) im stuck ;D
 
Back
Top Bottom