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

Russian roulet?

Donio

Banned User
Joined
Jun 24, 2008
Messages
4,004
Reaction score
16
Location
Manhattan, New York
Hey, I was thinking of making a even that looks like russian rulett xD

Here is how it goes:

You are around a table with about 5 people.. You have a rune.. the 5 players has to take turn to klick the rune on them selfs and see if it "goes off".. When it does the player dies instantly..

But it has be a random "boom"(?)

I know the expenation was a bit off.. But its the best I can do, I got all the ideas in my head but the scripting part not so much.. All I need here is a script on a rune that works randomly after a few "klicks" it has to take like 15k dmg so a player can actually die on 1 hit :).. Also, the rune has to dissapear after the game is done. Else a player can take it and go kill everyone xD
 
Try this for rune
data/actions/actions.xml
XML:
<action itemid="xxxx" event="script" value="death rune.lua"/>

data/actions/scripts/death rune.lua

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(math.random(1, 10) == 1) then   -------- To make it so it doesnt goes to 1 always, put more diff in the nrs.
		doSendMagicEffect(fromPosition, 36)
		doCreatureAddHealth(cid, -15000)
        doSendAnimatedText(fromPosition,"BOOM!",math.random(1,60))
		doRemoveItem(item.uid,1)
	else
		doSendMagicEffect(fromPosition, CONST_ME_POOF)
		doSendAnimatedText(fromPosition,"Safe",TALKTYPE_ORANGE)
	end
	return true
end

I think it should work, try it anyway
 
Actually no, that could be a uid/aid script and u could use that little sparkle as the action item...place the sparkle over the sd in your map, and bam, no one can take the 'sd'
 
Actually no, that could be a uid/aid script and u could use that little sparkle as the action item...place the sparkle over the sd in your map, and bam, no one can take the 'sd'

This is a good idea actually.
@Up: From what I understand you are tryin to make an event where the last one alive stays right?
So then do what Iblue said, put those sparkles and make an event so people gets tped to their respectives positions(in front of the 'SD' with sparkles) and touch them, then the last one wud win right?
 
I will do that, With the sparkels, But to be honset im not at all good with scripting etc.. So I lets see if I got this right:

I put a rune on a table.. then a sparkle over the rune.. Then I add uid on the sparkle? or aid?

IF so I could use any number that isnt already used?... Then I need a action script also? xD
 
lol
Here a litle game about life and dead :D.

Map something like this ...
jh6jo1.jpg


