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

MoveEvent Summon monster, walking on tile (features: interval & storageid)

frankfarmer

who'r ninja now
Premium User
Joined
Aug 5, 2008
Messages
1,579
Reaction score
79
Ok here it goes, please all pro's look at the script and see if there is something wrong. This is my first try to script ever. You have to change the "XXXX" in the script.

Code:
-- idea by frankfarmer/fragdonut and script by cykotitan
-- step on tile and summon monster

local t = {
	storage = 32000, --storageid
	interval = 60, --how many seconds until next
	monster = {"Demon", {x=100, y=100, z=7}}, -- monster and coords
	msg = "It's too quiet here..." -- message players get
}
function onStepIn(cid, item, position, fromPosition)
	if os.difftime(os.time(), getGlobalStorageValue(t.storage)) >= t.interval then       
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setGlobalStorageValue(t.storage, os.time())
	end
end

The script works as followed; Player walk in a dungeon, step on a tile, it sents a message in orange on the screen and at the same time it summons a demon at a specific location also added questvalue so that the player can only do this one time.

Edit: Script now has a delay function and if 4 players enters a dungeon then the first player stepping on the tile will get a message and it will summon a monster. The 3 other players will not do any summons/or text messages.. until delay is over.
 
Last edited:
Code:
local t = {
	storage = 32000,
	monster = {"Demon", {x=100, y=100, z=7}},
	msg = "It's too quiet here..."
}
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
You should always make your scripts configurable.

And try to use code tags instead of lua.
 
Code:
local t = {
	storage = 32000,
	monster = {"Demon", {x=100, y=100, z=7}},
	msg = "It's too quiet here..."
}
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

end
You should always make your scripts configurable.

And try to use code tags instead of lua.

Thanks alot, did not know about that
Code:
local t = {
	storage = 32000,
	monster = {"Demon", {x=100, y=100, z=7}},
	msg = "It's too quiet here..."
}
thing :)

Thanks! Edited main post
 
also there's no need to return anything in movements
 
Lua:
 if getPlayerStorageValue(cid, t.storage) ~= 1 then   

or

 if getPlayerStorageValue(cid, t.storage) == -1 then

i know it isnt necessary but its more pro
it means: if the storage for this player doesnt exist then...
 
nice
I'd love an version which could only be used each minute, like if I use this for a quest then all players would summon one monster and with an exhaust on it only one player would summon the monster
 
Lua:
if getPlayerStorageValue(cid, t.storage) ~= 1 then
should be like that, i know it isnt necessary but its more pro
it means: if the storage for this player doesnt exist then...
that would be less pro
you mean
Code:
return true
?
no, you don't need to return anything
nice
I'd love an version which could only be used each minute, like if I use this for a quest then all players would summon one monster and with an exhaust on it only one player would summon the monster
Code:
local t = {
	storage = 32000,
	interval = 60,
	monster = {"Demon", {x=100, y=100, z=7}},
	msg = "It's too quiet here..."
}
function onStepIn(cid, item, position, fromPosition)
	if os.difftime(os.time(), getGlobalStorageValue(t.storage)) >= t.interval then       
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setGlobalStorageValue(t.storage, os.time())
	end
end
 
Last edited:
@Cyber:
The prost is:
Code:
if(getPlayerStorageValue(cid, t.storage) == EMPTY_STORAGE) then
 
Back
Top