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

Need Npc Task Monsters HELP ;)

stigma1991

New Member
Joined
Jan 14, 2010
Messages
21
Reaction score
0
Hi, i made OTS (8.50.ver)
IP: 89.72.44.206

and i need Npc with quests.

1.Mission ("kill 20 rotworms")
- Award (Exp 20000 + 1cc)
2.Mission ("kill 15 slimes")
- Award (Exp 30000 + 2cc)
...

I have engine Stigma3. ;]

Please help me.
 
Well this is just a quick whack at it to get it moving for you.
I haven't tested this but I thought I would just get you a base on getting this done.



add this to rotworms.xml after </flags>
Code:
<script>
	<event name="Rotworms"/>
</script>

data/creaturescripts/creaturescripts.xml
Code:
<event type="death" name="Rotworms" event="script" value="rotworm.lua"/>

/data/creaturescripts/scripts/rotworm.lua
Code:
local questcomplete = "" -- Storage Value to hold when the quest is complete
local storage = "" -- Storage Value to hold your creature kills
local kills = "20" -- How many kills to get reward
local experince = "1000" -- Experince to give
local reward = "" -- Reward item to give
local count = "" -- How many of item to give


function onDeath(cid, target, lastHit)
setPlayerStorageValue(uid, storage, +1)

local temp = getPlayerStorageValue(uid, storage)

if not (getPlayerStorageValue(uid, questcomplete)) = 1 then
	if temp > 20 then
		return true
	else if temp < 20 then
		doCreatureSay(cid, "You have killed " .. temp .. "rotworms out of " .. kills .. ".", TALKTYPE_ORANGE_1)
		if temp == 20 then
			setPlayerStorageValus (uid, questcomplete, 1)
			doCreatureSay(cid, "You have complted this quest.", TALKTYPE_ORANGE_1)
			doPlayerAddItem(uid, reward, count)
			doPlayerAddExp(cid, experince)
			return true
		end
		return true
	end
end
 
Warning: [Monster::Monster]. Unknown event name - Rotworms

I make all this ;]

Rotworm.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="rotworm" nameDescription="a rotworm" race="blood" experience="40" speed="165" manacost="0">
  <health now="65" max="65"/>
  <look type="26" head="20" body="30" legs="40" feet="50" corpse="5967"/>
  <targetchange interval="2000" chance="0"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag summonable="0"/>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag illusionable="0"/>
    <flag convinceable="1"/>
    <flag pushable="0"/>
    <flag canpushitems="0"/>
    <flag canpushcreatures="0"/>
    <flag targetdistance="1"/>
    <flag staticattack="90"/>
    <flag runonhealth="0"/>
  </flags>
  <script>
	<event name="Rotworms"/>
</script>
  <attacks>
    <attack name="melee" interval="2000" skill="12" attack="12"/>
  </attacks>
  <defenses armor="8" defense="11"/>
  <immunities/>
  <loot>
    <item id="2148" countmax="27" chance1="100000" chancemax="0"/>
    <item id="2480" chance="1500"/>
    <item id="2530" chance="2857"/>
    <item id="1987" chance="100000">
      <inside>
        <item id="2666" countmax="1" chance="20000"/>
		<item id="3976" countmax="5" chance1="50000" chancemax="0"/>
        <item id="2398" chance="3333"/>
        <item id="2671" countmax="2" chance1="20000" chancemax="0"/>
        <item id="2376" chance="10000"/>
        <item id="2412" chance="1000"/>
      </inside>
    </item>
  </loot>
</monster>

Creaturescripts.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
	<event type="login" name="PlayerLogin" script="login.lua"/>
	<event type="death" name="PlayerDeath" script="playerdeath.lua"/>
	<event type="kill" name="PlayerKill" script="kill.lua"/> 
	<event type="preparedeath" name="PlayerDeathPrepare" script="playerpreparedeath.lua"/> 
	<event type="preparedeath" name="Killed" script="reward.lua"/> 
	<event type="death" name="Rotworms" event="script" value="rotworm.lua"/>
</creaturescripts>

Rotworm.lua

Code:
local questcomplete = "" -- Storage Value to hold when the quest is complete
local storage = "" -- Storage Value to hold your creature kills
local kills = "20" -- How many kills to get reward
local experince = "1000" -- Experince to give
local reward = "" -- Reward item to give
local count = "" -- How many of item to give


function onDeath(cid, target, lastHit)
setPlayerStorageValue(uid, storage, +1)

local temp = getPlayerStorageValue(uid, storage)

if not (getPlayerStorageValue(uid, questcomplete)) = 1 then
	if temp > 20 then
		return true
	else if temp < 20 then
		doCreatureSay(cid, "You have killed " .. temp .. "rotworms out of " .. kills .. ".", TALKTYPE_ORANGE_1)
		if temp == 20 then
			setPlayerStorageValus (uid, questcomplete, 1)
			doCreatureSay(cid, "You have complted this quest.", TALKTYPE_ORANGE_1)
			doPlayerAddItem(uid, reward, count)
			doPlayerAddExp(cid, experince)
			return true
		end
		return true
	end
end

Or

