• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Requesting teleport broadcast(onStepin) and monster summon lever

Frillinde

Founder: Another Realm
Joined
Jan 16, 2012
Messages
148
Reaction score
3
Location
his computer
Using Crying Damson 0.3.6pl1


Im looking for a script onStepin that will broadcast a message to the whole server "Someone entered the room!"
I thought this was just onStepin and doBroadcast but it didnt work the way I wrote it ;p

Im also looking for another script which has a lever that will remove 2 bridge tiles and summon 7 monsters .When monsters are dead all players in in room are teleported to new area and bridge be replaced.The lever should be 1945 normally,1946 when used and stays 1946 untill player get tp then resets to 1945. If all players die then monsters despawn and lever resets.

room 150,150,15 to 175,175,15
tp to 225,150,14
bridge tiles 170,176,15 and 170,177,15

Any help with this would be great,the first 1 should be easy(why did I get it wrong?) but the 2nd one not so much
:)
 
Last edited:
LUA:
 local aid = XXX -- set for tile actionid
local storage = XXX -- set for storage set
local timer = XXX -- set for time between being able to step on tile for broadcast

function onStepIn(cid, item, pos)
         
         if getCreatureStorage(cid, storage) > os.time() then
            return false
         end
         
         if isPlayer(cid) == 1 then
         if item.actionid == aid then
            doBroadcastMessage("Someone has walked into the room!")
            doCreatureSetStorage(cid, storage, os.time() + timer)
         end
end
return true
end
just add in your movements.xml :
LUA:
 	<movevent type="StepIn" actionid="" event="script" value="broadcast.lua"/>
and replace the action id with whatever u decide in the script aswell. then in mapeditor, set action id
 
ok Im tryin my hand at the second script :)
Im learning so if its not right PLEASE show me what to improve.

rough outline-
onUse lever 1945 to 1946
remove bridge
summon 7 monsters
check if monsters dead = yes
give xp
do teleport
do broadcast bla bla bla
replace bridge
lever1946 to 1945
check if players in room = no
do remove monsters
replace bridge
lever 1946 to 1945

And my attempt :)


LUA:
local tile1pos = {x=2675, y=1926, z=0, stackpos=0}
local tile2pos = {x=2676, y=1926, z=0, stackpos=0}
local tile3pos = {x=2675, y=1927, z=0, stackpos=0}
local tile4pos = {x=2676, y=1927, z=0, stackpos=0}
local lever1pos = {x=2676, y=1907, z=0, stackpos=1}
local position = {x=2688, y=1888, z=0 to x=2698, y=1924, z=0}
 
 
function onUse(cid, item, frompos, item2, topos)
 	for i = position.fromx, position.tox do
		for j = position.fromy, position.toy do
			local pos = {x = i, y = j, z = position.z, stackpos = 253}
			local getThing = getThingfromPos(pos).uid
local tile1 = getThingfromPos(tile1pos)
local tile2 = getThingfromPos(tile2pos)
local tile3 = getThingfromPos(tile3pos)
local tile4 = getThingfromPos(tile4pos)
local lever1 = getThingfromPos(lever1pos)
if (item.itemid == 1945 and tile1.itemid == 1284 and tile2.itemid == 1284 and tile3.itemid == 1284 and tile4.itemid == 1284) then
 
doTransformItem(tile1.uid,598)
doTransformItem(tile2.uid,598)
doTransformItem(tile3.uid,598)
doTransformItem(tile4.uid,598)
doCreateMonster("Demon",{x=2671,y=1907,z=0})
doCreateMonster("Hellhound",{x=2676,y=1902,z=0})
doCreateMonster("Demon",{x=2677,y=1912,z=0})
doCreateMonster("Juggernaut",{x=2683,y=1912,z=0})
doCreateMonster("Demon",{x=2687,y=1905,z=0})
doCreateMonster("Hellhound",{x=2688,y=1914,z=0})
doCreateMonster("Hellhound",{x=1685,y=1898,z=0})
doTransformItem(lever1.uid,1946)
 
elseif (item.itemid == 1946 and tile1.itemid == 598 and tile2.itemid == 598 and tile3.itemid == 598 and tile4.itemid == 598 and if isPlayer(getThing) == 1 and if getCreatureByName(Demon)(getThing) == 0 and if getCreatureByName(Juggernaut)(getThing) == 0 and if getCreatureByName(Hellhound)(getThing) == 0 then
 
doPlayerAddExperience(cid, 200000)
doBroadcastMessage("A mortal soul has entered the Abyss!")
doRelocate(pos, toPos[, creatures = true])    <-------this is whole room tp?or open tp?
doTransformItem(tile1.uid,1284)
doTransformItem(tile2.uid,1284)
doTransformItem(tile3.uid,1284)
doTransformItem(tile4.uid,1284)
doTransformItem(lever1.uid,1945)
 
elseif (item.itemid == 1946 and tile1.itemid == 598 and tile2.itemid == 598 and tile3.itemid == 598 and tile4.itemid == 598 and if isPlayer(getThing) == 0 then
doRemoveCreature(cid[, executeLogout = true]) <------do I need  7 of these?
doTransformItem(tile1.uid,1284)
doTransformItem(tile2.uid,1284)
doTransformItem(tile3.uid,1284)
doTransformItem(tile4.uid,1284)
doTransformItem(lever1.uid,1945)
 
else 
doPlayerSendCancel(cid,"Sorry, not possible.") 
end 
return 1
end



I dont know how to do the player and monster checks..... use getArea and isInArea? use storages?not sure how to do this as Im lookin thru as many codes as I can for ideas.
I know its not complete but Im trying to get it there :)
Thanks for any help
 
Last edited:
I need to add breaks and ends still but am also still stuck on the removeCreature part.I forgot I also am wondering about the teleport....do I do all players in room or just create a 30 second portal.
My code is a mess but any help is appreciated.
:)
 
Im thinking Ill just put a permanent teleporter in and just put a magic wall over it and remove the wall for 30 seconds when players defeat the summons.That means a few more changes to code but should be easier for me that way.
This is my last big script to get to work to release this server, a 96MB custom map that Ive put a few thousand hours into mapping with alot of original content.I got the hosting service,beta testing has gone well but Im just frustrated since Im so close and my lua skills(I wouldnt really call them skills, lol) are not good enough to help me finish.
Im hoping someone can step up and help me out or offer suggestions at least to get this script going.I can of course offer rep and can give server perks( if wanted) to those helping.
Again thanks for any help offered.
 
Back
Top