Notes
Xerves here again. A little fix here if you want to change this so potions are only useable by the owner. A few lines of code here only.
mud/world/defines.py
Find the following
RPG_ITEM_TRIGGER_WORN = 0 #chance per tick for just being worn, check is every 30 seconds RPG_ITEM_TRIGGER_MELEE = 1 #chance of proc on melee strike RPG_ITEM_TRIGGER_DAMAGED = 2 #chace of proc when user is damaged RPG_ITEM_TRIGGER_USE = 3 #when used (possibly limited by charges) RPG_ITEM_TRIGGER_POISON = 4 #applied poison
After it add
RPG_ITEM_TRIGGER_QUAFF = 5 #Same as Use, but forces target as self
mud/worlddocs/itempages.py
Find the following
RPG_ITEM_TRIGGER_WORN: 'Worn',
RPG_ITEM_TRIGGER_MELEE: 'Melee',
RPG_ITEM_TRIGGER_DAMAGED: 'Damaged',
RPG_ITEM_TRIGGER_USE: 'Use',
RPG_ITEM_TRIGGER_POISON: 'Poison'
Change it to the following
RPG_ITEM_TRIGGER_WORN: 'Worn',
RPG_ITEM_TRIGGER_MELEE: 'Melee',
RPG_ITEM_TRIGGER_DAMAGED: 'Damaged',
RPG_ITEM_TRIGGER_USE: 'Use',
RPG_ITEM_TRIGGER_POISON: 'Poison',
RPG_ITEM_TRIGGER_QUAFF: 'Quaff'
mud/world/item.py
Find the following
elif ispell.trigger == RPG_ITEM_TRIGGER_USE
Change it to this
elif ispell.trigger == RPG_ITEM_TRIGGER_USE or ispell.trigger == RPG_ITEM_TRIGGER_QUAFF:
A few lines down find the following
self.doItemSpellUse(mob,ispell.spellProto)
Change it to
self.doItemSpellUse(mob,ispell)
A few lines up find the following function and part of its code
def doItemSpellUse(self,mob,proto):
tgt = mob.target
if proto.target == RPG_TARGET_SELF:
tgt = mob
if proto.target == RPG_TARGET_PARTY:
tgt = mob
if proto.target == RPG_TARGET_ALLIANCE:
tgt = mob
if proto.target == RPG_TARGET_PET:
tgt = mob.pet
if not tgt:
return
Replace the following code up to the if not tgt: line with this
def doItemSpellUse(self,mob,spell):
proto = spell.spellProto
if spell.trigger == RPG_ITEM_TRIGGER_QUAFF:
tgt = mob
else:
tgt = mob.target
if proto.target == RPG_TARGET_SELF:
tgt = mob
if proto.target == RPG_TARGET_PARTY:
tgt = mob
if proto.target == RPG_TARGET_ALLIANCE:
tgt = mob
if proto.target == RPG_TARGET_PET:
tgt = mob.pet
if not tgt:
return
Example potion
I created a spell potion item file and used a small function to create the potions for me. Here is an example:
from genesis.dbdict import DBItemProto,DBSpellProto,DBEffectProto
from mud.world.defines import *
def CreateSpellPotion(name,spell,level,desc):
item = DBItemProto(name = name)
item.addSpell(spell,RPG_ITEM_TRIGGER_QUAFF,1)
item.level = level
item.bitmap = "STUFF/13"
item.useMax = 1
item.desc = desc
item.stackMax = 20
item.stackDefault = 1
desc = "This potion restores a small amount of health."
CreateSpellPotion("Potion of Cure Light","Cure Light",1,desc)
This will create a spell potion linking it to an already existing spell. You will need to come up with the bitmap file there (you can change it to 1 if you like). Once this is done compile and when you go to use the potion it won't require a target and automatically target the user.

