Weapons bound to character

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
meadwarrior
Journeyman
Posts: 91
Joined: Sat Dec 01, 2018 1:02 am

Weapons bound to character

Post by meadwarrior »

Hello!

:?: How would I go about making weapons that are only usable by certain characters and nobody else?

Thanks!
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Weapons bound to character

Post by Sophia »

The simplest approach is probably to define a rend_method_check function for the weapon's arch. A return value of false is treated as though the weapon had no attack methods, while true uses the weapon's normal attack methods. It takes the weapon's id as its one and only parameter, so to only make it work with certain characters you can dsb_fetch its location and see whose inventory the weapon is in and return values accordingly.
User avatar
meadwarrior
Journeyman
Posts: 91
Joined: Sat Dec 01, 2018 1:02 am

Re: Weapons bound to character

Post by meadwarrior »

Thank you, I'll try it out!
Post Reply