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

Action Weapon Augmentation! [UPDATED]

Shinmaru

エロルアー Scripter!
Joined
Aug 20, 2007
Messages
1,988
Reaction score
88
Location
Puerto Rico
[UPDATE]
I have fixed some problems with the following things:
1. players can attack pzed players and pzed players can attack outside pz.
2. allowPK is fixed - when it was set to false it wouldn't let players attack at all, now it works properly.
3. added an "VocUnLock" - when set to false it lock the weapon usage only to the allowed vocations,
which can be configured in the "allowedVoc"

Well here i am again bringing a a simple script, this time is as you read "Weapon Augmentation". In which you use , in this case,
your sword on a Gem(Red, Blue, Yellow, Green and Violet)and it will receive the Augmentation(the weapons do not change in appearance)
which are: Red = Fire, Blue = Ice, Yellow = Energy, Green = Earth and Violet = Critical(Physical), so let's begin:
[HOW TO INSTALL]
Go to data/actions/scripts and create 2 files one of them name it augment.lua and the other augmentattack.lua and copy the following:
[augment.lua]
Lua:
local cfg = {
	weapons = {2376, 2377}
	}
local augment = {
	[{2156}] = {msg = "Your weapon has a Fire Augmentation.", augAid = 12001, aug = "Fire", clr = 180},
	[{2158}] = {msg = "Your weapon has an Ice Augmentation.", augAid = 12002, aug = "Ice", clr = 35},
	[{2155}] = {msg = "Your weapon has an Earth Augmentation.", augAid = 12003, aug = "Earth", clr = 25},
	[{2154}] = {msg = "Your weapon has an Energy Augmentation.", augAid = 12004, aug = "Energy", clr = 80},
	[{2153}] = {msg = "Your weapon has a 'Critical' Augmentation.", augAid = 12005, aug = "Critical", clr = 90},
	[{2260}] = {runemsg = "Your weapon now has rune-like properties.", runeAid = 12000}
	}	
function onUse(cid, item, toPosition, itemEx, fromPosition)
	for aug, inf in pairs(augment) do
		if isInArray(aug, itemEx.itemid) then
			if isInArray(cfg.weapons, item.itemid) then
				if item.actionid == 0 and inf.runeAid then
					doSetItemActionId(item.uid, inf.runeAid)
					doSetItemSpecialDescription(item.uid, inf.runemsg)
					doSendMagicEffect(getCreaturePosition(cid), 13) 
					doRemoveItem(itemEx.uid)
				end	
				if isInArray(aug, itemEx.itemid) and isInArray(cfg.weapons, item.itemid) and item.actionid == inf.runeAid and inf.augAid then
					doSetItemActionId(item.uid, inf.augAid)
					doSetItemSpecialDescription(item.uid, inf.msg)
					doRemoveItem(itemEx.uid)
					doSendAnimatedText(toPosition, inf.aug, inf.clr)
				end
			end
		end
	end
