• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent Random summon stepin on a floor

Rufo

New Member
Joined
Jan 9, 2008
Messages
251
Reaction score
1
This script uses a floor of only one ID, example one on the rawr palette, as the player walk on the floor, on the pos you would like, a random monster, configured on the script, will be summoned.

Change the "X" for the pos you want the monsters summons, and the monsters you would like to summon
save in data/movements/scripts/rndsummon.lua
Lua:
--- 100% by rufo
-- Config
Summonpos = {x="XXXX", y="XXXX", z="X"} -- Pos where the monsters should summon
summon1 = Hunter -- Name of a monster
summon2 = Bandit -- Name of a monster
summon3 = Wild Warrior -- Name of a monster
summon =  Smuggler -- Name of a monster
-- End config

function onStepIn(cid, item, position, fromPosition)
    if isPlayer(cid) == TRUE and math.random(1, 26) == 1 then
        doSummonCreature("summon", Summonpos)

	elseif isPlayer(cid) == TRUE and math.random(1, 26) == 2 then
        doSummonCreature("summon1", Summonpos)

	elseif isPlayer(cid) == TRUE and math.random(1, 26) == 3 then
        doSummonCreature("summon2", Summonpos)

	elseif isPlayer(cid) == TRUE and math.random(1, 26) == 3 then
        doSummonCreature("summon3", Summonpos)
    end
    return TRUE
end

on movements.xml
Code:
    <movevent type="StepIn" itemid="XXXX" event="script" value="rndsummon.lua"/>
replace the "X" for the itemid you would like, i recommend itemid 8708(EXAMPLE).

Waiting for your comments and rates, 100% by me :)
 
and
Code:
"summon1"
:confused: I am not sure if it's work.

Fixed, easier to config:
Lua:
-- Config -------------

Summonpos = {  -- Pos where the monsters should summon
	x=XXXX, 
	y=yyy, 
	z=z,
}
monsters = {

	"Rat",
	"Wild Warrior",
	"orc berserker",


-- End config ---------
}
function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) == TRUE
		doSummonCreature(monsters[math.random(1, #monsters)], Summonpos)
	end
	return TRUE
end

Regards,
Shawak
 
works for you? ahhahaha

summon1 = Hunter -- Name of a monster
summon2 = Bandit -- Name of a monster
summon3 = Wild Warrior -- Name of a monster
summon = Smuggler -- Name of a monster

names is strings! Wild is ok, and Warrior make's bug. ; )
 
THats because i dont use global values xD, i put them on the summon function
 
you used global veriables please. if not must be local before veriable.
example:
local summon1

why you use elseif?
elseif and next random = new value of random nice. are you nice!!!
 
Im not amaster scripter, this is my 2nd script i release, so why should i worry about it?
 
and
Code:
"summon1"
:confused: I am not sure if it's work.

Fixed, easier to config:
Lua:
-- Config -------------

Summonpos = {  -- Pos where the monsters should summon
	x=XXXX, 
	y=yyy, 
	z=z,
}
monsters = {

	"Rat",
	"Wild Warrior",
	"orc berserker",


-- End config ---------
}
function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) == TRUE
		doSummonCreature(monsters[math.random(1, #monsters)], Summonpos)
	end
	return TRUE
end

Regards,
Shawak

You forgot a 'then'.
PHP:
-- Config -------------

Summonpos = {  -- Pos where the monsters should summon
        x=997,
        y=934,
        z=7,
}
monsters = {

        "Rat",
        "Wild Warrior",
        "Demon",


-- End config ---------
}
function onStepIn(cid, item, position, fromPosition)
        if isPlayer(cid) == TRUE
			then   doSummonCreature(monsters[math.random(1, #monsters)], Summonpos)
        end
        return TRUE
end
 
Back
Top