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

Spell changes gold into platinum

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
This spell takes 105 gold coins and turns them into 1 platinum coin. Why yes it does use 105, that is because it is meant (not for knights, they can cap it themselves, for mages really) to be used while hunting creatures like rotworms, where mages cap out on gold in like under an hour. With this spell they wont cap out on gold, even though their profit is reduced by 5%. And yes, I did use TGYoshi's spell creator so I give him credit for the animation part.

Anyway, add this to spells.xml:

Code:
	<instant name="Transform Gold" words="exevo argentus mummus" lvl="12" mana="10" mag="8" selftarget="1" aggressive="0" script="create_platinum.lua">
			<vocation name="Druid"/>    
			<vocation name="Elder Druid"/>

The default, that I have it at, is level 12, 10 mana, requires magic level 8, and can only be used by druids.

Now create a file in data/spells (not in a subfolder like support or summon) called

create_platinum.lua
Code:
-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{3}}))
local combat0_Brush_3 = createCombatObject()
setCombatParam(combat0_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat0_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush_3,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))


-- Areas/Combat for 500ms
local combat5_Brush_2 = createCombatObject()
setCombatParam(combat5_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat5_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat5_Brush_2,createCombatArea({{3}}))
local combat5_Brush_3 = createCombatObject()
setCombatParam(combat5_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat5_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat5_Brush_3,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))


-- Areas/Combat for 1000ms
local combat10_Brush_2 = createCombatObject()
setCombatParam(combat10_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat10_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat10_Brush_2,createCombatArea({{3}}))
local combat10_Brush_3 = createCombatObject()
setCombatParam(combat10_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat10_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat10_Brush_3,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))


-- Areas/Combat for 1500ms
local combat15_Brush_2 = createCombatObject()
setCombatParam(combat15_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatParam(combat15_Brush_2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat15_Brush_2,createCombatArea({{3}}))
local combat15_Brush_3 = createCombatObject()
setCombatParam(combat15_Brush_3, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat15_Brush_3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat15_Brush_3,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))


-- Areas/Combat for 2000ms
local combat20_Brush = createCombatObject()
setCombatParam(combat20_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat20_Brush, COMBAT_PARAM_TYPE, COMBAT_LIFEDRAIN)
setCombatArea(combat20_Brush,createCombatArea({{3}}))


-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
	if (isCreature(cid)) then
		doCombat(cid, c, var)
		if (dirList ~= nil) then -- Emit distance effects
			local i = 2;
			while (i < #dirList) do
				doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
				i = i + 2
			end		
		end
	end
end

function onCastSpell(cid, var)
	local startPos = getCreaturePosition(cid)
	RunPart(combat0_Brush_2,cid,var)
	RunPart(combat0_Brush_3,cid,var)
	addEvent(RunPart,500,combat5_Brush_2,cid,var)
	addEvent(RunPart,500,combat5_Brush_3,cid,var)
	addEvent(RunPart,1000,combat10_Brush_2,cid,var)
	addEvent(RunPart,1000,combat10_Brush_3,cid,var)
	addEvent(RunPart,1500,combat15_Brush_2,cid,var)
	addEvent(RunPart,1500,combat15_Brush_3,cid,var)
	addEvent(RunPart,2000,combat20_Brush,cid,var)
			if getPlayerItemCount(cid, ITEM_GOLD_COIN) >= 105
			then
				doPlayerRemoveItem(cid, ITEM_GOLD_COIN, 105)
				doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)	
	return true
end
	return true
end

Video

In the video I have two stacks of gold, 100 and 29, I do the spell and I'm left with 1 platinum coin and 24 gold coins.
 
ee.. to.. why mods&lua ?
too much effects.

Code:
if getPlayerItemCount(cid, ITEM_GOLD_COIN) >= 105
			then
				doPlayerRemoveItem(cid, ITEM_GOLD_COIN, 105)
				doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)	
	return true
end

awesome part. "profit is reduced by 5%" - 5% of 105 is not equal to 5.
 
there's no need to check item count, just use if doPlayerRemoveItem(cid, ITEM_GOLD_COIN, 105) then
 
Lua:
			if getPlayerItemCount(cid, ITEM_GOLD_COIN) >= 105
			then
				doPlayerRemoveItem(cid, ITEM_GOLD_COIN, 105)
				doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)	
	return true
end

Dafaq? :D

Und:
Kinda bad scripting, player can use spell anyways, ex, if he dont have any gold coins, spell will be casted, but dont recive anything. So, kinda stupid i think.
 
Back
Top