return true
end
--Ver.3hR7Ik5lz3wF1gX1-¥P0k_TnÖD--
[augmentattack.lua][UPDATED & Fixed]
Lua:
local cfg = {
	mana = 10, -- base mana used --
	level = 10, -- requiered level --
	weapons = {2376, 2377}, -- weapons that can be augmented (please make sure you add them on the augment.lua file and in actions.xml
	allowPK = true, -- if you want this weapon to attack Players --
	vocUnLock = true, -- set to false if you want to lock it to specific vocations --
	allowedVoc = {4, 8}, -- set the vocations you want to use this --
	vocCancel = "You don't have the specified Vocation.",
	PKcancel = "This weapon can't be used to attack other players.",
	manaCancel = "Not enough mana.",
	lvlCancel = "You don't have the requiered level.",
	pzCancel = "You cannot use this weapon in a protection zone."
	}
local Wtype = {
	[{1}] = {skill = "sword"},
	[{3}] = {skill = "axe"},
	[{2}] = {skill = "club"}
	}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLevel(cid) >= cfg.level then
		if isInArray(cfg.weapons, item.itemid) then 
			for i, k in pairs(Wtype) do
				if (isInArray(i, getItemWeaponType(item.uid))) then 							
					local formulaMin = (getItemAttack(item.uid)*getPlayerSkillLevel(cid, k.skill)+getCreatureMaxMana(cid)/2)
						local formulaMax = (getItemAttack(item.uid)*getPlayerSkillLevel(cid, k.skill)+getCreatureMaxMana(cid)*2)
							local manaSpend = (cfg.mana*getCreatureMaxMana(cid)/50)
							if getTilePzInfo(getCreaturePosition(cid)) == false then 
								if getTilePzInfo(toPosition) == false then
									--[FIRE]--
									local function doFire(target) 
										doAreaCombatHealth(target.cid, COMBAT_FIREDAMAGE, target.toPosition, 0, -formulaMin, -formulaMax, 36)
										doCreatureAddMana(target.cid, -manaSpend)
									end	
									--[FIRE/]--	
									--[ICE]--
									local function doIce(target) 
										doAreaCombatHealth(target.cid, COMBAT_ICEDAMAGE, target.toPosition, 0, -formulaMin, -formulaMax, 43)
										doCreatureAddMana(target.cid, -manaSpend)
									end	
									--[ICE/]--
									--[EARTH]--
									local function doEarth(target)
										doAreaCombatHealth(target.cid, COMBAT_EARTHDAMAGE, target.toPosition, 0, -formulaMin, -formulaMax, 44)
										doCreatureAddMana(target.cid, -manaSpend)
									end	
									--[EARTH/]--
									--[ENERGY]--
									local function doEnergy(target)
										doAreaCombatHealth(target.cid, COMBAT_ENERGYDAMAGE, target.toPosition, 0, -formulaMin, -formulaMax, 11)
										doCreatureAddMana(target.cid, -manaSpend)
									end	
									--[ENERGY/]--
									--[CRITICAL]--
									local function doCritical(target)
										doAreaCombatHealth(target.cid, COMBAT_PHYSICALDAMAGE, target.toPosition, 0, -formulaMin, -formulaMax, 0)
										doCreatureAddMana(target.cid, -manaSpend)
										doSendAnimatedText(target.toPosition, "CRITICAL", 112)
									end	
									--[CRITICAL/]--	
									local target = {cid = cid, toPosition = toPosition, formulaMin = formulaMin, formulaMax = formulaMax, manaSpend = manaSpend}
									local pked = getThingFromPos(toPosition)
									--FIRE--
									if item.actionid == 12001 then
										if cfg.vocUnLock then
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 3) 
													addEvent(doFire, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 3) 
													addEvent(doFire, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end	
										elseif (isInArray(cfg.allowedVoc, getPlayerVocation(cid))) then	
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 3) 
													addEvent(doFire, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 3) 
													addEvent(doFire, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end
										else
											doPlayerSendCancel(cid, cfg.vocCancel)
										end	
									end	
									--ICE--
									if item.actionid == 12002 then
										if cfg.vocUnLock then
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 28) 
													addEvent(doIce, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 28) 
													addEvent(doIce, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end	
										elseif (isInArray(cfg.allowedVoc, getPlayerVocation(cid))) then	
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 28) 
													addEvent(doIce, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 28) 
													addEvent(doIce, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end
										else
											doPlayerSendCancel(cid, cfg.vocCancel)
										end
									end	
									--Earth--
									if item.actionid == 12003 then
										if cfg.vocUnLock then
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
												doPlayerSendCancel(cid, cfg.manaCancel)
											else
												doSendDistanceShoot(getCreaturePosition(cid), toPosition, 29) 
												addEvent(doEarth, 300, target)
											end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 29) 
													addEvent(doEarth, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end	
										elseif (isInArray(cfg.allowedVoc, getPlayerVocation(cid))) then	
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 29) 
													addEvent(doEarth, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 29) 
													addEvent(doEarth, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end
										else
											doPlayerSendCancel(cid, cfg.vocCancel)
										end
									end	
									--ENERGY--
									if item.actionid == 12004 then
										if cfg.vocUnLock then
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 4) 
													addEvent(doEnergy, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 4) 
													addEvent(doEnergy, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end	
										elseif (isInArray(cfg.allowedVoc, getPlayerVocation(cid))) then	
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 4) 
													addEvent(doEnergy, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 4) 
													addEvent(doEnergy, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end
										else
											doPlayerSendCancel(cid, cfg.vocCancel)
										end	
									end	
									--CRITICAL--
									if item.actionid == 12005 then
										if cfg.vocUnLock then
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 24) 
													addEvent(doCritical, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 24) 
													addEvent(doCritical, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end	
										elseif (isInArray(cfg.allowedVoc, getPlayerVocation(cid))) then	
											if cfg.allowPK then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 24) 
													addEvent(doCritical, 300, target)
												end	
											elseif (not(isPlayer(pked))) then
												if getCreatureMana(cid) <= manaSpend then
													doPlayerSendCancel(cid, cfg.manaCancel)
												else
													doSendDistanceShoot(getCreaturePosition(cid), toPosition, 24) 
													addEvent(doCritical, 300, target)
												end
											else		
												doPlayerSendCancel(cid, cfg.PKcancel)
											end
										else
											doPlayerSendCancel(cid, cfg.vocCancel)
										end	
									end
								else
									doPlayerSendCancel(cid, cfg.pzCancel)
								end	
							else
								doPlayerSendCancel(cid, cfg.pzCancel)	
							end
				end	 
			end
		end
	else
		doPlayerSendCancel(cid, cfg.lvlCancel)
	end		
