• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Weapon scripts - Default behaviour

trollebror

Developer
Joined
Aug 8, 2009
Messages
362
Reaction score
58
Location
Sweden, Linköping
What I want to do is that any wand/rod/bow/sword (any weapon) that I point to a script in the weapons.xml should behave like they normally do (like if I would not have pointed a script to this weapon).

Code:
<melee id="2376" function="default" [COLOR="#FF0000"]script="somescript.lua"[/COLOR] />
<distance id="2456" function="default" [COLOR="#FF0000"]script="somescript.lua"[/COLOR] />
<wand id="13759" level="35" mana="15" min="60" max="90" type="death" [COLOR="#FF0000"]script="somescript.lua"[/COLOR] >
	<vocation name="Druid"/>
	<vocation name="Sorcerer"/>
</wand>

Why do I want this? Let's say I want to apply this "somescript.lua" to 100 different weapons, then I don't want to write all the different combatObjects to fit all these different weapon type/effect/damage calculation etc.
Hope the explanation is good enough!

- - - Updated - - -

Limos? :)
 
I don't understand this, what is your intention with this script?
What does it do?
What do you have to do to make it work?
Do you just create a lua called somescript in weapons and that's it?
Your description makes no sense to me =/
A step by step explanation would be nice

Regards
Babǝk
 
I don't understand this, what is your intention with this script?
To make a weapon that I point a script to (from weapons.xml) to behave like normal. (hit enemies)

What does it do?
This would make it possible to easily create special weaponOnAttack effects.

Do you just create a lua called somescript in weapons and that's it?
For example I would create the file:
Code:
data\weapons\scripts\poisoneffect.lua
and then add a line in weapon.xml
Code:
<melee id="2376" function="default" script="poisoneffect.lua" />
This would make the weapon with id 2376 have a poisoneffect but still attack with its normal attack.

You feel me homie?
 
Heres a weapon of mine like that. Change some of the variables to your own
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ME_ETHEREALSPEAR)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
local area = createCombatArea( { {0, 3, 0} } )
setCombatArea(combat, area)
function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end
 
I get what you mean, if you want to just add effects to any kind of weapon. You can also modify what it is in Item.xml, there you could make it have all kinds of possibilities too, doesn't have to just be in weapons.xml
 
ok so use the same script he showed you, but make it an action script with a unique id, and putt that unique id on the weapon inside the backpack or quest chest or w/e

Also, the script would work for distance weaopons, but u would be best with making that count for the ammo....
 
Last edited:
ok so use the same script he showed you, but make it an action script with a unique id, and putt that unique id on the weapon inside the backpack or quest chest or w/e

Also, the script would work for distance weaopons, but u would be best with making that count for the ammo....
Yeah, I know that you can do it that way. But if you do, you will have to create a unique script for every weapon that have a different animation/effect, and that is not good at all. You feel me?
 
Back
Top