Code:
local questcomplete = "10" -- Storage Value to hold when the quest is complete
local storage = "10" -- Storage Value to hold your creature kills
local kills = "20" -- How many kills to get reward
local experince = "1000" -- Experince to give
local reward = "2160" -- Reward item to give
local count = "1" -- How many of item to give


function onDeath(cid, target, lastHit)
setPlayerStorageValue(uid, storage, +1)

local temp = getPlayerStorageValue(uid, storage)

if not (getPlayerStorageValue(uid, questcomplete)) = 1 then
	if temp > 20 then
		return true
	else if temp < 20 then
		doCreatureSay(cid, "You have killed " .. temp .. "rotworms out of " .. kills .. ".", TALKTYPE_ORANGE_1)
		if temp == 20 then
			setPlayerStorageValus (uid, questcomplete, 1)
			doCreatureSay(cid, "You have complted this quest.", TALKTYPE_ORANGE_1)
			doPlayerAddItem(uid, reward, count)
			doPlayerAddExp(cid, experince)
			return true
		end
		return true
	end
end
So what is bad ? ;/
 
Last edited:
Code:
local cfg = {
	questComplete = 10, -- Storage Value to hold when the quest is complete
	storage = 10, -- Storage Value to hold your creature kills
	kills = 20, -- How many kills to get reward
	experience = 1000, -- experience to give
	reward = 2160, -- Reward item to give
	count = 1 -- How many of item to give
}
function onDeath(cid, target, lastHit)
	if getPlayerStorageValue(cid, config.questComplete) < 1 then
		local tmp = getPlayerStorageValue(cid, config.storage)
		if tmp < 20 then
			doCreatureSay(cid, "You have killed " .. tmp + 1 .. " rotworms out of " .. config.kills .. ".", TALKTYPE_ORANGE_1, false, cid, getCreaturePosition(cid))
			setPlayerStorageValue(cid, config.storage, tmp + 1)
			if getPlayerStorageValue(cid, config.storage) == 20 then
				setPlayerStorageValus (cid, config.questComplete, 1)
				doCreatureSay(cid, "You have complted this quest.", TALKTYPE_ORANGE_1, false, cid, getCreaturePosition(cid))
				doPlayerAddItem(cid, config.reward, config.count)
				doPlayerAddExp(cid, config.experience)
			end
		end
	end
	return true
end
 
I have good idea..

Meybe any1 can remake this scrip for me ?

No need door, but exp for monsters and going to next mission..
1 mission - 10 rotworms [ rewards - 10000 exp ]
2 mission - 20 slimes [ rewards - 20000 exp ]
;]

Go to data\creaturescripts\scripts and create a new file monsterkill.lua:
Code:
local monsters = {
	--name = storage
	["demon"] = 55667
}

function onKill(cid, target)
	local monster = monsters[getCreatureName(target):lower()]
	if(isPlayer(target) == FALSE and monster and getPlayerStorageValue(cid, 76669) == 2) then
		if getPlayerStorageValue(cid, monster) < 6666 then 
			local killedMonsters = getPlayerStorageValue(cid, monster)
            if(killedMonsters == -1) then
                killedMonsters = 1
			end
			setPlayerStorageValue(cid, monster, killedMonsters + 1)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed " .. killedMonsters .. " of 6666 demons.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have killed enough demons.")
			setPlayerStorageValue(cid, 76669, 3)
		end
	end
	return TRUE
end

And now open creaturescripts.xml and add:
Code:
<event type="kill" name="monsterkill" script="monsterkill.lua"/>

Now go to data\npcs and add a npc:
Code:
<?xml version="1.0"?>
<npc name="Piita Griffyn" script="quest.lua" access="3" lookdir="2" walkinterval="2000">
    <mana now="800" max="800"/>
    <health now="132" max="200"/>
<look type="151" head="115" body="76" legs="35" feet="117" addons="3" corpse="6080"/>
 <parameters>
  <parameter key="message_greet" value="Hi, can you help me? ask me for a {mission}. "/>
    </parameters>
</npc>

Now go to data\npcs\scripts and create a new file, called quest.lua and fill in this:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}
local quest = 76669
local reward = 70000
	
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

function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if(not npcHandler:isFocused(cid)) then
		return false
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		npcHandler:say("Need help... {ok}?.", cid)
		talkState[talkUser] = 2
	elseif msgcontains(msg, "ok") and talkState[talkUser] == 2 then
		npcHandler:say("Okay, fast please.", cid)
		setPlayerStorageValue(cid, quest, 2)
		talkState[talkUser] = 0
	elseif msgcontains(msg, "mission") then
		local str = getPlayerStorageValue(cid, quest)
		if(str < 2) then
			npcHandler:say("You have to kill 6666 demons for me, would you do it?", cid) 
			talkState[talkUser] = 1
			return true
		elseif(str == 2) then
			npcHandler:say("Please come back for a reward.", cid)
		elseif(str == 3) then
			npcHandler:say("You killed 6666 demons for me, here is your reward.", cid)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Now you can enter to the room.")
			setPlayerStorageValue(cid, quest, 4)
		elseif(str == 4) then
			npcHandler:say("You have done enough for me, I will soon plan our attack!", cid)
		end
		talkState[talkUser] = 0
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())



So need help please ;]
 
Back
Top