as long as I put it "directly" in the code, it works:
@ $BOD/Maps/PeasantRevolt/WeaponTypes.py::class LooseFireBomb(ItemTypes.PersistantItemType)::def Detonate(self, EntityName):
but when I tried to be more elegant and enclosed it in class method then it refuses to work.self.ImpactSound.Position=weapon.Position[0],weapon.Position[1],weapon.Position[2]
self.ImpactSound.PlaySound(0) ## -- place it here --
### generate smoke at position point rather than object/person
x=weapon.Position[0]; z=weapon.Position[1]; y=weapon.Position[2]; sx=50; sz=50; sy=50; pps=64; ptype="DarkSmoke"; t2l=80; t2d=0.70;
# x,z,y - position; sx,sz,sy - dunno; pps - particles/sec; ptype - particle type; t2l - time to live (life span of particle); t2d - time to death - life span of effect
wps = Bladex.CreateEntity("smoke_D3_"+str(int(Bladex.GetTime()*1000)), "Entity Particle System D3", x + sx, y + sy, z + sz)
wps.ParticleType = ptype
wps.PPS = pps
wps.YGravity = -400.0
wps.Friction = 0.1
wps.Velocity = 20.0, -400.0, 20.0
wps.RandomVelocity = 20.0
wps.Time2Live = t2l
wps.DeathTime = Bladex.GetTime()+t2d
I don't get it - other functions of this class work.self.ImpactSound.Position=weapon.Position[0],weapon.Position[1],weapon.Position[2]
self.ImpactSound.PlaySound(0) ## -- place it here --
### generate smoke at position point rather than object/person
self.ps_smoke_D3(weapon.Position[0], weapon.Position[1], weapon.Position[2])
(...)
def ps_smoke_D3(x, y, z, sx=50, sy=50, sz=50, pps=64, ptype="DarkSmoke", t2l=80, t2d=0.70):
wps = Bladex.CreateEntity("smoke_D3_"+str(int(Bladex.GetTime()*1000)), "Entity Particle System D3", x +sx, z, y + sy)
(...)
When attempted to debug it and enclosed with try: except: I caught this exception:
This "TypeError" is somewhat crazy as if I tried to concatenate different types of variables into a string, but I don't. And whether without function clause or even with, in separate file (`exec("my_ps.py"); ps_smoke_D3(1000, 2000, 3000);`) it runs, without problems.Traceback (innermost last):
File ".\WeaponTypes.py", line 1629, in Detonate
self.ps_smoke_D3(weapon.Position[0], weapon.Position[1], weapon.Position[2])
File ".\WeaponTypes.py", line 1711, in ps_smoke_D3
wps = Bladex.CreateEntity("smoke_D3_"+str(int(Bladex.GetTime()*1000)), "Entity Particle System D3", x +sx, z, y + sy)
TypeError: __add__ nor __radd__ defined for these operands
Anyone understands what's going on with it?
PS. I attached .diff file so you can easier check it.