Then paste script,
data/actions/scripts/roulette.lua
LUA:
--[[
--[[
	Russian Roulette
	by Maxi (Shawak)

]]--
	local positions = {
		{x = 1116, y = 1148, z = 7, stackpos = 253},
		{x = 1118, y = 1150, z = 7, stackpos = 253},
		{x = 1116, y = 1152, z = 7, stackpos = 253},
		{x = 1114, y = 1150, z = 7, stackpos = 253}
	}

local fight = createConditionObject(CONDITION_INFIGHT,24*60*60*1000)
function onUse(cid, item, frompos, item2, topos)

	local cfg = { active = 9995, speed = 200, addSpeed = 100, maxSpeed = 1100 }

	local cfg, active, speed, addSpeed, maxSpeed, player, ded_player_pos = cfg, cfg.active, cfg.speed, cfg.addSpeed, cfg.maxSpeed, {0, 0, 0, 0}, {}

	local player1 = getThingfromPos(positions[1])
	local player2 = getThingfromPos(positions[2])
	local player3 = getThingfromPos(positions[3])
	local player4 = getThingfromPos(positions[4])

	if getGlobalStorageValue(active) == 0 or getGlobalStorageValue(active) == -1 then
		if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
			-- if getPlayerGroupId(player1) == 1 and getPlayerGroupId(player2) == 1 and getPlayerGroupId(player3) == 1 and getPlayerGroupId(player4) == 1 and isPlayer(player1) == TRUE and isPlayer(player2) == TRUE and isPlayer(player3) == TRUE and isPlayer(player4) == TRUE then
				setGlobalStorageValue(active, 1)
				for i = 1 ,4 do
					player[i] = getThingfromPos(positions[i])
					doAddCondition(player[i].uid, fight)
					doCreatureSetNoMove(player[i].uid, 1)
				end
				doSendAnimatedText(frompos,"~~GO!~~",180)
				addEvent(system,100,{cfg = cfg, player1 = player1, player2 = player2, player3 = player3, player4 = player4, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
			-- else
			-- 	doPlayerSendTextMessage(cid,18,"This game works only with players.")
			-- end
		else
			doPlayerSendTextMessage(cid,18,"You need 4 players.")
		end
	else
		doPlayerSendTextMessage(cid,18,"The game is already been running.")
	end
	return TRUE
end

function system(parameters)
	local cfg, player1, player2, player3, player4, positions, active, speed, addSpeed, maxSpeed, ded_player_pos  = parameters.cfg, parameters.player1, parameters.player2, parameters.player3, parameters.player4, parameters.positions, parameters.active, parameters.speed, parameters.addSpeed, parameters.maxSpeed, parameters.ded_player_pos

	if speed < maxSpeed then
		addEvent(effect1,100,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	elseif speed >= maxSpeed then
		local player = {0, 0, 0, 0}
		local ded_player = getThingfromPos(ded_player_pos)
		doSendAnimatedText(ded_player_pos,"~~PENG~~",180)
		doCreatureAddHealth(ded_player.uid,-getCreatureHealth(ded_player.uid))
		for i = 1 ,4 do
			player[i] = getThingfromPos(positions[i])
			if player[i].itemid > 0 then
				doCreatureSetNoMove(player[i].uid, 0)
				doRemoveCondition(player[i].uid, CONDITION_INFIGHT)
			end
		end
		speed = cfg.speed
		addSpeed = cfg.addSpeed
		setGlobalStorageValue(active,0)
	end
	return TRUE
end

function effect1(parameters)
	local cfg, positions, active, speed, addSpeed, maxSpeed, ded_player_pos  = parameters.cfg, parameters.positions, parameters.active, parameters.speed, parameters.addSpeed, parameters.maxSpeed, parameters.ded_player_pos

	if speed < maxSpeed then
		if math.random(1,25) <= 5 then
			speed = speed+addSpeed
		end
		doSendMagicEffect(positions[1],39)
		ded_player_pos = positions[1]
		addEvent(effect2,speed,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	else
		addEvent(system,100,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	end
	return TRUE
end

function effect2(parameters)
	local cfg, positions, active, speed, addSpeed, maxSpeed, ded_player_pos  = parameters.cfg, parameters.positions, parameters.active, parameters.speed, parameters.addSpeed, parameters.maxSpeed, parameters.ded_player_pos

	if speed < maxSpeed then
		if math.random(1,25) <= 5 then
			speed = speed+addSpeed
		end
		doSendMagicEffect(positions[2],39)
		ded_player_pos =  positions[2]
		addEvent(effect3,speed,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	else
		addEvent(system,100,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	end
	return TRUE
end

function effect3(parameters)
	local cfg, positions, active, speed, addSpeed, maxSpeed, ded_player_pos  = parameters.cfg, parameters.positions, parameters.active, parameters.speed, parameters.addSpeed, parameters.maxSpeed, parameters.ded_player_pos

	if speed < maxSpeed then
		if math.random(1,25) <= 5 then
			speed = speed+addSpeed
		end
		doSendMagicEffect(positions[3],39)
		ded_player_pos =  positions[3]
		addEvent(effect4,speed,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	else
		addEvent(system,100,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	end
	return TRUE
end

function effect4(parameters)
	local cfg, positions, active, speed, addSpeed, maxSpeed, ded_player_pos  = parameters.cfg, parameters.positions, parameters.active, parameters.speed, parameters.addSpeed, parameters.maxSpeed, parameters.ded_player_pos

	if speed < maxSpeed then
		if math.random(1,25) <= 5 then
			speed = speed+addSpeed
		end
		doSendMagicEffect(positions[4],39)
		ded_player_pos =  positions[4]
		addEvent(effect1,speed,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	else
		addEvent(system,100,{cfg = cfg, positions = positions, active = active, speed = speed, addSpeed = addSpeed, maxSpeed = maxSpeed, ded_player_pos = ded_player_pos})
	end
	return TRUE
end

Then go to,
data/actions/actions.xml

HTML:
	<action actionid="8888" event="script" value="roulette.lua"/>

After that, give the items in the midle of the 4 Positions (set them in roulette.lua) the actionID 8888.

WARNING:


If you have any error with playerdeath.lua, use this one.

LUA:
local config = {
	deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
	sqlType = getConfigInfo('sqlType'),
	maxDeathRecords = getConfigInfo('maxDeathRecords')
}

config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
	if(config.deathListEnabled ~= TRUE) then
		return
	end

	local hitKillerName = "field item"
	local damageKillerName = ""
	if(lastHitKiller ~= FALSE) then
		if(isPlayer(lastHitKiller) == TRUE) then
			hitKillerName = getPlayerGUID(lastHitKiller)
		elseif(isMonster(lastHitKiller) == TRUE) then
			hitKillerName = getCreatureName(lastHitKiller)
		end

		if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
			if(isPlayer(mostDamageKiller) == TRUE) then
				damageKillerName = getPlayerGUID(mostDamageKiller)
			elseif(isMonster(mostDamageKiller) == TRUE) then
				damageKillerName = getCreatureName(mostDamageKiller)
			end
		end
	end

	db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
	local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
	if(rows:getID() ~= -1) then
		local amount = rows:getRows(true) - config.maxDeathRecords
		if(amount > 0) then
			if(config.sqlType == DATABASE_ENGINE_SQLITE) then
				for i = 1, amount do
					db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
				end
			else
				db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
			end
		end
	end
end

It's for TFS 0.3.4.
I hope you like it :thumbup:.

Regards,
Shawak
 
Back
Top