Action Change Damage Type Wand

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
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

Last edited by a moderator:

Basiq GM

Developer / Graphic Designer / Mapper
Joined
Mar 30, 2014
Messages
350
Best answers
0
Reaction score
51
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
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,172
Best answers
174
Reaction score
2,234
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.
 

silveralol

Veteran OT User
Joined
Mar 16, 2010
Messages
1,461
Best answers
8
Reaction score
184
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 ...
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
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)
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
UPDATE
Added in shoot effect.
 

Mkalo

ボーカロイド
Joined
Jun 1, 2011
Messages
1,118
Best answers
54
Reaction score
899
Location
Japan
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.
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
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.
 

King_Alekz

New Member
Joined
May 13, 2016
Messages
1
Best answers
0
Reaction score
0
in creaturescript, which lines add ?, and action? can you help me
 

SamX

VoltageOT Developer
Premium User
Joined
Aug 27, 2010
Messages
557
Best answers
0
Reaction score
148
Location
Canada
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?
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
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.
 

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,449
Best answers
1
Reaction score
601
Location
Estonia
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.
 

Tarek1337

Excellent OT User
Joined
Jun 9, 2012
Messages
3,555
Best answers
3
Reaction score
1,004
Location
Sweden
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
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
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.
 
OP
strutZ

strutZ

Australian OT Member {AKA Beastn}
Joined
Nov 16, 2014
Messages
1,341
Best answers
6
Reaction score
476
Updated whole script to new modal window system and updated weapons script.
 

Tampek

ECHO 'Zarkonia.online';
Joined
Dec 29, 2015
Messages
446
Best answers
5
Reaction score
24
Location
Spain
with your scripts can i add the critical or manaleech for example?
 
Top