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

Lua [Movement] Bazir.lua

Sweddy

Well-Known Member
Joined
Feb 14, 2009
Messages
2,907
Reaction score
93
Location
Sweden
How to make this so just one monster at a time can be spawned and not any more spawn until its killed...

Im using TFS 0.3.6

Lua:
local t = {
	storage = 32001,
	monster = {"Bazir", {x=1006, y=1176, z=6}},
	msg = "Bazir has been summoned from hell, kill him before it's to late!"
}
function onStepIn(cid, item, position, fromPosition)
	if getPlayerStorageValue(cid, t.storage) < 1 then       
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setPlayerStorageValue(cid, t.storage, 1)
	end
	return TRUE
end
 
Lua:
local t = {
    global = 2345,
    storage = 32001,
    monster = {'Bazir', {x=1006, y=1176, z=6}},
    msg = 'Bazir has been summoned from hell, kill him before it\'s too late!'
}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if getStorage(t.global) < 1 and isPlayer(cid) and getPlayerStorageValue(cid, t.storage) < 1 then       
        doSetStorage(t.global, 1)
        doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
        doSummonCreature(t.monster[1], t.monster[2])
        setPlayerStorageValue(cid, t.storage, 1)
    end
    return true
end

XML:
<event type="death" name="bazir" event="script" value="bazir.lua"/>
creaturescripts/scripts/bazir.lua
Lua:
local global = 2345

function onDeath(cid, corpse, deathList)
    doSetStorage(global, 0)
    return true
end
at the .xml file of your monster, before </monster> add:
XML:
    <script>
        <event name="bazir"/> 
    </script>

globalevents/scripts/start.lua, add before return true:
Lua:
doSetStorage(2345, 0)
 
if getCreatureByName("Bazir")==LUA_ERROR(i guess?) then
summon him
end?
but you should make it impossible to create player with name bazir
or perform area check
 
try this.
Lua:
local s,m = 32001,{'bazir',{x=1006, y=1176, z=6}} --storage,pos
function onStepIn(cid,item,position,fromPosition)
	if getGlobalStorageValue(s) ~= 1 then
		doCreatureSay(cid,"Bazir has been summoned from hell, kill him before it's to late!",TALKTYPE_ORANGE_1)
		doCreateMonster(m[1]:lower(),m[2])
		setGlobalStorageValue(s,1)
	else
		doPlayerSendCancel(cid,'Boss is already being fought, try again later.')
	end
	return true
end
 
Back
Top