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

RevScripts Is there any way to call for the default weapon behavior from inside an onUseWeapon script?

MutantAssassin

Active Member
Joined
Dec 13, 2009
Messages
43
Solutions
1
Reaction score
29
Here I am, using those hollidays to get some skills with the new (for me) revscriptsys. For training purposes, I tried to create a simple script which would make the player say "Feel the power of my mighty blade!" everytime that he attacks using a scimitar:
Lua:
local coolSword = Weapon(WEAPON_SWORD)
coolSword:id(2419) --scimitar

function coolSword.onUseWeapon(player, variant)
    player:say("Feel the power of my mighty blade!", TALKTYPE_MONSTER_SAY)
    return true
end

coolSword:register()
But scripted attacks always overwrite the default behavior of weapons, so the code above doesn't work. I need a command to call the default behavior of a weapon from inside a script. Is there any way to do it? And if not, is there a better solution than adding a code to mimic the default behavior of a scimitar inside of this script? Because that would be a very ugly solution.

Cheers,

Assassina Mutante.
 
Last edited:
There is no solution to execute base code, you would have to expose weapons class to lua and then call the method inside of this.

Otherwise you have to construct combat that acts like weapon use
For the moment, I would like to avoid source code editing. The engine which I know well (otserv) is different of TFS in many different ways. Before I start source editing TFS I need to understand what are the capabilities of Lua in TFS, so I can source edit only when it is indeed advisable to do so.
Thanks for your reply.
 
Back
Top