Hi i'm having trouble adding a if statement to my code i have these two files in the same folder mud.world effect and simmind, in effect i have this class EffectIllusion, and i use the portion illusionRace, i ive been trying to add a condition that when illusionRace is active or equals to "speeder" it will unmount something, speeder is a illusionRace you can call, my code all works just can't get this change to work...
if not mount0:
tgeObject.unmountImage(0)
like i need to get if illusionRace
tgeObject.unmountImage(0)
??
can't get it to work since there different files.. new to programming anyone help?
MY EFFECT.py
from mud.common.persistent import Persistent
from mud.world.core import *
from mud.world.damage import Damage,Heal
from mud.world.defines import *
import spell
from collections import defaultdict
from math import ceil,floor
from random import randint
from sqlobject import *
from time import time as sysTime
import traceback
class EffectIllusion(Persistent):
illusionModel = StringCol(default="")
illusionAnimation = StringCol(default="")
illusionTextureSingle = StringCol(default="")
illusionTextureExtra = StringCol(default="")
illusionTextureBody = StringCol(default="")
illusionTextureHead = StringCol(default="")
illusionTextureLegs = StringCol(default="")
illusionTextureHands = StringCol(default="")
illusionTextureFeet = StringCol(default="")
illusionTextureArms = StringCol(default="")
illusionSex = StringCol(default="")
[B]illusionRace = StringCol(default="")[/B]
illusionSndProfile = ForeignKey('SpawnSoundProfile',default=None)
# if non-zero sets the illusion to a size rather than scaling (to do)
illusionSize = FloatCol(default=0.0)
MY SIMMIND.py
from tgenative import *
from mud.tgepython.console import TGEExport
from twisted.spread import pb
from twisted.internet import reactor
from twisted.cred.credentials import UsernamePassword
from md5 import md5
from mud.simulation.shared.simdata import SpawnpointInfo,SimMobInfo,DialogTriggerInfo
from mud.simulation.simobject import SimObject,SimItem
from mud.world.effect import EffectIllusion
from mud.world.defines import *
from mud.world.core import CoreSettings
from mud.gamesettings import *
from mud.world.shared.vocals import *
# jelly
import mud.world.shared.worlddata
import os,sys
from traceback import print_exc
from math import radians,sqrt
from random import randint
import re
from itertools import chain
def updateSimObjects(self):
#mob infos
doZombie = False
self.zombieUpdateTimer -= 1
if not self.zombieUpdateTimer:
self.zombieUpdateTimer = 4
doZombie = True
simUpdates = []
numinzone = NumPlayersInZone()
dedicated = int(TGEGetGlobal("$Server::Dedicated"))
for so in self.simObjects:
if not so.brain:
continue
tgeObject = so.tgeObject
try:
sz = int(tgeObject.isSimZombie())
if sz != so.simZombie:
if sz and so.wanderGroup == -1:
tgeObject.setTransform(so.homePoint)
so.simZombie = sz
so.observer.callRemote('updateSimZombie', sz)
if sz:
if dedicated and numinzone:
if so.wanderGroup <= 0:
continue
if doZombie:
simUpdates.append(so)
#so.updateTransform() #wandergroup
continue
continue
conn = None
if self.playerMobInfos.has_key(so.id):
if not so.spawnInfo.dirty:
for m in self.playerMobInfos[so.id]:
if m.dirty:
break
# Found no dirty mobinfo.
else:
simUpdates.append(so)
continue
conn = self.playerConnections[so.id]
zombie = False
worstmove = 999999
worstSpeedMod = 999999
walk = False
bestvis = 0
bestseeinvis = 0
bestscale = 0
alldead = True
bestlight = 0
flying = 1
attacking = False
overrideScale = False
minfo = so.mobInfo
sinfo = so.spawnInfo
sinfo.dirty = False
tgeObject.role = minfo.ROLE
target = so.brain.target
for m in self.playerMobInfos[so.id]:
m.dirty = False
if m.DETACHED:
continue
alldead = False
overrideScale = False
# Player, can only go as fast as slowest character in party.
if m.MOVE < worstmove:
worstmove = m.MOVE
if m.SPEEDMOD < worstSpeedMod:
worstSpeedMod = m.SPEEDMOD
if m.WALK:
walk = True
if m.SIZE > bestscale:
bestscale = m.SIZE
if m.SEEINVISIBLE > bestseeinvis:
bestseeinvis = m.SEEINVISIBLE
# Only as invisible as most invisible character in party.
if m.VISIBILITY > bestvis:
bestvis = m.VISIBILITY
if m.LIGHT > bestlight:
bestlight = m.LIGHT
if m.FLYING < flying:
flying = m.FLYING
if m.SLEEP:
worstmove = 0
worstSpeedMod = 0
if m.FEIGNDEATH:
worstmove = 0
worstSpeedMod = 0
flying = 0
if m.ATTACKING:
attacking = True
if not target and m.TGTID:
target = self.simLookup.get(m.TGTID,None)
if m.OVERRIDESCALE:
overrideScale = True
aggroRange = 100
if alldead:
move = 1
speedMod = 0
scale = 1
seeinvis = 0
vis = 1
flying = 0
else:
move = worstmove
speedMod = worstSpeedMod
scale = bestscale
seeinvis = bestseeinvis
vis = bestvis
# Update the scale based on the default scale modifier (1.0).
# The scale modifier can be updated after the scale is properly
# set, so that the scale is a multiplier from base model, and the
# modifier is a percent of the scale.
if overrideScale:
tgeObject.setScaleModifier(1.0)
tgeObject.setScale("1.0 1.0 1.0")
else:
tgeObject.setScaleModifier(1.0)
tgeObject.setScale("%f %f %f"%(sinfo.scale, sinfo.scale, sinfo.scale))
else:
if not so.mobInfo.dirty and not so.spawnInfo:
simUpdates.append(so)
continue
minfo = so.mobInfo
# Set varname for player pets (or previous ones),
# now contains master info
if minfo.PLAYERPET or tgeObject.playerPet:
tgeObject.setShapeName(minfo.VARNAME)
tgeObject.playerPet = minfo.PLAYERPET
# mob may change realm due to being a pet or breaking a charm
tgeObject.realm = minfo.REALM
minfo.dirty = False
sinfo = so.spawnInfo
sinfo.dirty = False
move = minfo.MOVE
speedMod = minfo.SPEEDMOD
walk = minfo.WALK
if minfo.SLEEP:
move = 0
speedMod = 0
scale = minfo.SIZE
seeinvis = minfo.SEEINVISIBLE
vis = minfo.VISIBILITY
bestlight = minfo.LIGHT
flying = minfo.FLYING
attacking = minfo.ATTACKING
zombie = minfo.ZOMBIE
target = self.simLookup.get(minfo.TGTID,None)
aggroRange = minfo.AGGRORANGE
mount0 = minfo.MOUNT0
mount1 = minfo.MOUNT1
mount2 = minfo.MOUNT2
mount3 = minfo.MOUNT3
twohanded = minfo.TWOHANDED
[B]if not mount0:
tgeObject.unmountImage(0)
else:
if minfo.MOUNT0_MAT:
tgeObject.mountImage(CreateShapeImage0(mount0),0,1.0,"~/data/shapes/equipment/%s"%minfo.MOUNT0_MAT)
else:
tgeObject.mountImage(CreateShapeImage0(mount0),0)[/B]