• 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!

[GOOD IDEA] NPC supplies, summon ?

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Hello.
Its possible to make spell for certain vocation, who summon NPC, and the npc dissapear after 2 minutes?
You can only summon NPC when you dont have fight,pz . You can summon only one NPC (if dissapear you can summon next, after exhaust),
Exhaust for spell is 10 minutes.
Only player caster can talking with his summon NPC.

Anyone can make it ?
TFS 0.3.6pl1

bump~
 
Last edited by a moderator:
Well here is the spell atleast the npc should be simple enough to make only thing you need to do is check if the "npcstorage value" is the same is the npc's cid (you have something like npccid as value dunno exactly what but know it's there) and then let it talk.
Code:
local duration = 120 -- in seconds the duration which the npc stays
local exhaust = 10000 -- cooldown storage value
local cooldown = 600 -- cooldown in seconds
local npcname = "...." -- name of npc being created
local npcstorage = 10001 -- to memorize the player which is gonna talk to the npc

local function removenpc(npc)
	doRemoveCreature(npc)
end

function onCastSpell(cid, var)
if exhaustion.get(cid,exhaust) == 0 then
	exhaustion.set(cid,exhaust,cooldown*1000)
	local npc = doCreateNpc(npcname,getCreaturePosition(cid))
	setPlayerStorageValue(cid,npcstorage,npc)
	addEvent(removenpc, duration*1000,npc)
end
return TRUE
end

Note: not 100% sure if the exhaust stuff works never used it before but should work this way.
Note2: if you want me to also make the npc just say so, tired now so won't make it now:P
PS: how can I make my code in a lua code block?
 
Well you can input the vocations and level in spells.xml example:
XML:
<instant name="Summon NPC" words="exevo npc" lvl="100" mana="100" prem="1" exhaustion="2000" selftarget="1" needlearn="0" event="script" value="Summon NPC.lua">
		<vocation id="5"/>//master sorcerer
		<vocation id="6"/>//elder druid
	</instant>
something like this should do

PS: thanks now I can post lua scripts in a normal lua block:P
 
Back
Top