Well I had a need for this so I wrote it, simple enough to post so I thought I would.
/game.mmo/genesis/dbdict.py
Find this line
del set['interrupt']
Comment it out. What is going on here is the DB init for the effect already has this value (how it sets the flag). The del statement removes it from being passed to the protoype. We need this to happen so we can get the percentage value.
/mud/world/effect.py
In the EffectProto? Class add the following. This will make sure it is accessable in the game now and useable.
interrupt = FloatCol(default=0)
If you are using my scripting code for skills/spells you can put a string value here instead to integrate it into that system
interrupt = StringCol(default="")
A bit down find the function for DoInterrupt?. Replace it with the following
def DoInterrupt(effect,src,dst):
proto = effect.effectProto
if not proto.flags&RPG_EFFECT_INTERRUPT:
return
chance = proto.interrupt
if dst.casting and chance > 0:
chance = chance * 100
if random.randint(1,100) <= chance:
dst.zone.simAvatar.mind.callRemote("casting",dst.simObject.id,False)
if dst.player:
dst.player.sendGameText(RPG_MSG_GAME_DENIED,r'%s\'s casting got interrupted by %s!\n'%(dst.name,src.name))
if src.player:
src.player.sendGameText(RPG_MSG_GAME_BLUE,r'You interrupted %s\'s casting!\n'%(dst.name))
dst.casting = None
To use my skill/spell script stuff you make a minor change
def DoInterrupt(effect,src,dst):
proto = effect.effectProto
if not proto.flags&RPG_EFFECT_INTERRUPT:
return
chance = ParseStatValue(proto.interrupt,effect.src,effect.parent.skill,None,effect.parent.spellProto,effect.parent.spitem)
if dst.casting and chance > 0:
chance = chance * 100
if random.randint(1,100) <= chance:
dst.zone.simAvatar.mind.callRemote("casting",dst.simObject.id,False)
if dst.player:
dst.player.sendGameText(RPG_MSG_GAME_DENIED,r'%s\'s casting got interrupted by %s!\n'%(dst.name,src.name))
if src.player:
src.player.sendGameText(RPG_MSG_GAME_BLUE,r'You interrupted %s\'s casting!\n'%(dst.name))
dst.casting = None
/mud/worlddocs/spellpages.py
You probably want to modify the docs for this.
Find the INTERRUPT flag entry and change it to this:
# Spell casting interrupt
if e.flags&RPG_EFFECT_INTERRUPT:
etext.append("<br>**Interrupts targets Spell Casting:** %i%%"%(int(e.interrupt*100)))
If you are using my skill/spell script stuff you will need to change this to a string
# Spell casting interrupt
if e.flags&RPG_EFFECT_INTERRUPT:
etext.append("<br>**Interrupts targets Spell Casting:** %s"%(e.interrupt))
/mud/world/shared/playdata.py
Again more of my skill/spell stuff. If you have the enchanced spell information I wrote you can put this in the spell information. If you haven't added this part ignore this and skip it.
Search for RPG_EFFECT_INTERRUPT and replace it with the following
# INTERRUPT
if flags&RPG_EFFECT_INTERRUPT:
text.append(r"\c3SPELL INTERRUPT: \c2%i%%"%(ParseStatValue(interrupt,None,"",ghost,None,None) * 100))
if (count % 2 == 0):
text.append(r'\n')
count += 1
Fin
You are done, now just added the interrupt to a spell or skill spell.
Ex:
#50 percent chance effect.interrupt = .5

