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

Action Change Damage Type Wand

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,391
Solutions
7
Reaction score
550
Hello Otland!

Here is a simple script that will allow you to change the damage type of a weapon. (ideal for wands) This system uses @Non Sequitur modal window system which can be found HERE
You will have to install that in order to be able to use this system.

Tested on TFS 1.2

Special thanks to @Jano

Preview

Information on the system
It has an easy config section for you to customize it how you would like it! You just need to fill out the config table found in the action script (pictured below)
Lua:
-- Config

-- Set wand how the wand deals damage
DamageTypeWand = {
   values = false, -- If this is set to true then it will use the min and max values. If set to false the wand will use the formula

   -- Damage Values min/max
   wandMinDam = 20,
   wandMaxDam = 50,

   -- Damage Formula
   formula = {
     wandMinDam = function(level, maglevel) return -((level / 5) + (maglevel * 1.4) + 8) end,
     wandMaxDam = function(level, maglevel) return -((level / 5) + (maglevel * 2.2) + 14) end,
   }
}

-- Modal window config and storage id
local config = {
   storage = 10009,
   titleMsg = "Change Weapon Damage Type",
   mainMsg = "Choose a damage type from the list",
-- End Config

   -- Damage Table
   [1] = {element = "Holy"},
   [2] = {element = "Fire"},
   [3] = {element = "Death"},
   [4] = {element = "Poison"},
   [5] = {element = "Energy"},
   [6] = {element = "Earth"},
   [7] = {element = "Ice"},
}

Installation

1)
Install the modal window helper: [TFS 1.2] Modal Window Helper Lib (https://otland.net/threads/tfs-1-2-modal-window-helper-lib.238773/)
2) Register the script in /data/actions/actions.xml by adding this line, replacing "ITEMID" with the item you want to use:
XML:
<action itemid="ITEMID" script="weapon_damage"/>
<action actionid="ACTIONID" script="weapon_damage"/>

3) Download actions-weapon_damage.lua into /data/actions/scripts and name it weapon_damage.lua

4)
Add the following line to your global.lua:
Lua:
dofile('data/lib/weapon_damage.lua')

5) Download lib-weapon_damage.lua into /data/actions/scripts and name it weapon_damage.lua
7)
Download weapons-weapon_damage.lua into /data/weapons/scripts and name it weapon_damage.lua
6)
Register the weapon in /data/weapons/weapons.xml by adding this line:
NOTE THIS LINE IS IF YOU ARE USING A WAND!
XML:
<wand id="ITEM ID HERE" level="300" mana="20" script="weapon_damage.lua"><!-- Shadow's Sceptre -->
            <vocation name="Sorcerer" />
</wand>

Enjoy!
 

Attachments

  • weapons-weapon_damage.lua
    1.7 KB · Views: 128 · VirusTotal
  • lib-weapon_damage.lua
    979 bytes · Views: 117 · VirusTotal
  • actions-weapon_damage.lua
    1 KB · Views: 114 · VirusTotal
Last edited by a moderator:
Holy shiat. Thats so kewl :3 I wish this would work on 0.4 .. Would be sick for a donation wand on my 8.6 OT :<

anyways, its an amazing idea lol, GJ :p
 
Holy shiat. Thats so kewl :3 I wish this would work on 0.4 .. Would be sick for a donation wand on my 8.6 OT :<

anyways, its an amazing idea lol, GJ :p
Just create it without the modal window.
Can use talkactions or an action script to cycle through the different damages.
 
nice release ;)
I can ask "where is the "shoot" effect?" is only to weapon or wands, if is wands, how to configure the fixed damage ...
 
nice release ;)
I can ask "where is the "shoot" effect?" is only to weapon or wands, if is wands, how to configure the fixed damage ...
Its in the weapon script. Check these lines.


Code:
    combat[k]:setParameter(COMBAT_PARAM_TYPE, DamageType)
    combat[k]:setFormula(COMBAT_FORMULA_SKILL, 1.0, 0, 1.0, 0)
 
UPDATE
Added in shoot effect.
 
UPDATE
Added in shoot effect.
Code:
    player:registerEvent("Modal_WeaponDam")
    player:unregisterEvent("Modal_WeaponDAM")

I'm not 100% sure if events are case sensitive but you might keep both the same just for safety.
 
Code:
    player:registerEvent("Modal_WeaponDam")
    player:unregisterEvent("Modal_WeaponDAM")

I'm not 100% sure if events are case sensitive but you might keep both the same just for safety.
They would be for linux not sure about windows.. You are right though thanks for pointing out.
 
Great work. Trying this out on my server.

I noticed once I added your script, my main and max values on weapons.xml are no longer valid. Seems I can hit anywhere from 0-140 when I have it set at 100-140. Is this configurable somewhere in your script?
 
Great work. Trying this out on my server.

I noticed once I added your script, my main and max values on weapons.xml are no longer valid. Seems I can hit anywhere from 0-140 when I have it set at 100-140. Is this configurable somewhere in your script?
TBH i found this problem out awhile ago and just havnt had time to look into it. I'll post here when i fix sometime this week.
 
function onGetFormulaValues(cid, level, maglevel) return min, max end

I think this was a function i used to use year ago when I still created Combat() things.
 
Code:
    player:registerEvent("Modal_WeaponDam")
    player:unregisterEvent("Modal_WeaponDAM")

I'm not 100% sure if events are case sensitive but you might keep both the same just for safety.
like StruZ says, Linux is case sensetive but not Windows
 
Great work. Trying this out on my server.

I noticed once I added your script, my main and max values on weapons.xml are no longer valid. Seems I can hit anywhere from 0-140 when I have it set at 100-140. Is this configurable somewhere in your script?

Forgot to update this script with the fix for the damage output... Updated main post.
 
Updated whole script to new modal window system and updated weapons script.
 
with your scripts can i add the critical or manaleech for example?
 
Back
Top