local storage = 8727
local lightLevel = 8 -- 1-10 (could be very wrong :p)
local lightTicks = 500 -- set how long each light should stay on for, leave as it is if you dont know
local moneyChance = 10 -- set a value and it will look like this: (1 in 10) for example, if you set 20 then it will be (1 in 20) chance
local rewardType = 1 -- set to 1 for gold, 2 for platinum, or 3 for crystal NOTE: not recommended to set crystal coins, you can set to some other differnent coin like token and trade with NPC for prizes
local minMoney = 1 -- min amount of coins to get
local maxMoney = 90 -- max amount of coins to get
local maxTime = 1*60*1000 -- max time allowed in disco until kick - change "1" to different values to set different minutes
local gold_ID = 2148 -- gold coin ID
local plat_ID = 2152 -- platinum coin ID
local crystal_ID = 2160 -- crystal coin ID
local reward = 2148 -- no touchie!
local lighttextRND = math.random(254)
local effectRND = math.random(21,24)
local moneychanceRND = math.random(1,moneyChance)
local moneyRND = math.random(minMoney,maxMoney)
local disco_stat = 0
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 500*3)
setConditionFormula(condition, 0.70, 300, 0.70, 300)
setCombatCondition(combat, condition)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_AGGRESSIVE, false)
local condition2 = createConditionObject(CONDITION_LIGHT)
setConditionParam(condition2, CONDITION_PARAM_LIGHT_LEVEL, lightLevel)
setConditionParam(condition2, CONDITION_PARAM_LIGHT_COLOR, lighttextRND)
setConditionParam(condition2, CONDITION_PARAM_TICKS, lightTicks)
setCombatCondition(combat2, condition2)
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local disco_status = getCreatureStorage(cid,storage)
reward = rewardType == 1 and gold_ID or rewardType == 2 and plat_ID or rewardType == 2 and crystal_ID
if disco_status == -1 then
local var = positionToVariant(getThingPos(cid))
doCombat(cid, combat, var)
doCombat(cid, combat2, var)
doPlayerSendTextMessage(cid,22,'Start the disco!')
doSendAnimatedText(getThingPos(cid), 'Disco!', lighttextRND)
doSendMagicEffect(getThingPos(cid), effectRND)
if moneychanceRND == 1 then
if getPlayerFreeCap(cid) >= getItemWeightById(reward, moneyRND) and doPlayerAddItem(cid, reward, moneyRND, false) then
doPlayerAddItem(cid, reward, moneyRND, false)
doPlayerSendTextMessage(cid,22,'Moneh is flowin in!')
elseif not doPlayerAddItem(cid, reward, moneyRND, false) then
doPlayerSendTextMessage(cid,22,'You ain\'t got have enough space or cap for cash ;(')
end
end
if disco_stat == 0 then
addEvent(DiscoCheck,maxTime,cid)
disco_stat = 1
end
else
doPlayerSendCancel(cid, 'You have already participated in this disco parteh!')
end
return true
end
function DiscoCheck(cid)
if not isPlayer(cid) then
return true
end
doCreatureSetStorage(cid,storage,1)
end