return true
end
--Ver.3hR7Ik5lz3wF1gX1-¥P0k_TnÖD--
Now in data/actions/actions.xml copy this in it:
PHP:
	<action actionid="12001-12005" event="script" value="augmentattack.lua" allowfaruse="1"/>
	<action itemid="2376;2377" event="script" value="augment.lua" allowfaruse="1"/>
well that is all and i hope you enjoy if any problems arise please let me know.
Script made entirely by me.
 
Last edited:
this make the weapon acts like a enchanted weapon whit ruby etc?
but whit mana spend?, and can works on like a enchanted spear?
thanks:thumbup:
 
Thanks for the comments, at the moment I'm making a small
update to it and a fix which are the following:
1.Fixing the "allowPK", because when set to false you can't attack nothing not even monsters.
2.Adding "vocLock and "allowedVoc" which you may configure to have it set to specified voc or allow for all.
Also if anyone can help me come up with a better attack formula to balance the attack power on augmented weapon.
 
I have some questions...
1) You use your weapon on a gem, or the gem on a weapon?
2) You may use just gems, or also small gems and enchanted small gem?
3) When you use the gem, it is removed?
4) When you use the gem, it gives especial attribute for ever, or it just have some time?
 
Doesn't work for 0.3.6?
[30/06/2010 15:54:52] [Error - Action Interface]
[30/06/2010 15:54:52] data/actions/scripts/augment.lua:eek:nUse
[30/06/2010 15:54:52] Description:
[30/06/2010 15:54:52] data/actions/scripts/augment.lua:16: attempt to call global 'doSetItemActionId' (a nil value)
[30/06/2010 15:54:52] stack traceback:
[30/06/2010 15:54:52] data/actions/scripts/augment.lua:16: in function <data/actions/scripts/augment.lua:11>
 
@all
who see this thread, the script has a few problems and you will have a hard time working with it, but I recreated this to something better and creative for knights only and here it is:
Knight Spell "Rune Blade"
I hope you enjoy this one better than the other.
 
Back
Top