Official Community Forums
 
HomeHome  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  The Wiki  Website  github Project  

Share | 
 

 Mob Spawning

View previous topic View next topic Go down 
AuthorMessage
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Mob Spawning   Wed 22 Feb - 19:15

Ok, another problem!

I'm trying to add mobs to my world, but I can't seem to get it to work. I've tried both tutorials on the Wiki, but it still doesn't work.

I'll just put my code here - if you know what the problem, I'd love to hear your solution!


templates.py
Code:

garrison_soldier_male_base_DC = DisplayContext("human_female.mesh", True)
        garrison_soldier_male_base_DC.addSubmesh(DisplayContext.Submesh("bodyShape-lib.0", "human_female.skin_material"))
        garrison_soldier_male_base_DC.addSubmesh(DisplayContext.Submesh("head_aShape-lib.0", "human_female.head_a_material"))
...
...
...
        #
        # Garrison Soldier Male
        #
        tmpl = Template("Garrison Soldier Male")
        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_DISPLAY_CONTEXT, garrison_soldier_male_base_DC)
        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_OBJECT_TYPE, ObjectTypes.mob)
        tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS,"*settlerpistol; *Leather Tunic; *Leather Pants; *Leather Boots")
        tmpl.put(TrainerClient.NAMESPACE, "skills", "Sword;First Aid")
        tmpl.put(CombatClient.NAMESPACE, "strength", MarsStat("strength", 160))
        tmpl.put(CombatClient.NAMESPACE, "dexterity", MarsStat("dexterity", 160))
        tmpl.put(CombatClient.NAMESPACE, "intelligence", MarsStat("intelligence", 160))
        tmpl.put(CombatClient.NAMESPACE, "stamina", MarsStat("stamina", int(int(160)*1.5)))
        tmpl.put(CombatClient.NAMESPACE, "stamina-max", MarsStat("stamina-max", int(int(160)*1.5)))
        tmpl.put(CombatClient.NAMESPACE, "health", MarsStat("health", int(200) * 2))
        tmpl.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", int(160)*2))
        tmpl.put(CombatClient.NAMESPACE, "experience", MarsStat("experience", 0))
        tmpl.put(CombatClient.NAMESPACE, "level", MarsStat("level", 50))
        tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_AUTOATTACK_ABILITY, "attack ability")
        tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_REGEN_EFFECT, "regen effect")
        tmpl.put(CombatClient.NAMESPACE, "attackable", Boolean(True))
        tmpl.put(CombatClient.NAMESPACE, "combat.mobflag", Boolean(True))
        tmpl.put(CombatClient.NAMESPACE, "kill_exp", 20);
        ObjectManagerClient.registerTemplate(tmpl)

mobserver.py
Code:

class garrison_soldierFactory (ObjectFactory):
    def makeObject(self, spawnData, instanceOid, loc):
        obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)
        return obj

ObjectFactory.register("garrison_soldierFactory", garrison_soldierFactory("Garrison Soldier Male"))

instance_load.py - (entire file)
Code:


from java.lang import Long
from multiverse.server.plugins import *
from multiverse.server.objects import *

instance = Instance.current()
instanceOid = Instance.currentOid()

garrison_soldierLoc = Point(-15809, 20000, -8638)
spawnData = SpawnData()
spawnData.setFactoryName("garrison_soldierFactory")
spawnData.setInstanceOid(Long(instanceOid))
spawnData.setLoc(garrison_soldierLoc)
spawnData.setNumSpawns(1)
spawnData.setSpawnRadius(1)
spawnData.setRespawnTime(60000)
MobManagerClient.createSpawnGenerator(spawnData)

Any help would be great!

~Tristan
Back to top Go down
http://www.3dmodeller.info
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Fri 24 Feb - 14:12

Apparently this line (line 17) from instance_load.py is causing problems

Code:

MobManagerClient.createSpawnGenerator(spawnData)

Here's the excerpt from the instance.out log:

Code:

ERROR [2012-02-24 03:00:29,186] Instance-2          ScriptManager.runPYFile: file=..\config\earth2.0/instance_load.py Traceback (innermost last):
  File "..\config\earth2.0/instance_load.py", line 17, in ?
   at multiverse.mars.objects.SpawnGenerator.activate(SpawnGenerator.java:57)

   at multiverse.server.plugins.MobManagerPlugin$CreateSpawnGenHook.processMessage(MobManagerPlugin.java:174)

   at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)

   at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)

   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

   at java.lang.Thread.run(Unknown Source)

Caused by: multiverse.msgsys.RPCException(multiverse.msgsys.RPCException in mobserver)

   at multiverse.mars.objects.MarsStatDef.update(MarsStatDef.java:22)

   at org.python.proxies.mvmodule$ManaStat$6.super__update(Unknown Source)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

   at java.lang.reflect.Method.invoke(Unknown Source)


multiverse.msgsys.RPCException: multiverse.msgsys.RPCException(multiverse.server.util.MVRuntimeException in mobserver): activate failed
 Traceback (innermost last):
  File "..\config\earth2.0/instance_load.py", line 17, in ?
   at multiverse.mars.objects.SpawnGenerator.activate(SpawnGenerator.java:57)

   at multiverse.server.plugins.MobManagerPlugin$CreateSpawnGenHook.processMessage(MobManagerPlugin.java:174)

   at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)

   at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)

   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

   at java.lang.Thread.run(Unknown Source)

Caused by: multiverse.msgsys.RPCException(multiverse.msgsys.RPCException in mobserver)

   at multiverse.mars.objects.MarsStatDef.update(MarsStatDef.java:22)

   at org.python.proxies.mvmodule$ManaStat$6.super__update(Unknown Source)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

   at java.lang.reflect.Method.invoke(Unknown Source)


multiverse.msgsys.RPCException: multiverse.msgsys.RPCException(multiverse.server.util.MVRuntimeException in mobserver): activate failed

      at org.python.core.Py.JavaError(Unknown Source)
      at org.python.core.Py.JavaError(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)
      at org.python.core.PyObject.invoke(Unknown Source)
      at org.python.pycode._pyx6.f$0(..\config\earth2.0/instance_load.py:17)
      at org.python.pycode._pyx6.call_function(..\config\earth2.0/instance_load.py)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyCode.call(Unknown Source)
      at org.python.core.Py.runCode(Unknown Source)
      at multiverse.server.engine.ScriptManager.runPYFile(ScriptManager.java:181)
      at multiverse.server.engine.ScriptManager.runFileWithThrow(ScriptManager.java:121)
      at multiverse.server.objects.Instance.runInitScript(Instance.java:91)
      at multiverse.server.plugins.InstancePlugin$CreateInstanceHook.processMessage(InstancePlugin.java:288)
      at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)
      at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)


I thought spawning mobs was meant to be really easy!!


EDIT: Just found this in the mobserver.out log file. Don't know if it helps:

Code:

ERROR [2012-02-24 03:00:29,164] MobManager-1        handleMessageImpl multiverse.server.util.MVRuntimeException: activate failed multiverse.server.util.MVRuntimeException: activate failed
      at multiverse.mars.objects.SpawnGenerator.activate(SpawnGenerator.java:57)
      at multiverse.server.plugins.MobManagerPlugin$CreateSpawnGenHook.processMessage(MobManagerPlugin.java:174)
      at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)
      at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Caused by: multiverse.msgsys.RPCException(multiverse.msgsys.RPCException in objmgr)
      at multiverse.mars.objects.MarsStatDef.update(MarsStatDef.java:22)
      at org.python.proxies.mvmodule$ManaStat$6.super__update(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)
      at org.python.core.PyObject.invoke(Unknown Source)
      at org.python.pycode._pyx8.update$14(..\config\earth2.0\combat.py:112)
      at org.python.pycode._pyx8.call_function(..\config\earth2.0\combat.py)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyFunction.__call__(Unknown Source)
      at org.python.core.PyMethod.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)
      at org.python.core.PyObject._jcallexc(Unknown Source)
      at org.python.core.PyObject._jcall(Unknown Source)
      at org.python.proxies.mvmodule$ManaStat$6.update(Unknown Source)
      at multiverse.mars.objects.MarsStatDef.update(MarsStatDef.java:44)
      at org.python.proxies.mvmodule$ManaMaxStat$5.super__update(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)
      at org.python.core.PyObject.invoke(Unknown Source)
      at org.python.pycode._pyx8.update$12(..\config\earth2.0\combat.py:100)
      at org.python.pycode._pyx8.call_function(..\config\earth2.0\combat.py)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyFunction.__call__(Unknown Source)
      at org.python.core.PyMethod.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)
      at org.python.core.PyObject._jcallexc(Unknown Source)
      at org.python.core.PyObject._jcall(Unknown Source)
      at org.python.proxies.mvmodule$ManaMaxStat$5.update(Unknown Source)
      at multiverse.mars.objects.MarsStatDef.update(MarsStatDef.java:44)
      at multiverse.mars.plugins.CombatPlugin$CombatPluginGenerateSubObjectHook.generateSubObject(CombatPlugin.java:175)
      at multiverse.server.engine.EnginePlugin$GenerateSubObjectHook.processMessage(EnginePlugin.java:1137)
      at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)
      at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)


Last edited by Tristan on Fri 24 Feb - 14:14; edited 1 time in total (Reason for editing : Added extract from mobserver.out log file)
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Mob Spawning   Sat 25 Feb - 6:15

I assuming you are using the stock mars engine in that case as I recall (from years ago) that if you are creating a mob with combat properties there is a list of properties that all of them must have
in your case I believe you are missing the Mana. I think it is related to the registerStats in combat.py
Back to top Go down
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Sat 25 Feb - 20:26

Ok, I've sorted that all out.

Next question - is there a way to change the animation of a factory output (if that makes sense)?

This is what I have:
Code:

class garrisonsoldierFactory (ObjectFactory):
    def makeObject(self, spawnData, instanceOid, loc):
        obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)
        garrisonLoc = InstanceClient.getMarkerPoint(instanceOid, "garrisonloc")
        behav = RadiusRoamBehavior()
        behav.setCenterLoc(garrisonLoc)
        behav.setRadius(40000)
        behav.setMovementSpeed(1000)
        obj.addBehavior(BaseBehavior())
        obj.addBehavior(behav)
        obj.addBehavior(CombatBehavior())
        return obj

ObjectFactory.register("garrisonsoldierFactory", garrisonsoldierFactory("Garrison Soldier Male"))

I tried to add:
Code:

behav.setAnimName("walk")
but it didn't work.

Any suggestions? Is it even possible?

Thanks
Back to top Go down
http://www.3dmodeller.info
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Sat 25 Feb - 21:26

Not to worry, I worked it out.

If anyone else wants to know, you need to do the following:

Add this line to your mob template in templates.py:
Code:

tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_RUN_THRESHOLD, Float(speed))
(where speed is what you want the running threshold to be - any speed above that will change the animation to run)

Then, in mobserver.py, put this into your mob's behaviour section:
Code:
behav.setMovementSpeed(1500)

Using the Zombie mob section from SampleWorld as an example:
Code:

class ZombieFactory (ObjectFactory):
    def makeObject(self, spawnData, instanceOid, loc):
   obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)
   zombieLoc = InstanceClient.getMarkerPoint(instanceOid, "zombiemarker")
   behav = PatrolBehavior()
   behav.addWaypoint(zombieLoc)
   behav.addWaypoint(loc)
        behav.setMovementSpeed(1500)
   obj.addBehavior(BaseBehavior())
   obj.addBehavior(behav)
   obj.addBehavior(CombatBehavior())
   return obj

ObjectFactory.register("ZombieFactory", ZombieFactory("Zombie"))


Hope that helps!
Back to top Go down
http://www.3dmodeller.info
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Sun 26 Feb - 16:14

I have just added a slightly more in-depth version to the Adding Mobs to Your World tutorial on the Wiki.
You can find the relevant section here:
Making the Mobs walk (Optional)
Back to top Go down
http://www.3dmodeller.info
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Sun 26 Feb - 21:16

Ok, so I'm getting that error from before, yet again. (Where mobs aren't spawning)

instance.out

Code:

ERROR [2012-02-26 10:09:42,006] Instance-2          ScriptManager.runPYFile: file=..\config\earth2.0/instance_load.py Traceback (innermost last):
  File "..\config\earth2.0/instance_load.py", line 18, in ?
multiverse.msgsys.RPCException(multiverse.server.util.MVRuntimeException in mobserver): activate failed

   at multiverse.mars.objects.SpawnGenerator.activate(SpawnGenerator.java:57)

   at multiverse.server.plugins.MobManagerPlugin$CreateSpawnGenHook.processMessage(MobManagerPlugin.java:174)

   at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)

   at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)

   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

   at java.lang.Thread.run(Unknown Source)

Caused by: multiverse.msgsys.RPCException(multiverse.msgsys.RPCException in mobserver)

   at multiverse.mars.objects.MarsObject.getDCMapping(MarsObject.java:77)

   at multiverse.mars.plugins.MarsInventoryPlugin.addDC(MarsInventoryPlugin.java:1293)

   at multiverse.mars.plugins.MarsInventoryPlugin.equipItem(MarsInventoryPlugin.java:1231)

   at multiverse.mars.plugins.MarsInventoryPlugin$CreateInventoryHook.processMessage(MarsInventoryPlugin.java:244)

   at multiverse.server.engine.EnginePlugin$SubObjectDepsReadyHook.processMessage(EnginePlugin.java:1519)

   ... 5 more


multiverse.msgsys.RPCException: multiverse.msgsys.RPCException(multiverse.server.util.MVRuntimeException in mobserver): activate failed
 Traceback (innermost last):
  File "..\config\earth2.0/instance_load.py", line 18, in ?
multiverse.msgsys.RPCException(multiverse.server.util.MVRuntimeException in mobserver): activate failed

   at multiverse.mars.objects.SpawnGenerator.activate(SpawnGenerator.java:57)

   at multiverse.server.plugins.MobManagerPlugin$CreateSpawnGenHook.processMessage(MobManagerPlugin.java:174)

   at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)

   at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)

   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

   at java.lang.Thread.run(Unknown Source)

Caused by: multiverse.msgsys.RPCException(multiverse.msgsys.RPCException in mobserver)

   at multiverse.mars.objects.MarsObject.getDCMapping(MarsObject.java:77)

   at multiverse.mars.plugins.MarsInventoryPlugin.addDC(MarsInventoryPlugin.java:1293)

   at multiverse.mars.plugins.MarsInventoryPlugin.equipItem(MarsInventoryPlugin.java:1231)

   at multiverse.mars.plugins.MarsInventoryPlugin$CreateInventoryHook.processMessage(MarsInventoryPlugin.java:244)

   at multiverse.server.engine.EnginePlugin$SubObjectDepsReadyHook.processMessage(EnginePlugin.java:1519)

   ... 5 more


multiverse.msgsys.RPCException: multiverse.msgsys.RPCException(multiverse.server.util.MVRuntimeException in mobserver): activate failed

      at org.python.core.Py.JavaError(Unknown Source)
      at org.python.core.Py.JavaError(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyReflectedFunction.__call__(Unknown Source)
      at org.python.core.PyObject.__call__(Unknown Source)
      at org.python.core.PyObject.invoke(Unknown Source)
      at org.python.pycode._pyx6.f$0(..\config\earth2.0/instance_load.py:18)
      at org.python.pycode._pyx6.call_function(..\config\earth2.0/instance_load.py)
      at org.python.core.PyTableCode.call(Unknown Source)
      at org.python.core.PyCode.call(Unknown Source)
      at org.python.core.Py.runCode(Unknown Source)
      at multiverse.server.engine.ScriptManager.runPYFile(ScriptManager.java:181)
      at multiverse.server.engine.ScriptManager.runFileWithThrow(ScriptManager.java:121)
      at multiverse.server.objects.Instance.runInitScript(Instance.java:91)
      at multiverse.server.plugins.InstancePlugin$CreateInstanceHook.processMessage(InstancePlugin.java:288)
      at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)
      at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

objmgr.out

Code:

ERROR [2012-02-26 10:09:41,990] Inventory-2          handleMessageImpl java.lang.NullPointerException java.lang.NullPointerException
      at multiverse.mars.objects.MarsObject.getDCMapping(MarsObject.java:77)
      at multiverse.mars.plugins.MarsInventoryPlugin.addDC(MarsInventoryPlugin.java:1293)
      at multiverse.mars.plugins.MarsInventoryPlugin.equipItem(MarsInventoryPlugin.java:1231)
      at multiverse.mars.plugins.MarsInventoryPlugin$CreateInventoryHook.processMessage(MarsInventoryPlugin.java:244)
      at multiverse.server.engine.EnginePlugin$SubObjectDepsReadyHook.processMessage(EnginePlugin.java:1519)
      at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)
      at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
DEBUG [2012-02-26 10:09:41,991] Inventory-2          sendResponse to objmgr,273 type=msgsys.RESPONSE id=279 class=multiverse.msgsys.ExceptionResponseMessage
DEBUG [2012-02-26 10:09:41,991] SelfMessage          SelfMessageHandler.handle pos=911
DEBUG [2012-02-26 10:09:41,992] SelfMessage          handleSelfMessage id=279 type=msgsys.RESPONSE class=multiverse.msgsys.ExceptionResponseMessage
ERROR [2012-02-26 10:09:41,992] ObjectManager-7      handleMessageImpl multiverse.msgsys.RPCException(java.lang.NullPointerException in objmgr) multiverse.msgsys.RPCException(java.lang.NullPointerException in objmgr)
      at multiverse.mars.objects.MarsObject.getDCMapping(MarsObject.java:77)
      at multiverse.mars.plugins.MarsInventoryPlugin.addDC(MarsInventoryPlugin.java:1293)
      at multiverse.mars.plugins.MarsInventoryPlugin.equipItem(MarsInventoryPlugin.java:1231)
      at multiverse.mars.plugins.MarsInventoryPlugin$CreateInventoryHook.processMessage(MarsInventoryPlugin.java:244)
      at multiverse.server.engine.EnginePlugin$SubObjectDepsReadyHook.processMessage(EnginePlugin.java:1519)
      at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:406)
      at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:440)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

New section from templates.py

Code:

#
        #Earth 2.0 Items
        #
        item = Template("Luna Welcome Pack")
        item.put(InventoryClient.ITEM_NAMESPACE, InventoryClient.TEMPL_ICON,
                "Interface\FantasyWorldIcons\ITEM_book_C")
        ObjectManagerClient.registerTemplate(item)

        item = Template("Citizen Tablet")
        item.put(InventoryClient.ITEM_NAMESPACE, InventoryClient.TEMPL_ICON,
                "Interface\FantasyWorldIcons\ITEM_book_A")
        ObjectManagerClient.registerTemplate(item)

        #
        #Earth 2.0 Weapons
        #

        dc = DisplayContext("settler_pistol.mesh")
        dc.setAttachInfo(DisplayState.IN_COMBAT, MarsEquipSlot.PRIMARYWEAPON, MarsAttachSocket.PRIMARYWEAPON)
        dc.setAttachInfo(DisplayState.NON_COMBAT, MarsEquipSlot.PRIMARYWEAPON, MarsAttachSocket.PRIMARYWEAPON)
        dcMap = DCMap()
        dcMap.add(garrison_soldier_male_base_DC, dc)

        tmpl = Template("Settler Pistol")

        tmpl.put(InventoryClient.ITEM_NAMESPACE, InventoryClient.TEMPL_ICON,
                "Interface\Earth2-0Icons\WEAPON_settlerpistol")
        tmpl.put(InventoryClient.ITEM_NAMESPACE, InventoryClient.TEMPL_ACTIVATE_HOOK, EquipActivateHook())
        tmpl.put(InventoryClient.ITEM_NAMESPACE, InventoryClient.TEMPL_EQUIP_INFO, equipInfo)
        tmpl.put(InventoryClient.ITEM_NAMESPACE, InventoryClient.TEMPL_DCMAP, dcMap)
        ObjectManagerClient.registerTemplate(tmpl)
     
        #
        #Earth 2.0 Characters
        #
       

        tmpl = Template("Garrison Soldier Male")
        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_DISPLAY_CONTEXT, garrison_soldier_male_base_DC)
        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_OBJECT_TYPE, ObjectTypes.mob)
        tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS,
                "*Leather Tunic; *Leather Pants; *Leather Boots")
        tmpl.put(TrainerClient.NAMESPACE, "skills", "Sword;Axe;Dagger;First Aid")
        tmpl.put(CombatClient.NAMESPACE, "istrainer", Boolean(True))
        tmpl.put(CombatClient.NAMESPACE, "strength", MarsStat("strength", 160))
        tmpl.put(CombatClient.NAMESPACE, "dexterity", MarsStat("dexterity", 160))
        tmpl.put(CombatClient.NAMESPACE, "wisdom", MarsStat("wisdom",160))
        tmpl.put(CombatClient.NAMESPACE, "intelligence", MarsStat("intelligence", 160))
        tmpl.put(CombatClient.NAMESPACE, "stamina", MarsStat("stamina", int(int(160)*1.5)))
        tmpl.put(CombatClient.NAMESPACE, "stamina-max", MarsStat("stamina-max", int(int(160)*1.5)))
        tmpl.put(CombatClient.NAMESPACE, "mana", MarsStat("mana", int(160)*2))
        tmpl.put(CombatClient.NAMESPACE, "mana-max", MarsStat("mana-max", int(160)* 2))
        tmpl.put(CombatClient.NAMESPACE, "health", MarsStat("health", int(160) * 2))
        tmpl.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", int(160)*2))
        tmpl.put(CombatClient.NAMESPACE, "experience", MarsStat("experience", 0))
        tmpl.put(CombatClient.NAMESPACE, "level", MarsStat("level", 25))
        tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_AUTOATTACK_ABILITY, "attack ability")
        tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_REGEN_EFFECT, "regen effect")
        tmpl.put(CombatClient.NAMESPACE, "attackable", Boolean(False))
        tmpl.put(CombatClient.NAMESPACE, "combat.mobflag", Boolean(True))
        tmpl.put(CombatClient.NAMESPACE, "kill_exp", 20);
        ObjectManagerClient.registerTemplate(tmpl)

        tmpl = Template("Citizen Bureau Guide")

        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_DISPLAY_CONTEXT, human_female_base_DC)
        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_OBJECT_TYPE, ObjectTypes.mob)
        tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_RUN_THRESHOLD, Float(5000))
        tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS,"*Leather Boots; *Leather Pants; *Leather Belt")
        tmpl.put(TrainerClient.NAMESPACE, "skills", "First Aid")
        tmpl.put(CombatClient.NAMESPACE, "istrainer", Boolean(True))
        tmpl.put(CombatClient.NAMESPACE, "strength", MarsStat("strength", 60))
        tmpl.put(CombatClient.NAMESPACE, "dexterity", MarsStat("dexterity", 60))
        tmpl.put(CombatClient.NAMESPACE, "wisdom", MarsStat("wisdom", 60))
        tmpl.put(CombatClient.NAMESPACE, "intelligence", MarsStat("intelligence", 60))
        tmpl.put(CombatClient.NAMESPACE, "stamina", MarsStat("stamina", int(int(60)*1.5)))
        tmpl.put(CombatClient.NAMESPACE, "stamina-max", MarsStat("stamina-max", int(int(60)*1.5)))
        tmpl.put(CombatClient.NAMESPACE, "mana", MarsStat("mana", int(60)*2))
        tmpl.put(CombatClient.NAMESPACE, "mana-max", MarsStat("mana-max", int(60)* 2))
        tmpl.put(CombatClient.NAMESPACE, "health", MarsStat("health", int(60) * 2))
        tmpl.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", int(60)*2))
        tmpl.put(CombatClient.NAMESPACE, "experience", MarsStat("experience", 0))
        tmpl.put(CombatClient.NAMESPACE, "level", MarsStat("level", 2))
        tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_AUTOATTACK_ABILITY, "attack ability")
        tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_REGEN_EFFECT, "regen effect")
        tmpl.put(CombatClient.NAMESPACE, "attackable", Boolean(False))
        tmpl.put(CombatClient.NAMESPACE, "combat.mobflag", Boolean(True))
        tmpl.put(CombatClient.NAMESPACE, "kill_exp", 20);
        ObjectManagerClient.registerTemplate(tmpl)

        #
        #Earth 2.0 Teleporters
        #

        tmpl = Template("Teleporter")

        tmpl.put(WorldManagerClient.NAMESPACE,
        WorldManagerClient.TEMPL_DISPLAY_CONTEXT,
        DisplayContext("tiny_cube.mesh"))
        tmpl.put(WorldManagerClient.NAMESPACE,
        WorldManagerClient.TEMPL_OBJECT_TYPE,
        ObjectTypes.mob)
        tmpl.put(WorldManagerClient.NAMESPACE,
        WorldManagerClient.TEMPL_NAME,"")
        ObjectManagerClient.registerTemplate(tmpl)

mobserver.py

Code:


from multiverse.mars import *
from multiverse.mars.core import *
from multiverse.mars.objects import *
from multiverse.mars.util import *
from multiverse.mars.plugins import *
from multiverse.mars.behaviors import *
from multiverse.msgsys import *
from multiverse.server.math import *
from multiverse.server.plugins import *
from multiverse.server.objects import *
from multiverse.server.engine import *
from multiverse.server.util import *
from java.lang import *


class garrisonsoldierFactory (ObjectFactory):
    def makeObject(self, spawnData, instanceOid, loc):
        obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)
        garrisonLoc = InstanceClient.getMarkerPoint(instanceOid, "garrisonmarker")
        behav = RadiusRoamBehavior()
        behav.setCenterLoc(garrisonLoc)
        behav.setRadius(40000)
        behav.setMovementSpeed(1500)
        obj.addBehavior(BaseBehavior())
        obj.addBehavior(behav)
        obj.addBehavior(CombatBehavior())
        return obj

ObjectFactory.register("garrisonsoldierFactory", garrisonsoldierFactory("Garrison Soldier Male"))


class citizenguideFactory (ObjectFactory):
    def makeObject(self, spawnData, instanceOid, loc):
        obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)
        guideLoc = InstanceClient.getMarkerPoint(instanceOid, "guidemarker")
        behav = QuestBehavior()
        behav.startsQuest(tabletQuest)
        behav.endsQuest(tabletQuest)
        obj.addBehavior(behav)
        return obj

ObjectFactory.register("citizenguideFactory", citizenguideFactory("Human Female Leather"))



class Tele1Factory (ObjectFactory):
    def makeObject(self, spawnData, instanceOid, loc):
        # this binds the object
        obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)

        tele1Dest = InstanceClient.getMarkerPoint(instanceOid, "dest_marker")
        # add behavior
        behav = TeleporterBehavior()
        behav.setRadius(2000)
        behav.setDestination(tele1Dest)
        obj.addBehavior(behav)
        return obj

ObjectFactory.register("Tele1Factory", Tele1Factory("Teleporter"))


#
#Earth 2.0 Quests
#
welcomeQuest = MarsCollectionQuest()
welcomeQuest.setName("Welcome to Luna")
welcomeQuest.setDesc("Welcome to the new frontier, Citizen. I'm sure you have lots of questions - go and speak to the Citizen Bureau Guide over there.")
welcomeQuest.setObjective("Talk to the Guide.")


tabletQuest = MarsCollectionQuest()
tabletQuest.setName("The Citizen Burea Guide")
tabletQuest.setDesc("QUEST DIALOGUE GOES HERE")
tabletQuest.setObjective("Read the Luna Welcome Pack on your new Citizen Tablet")
tabletQuest.addQuestPrereq("Welcome to Luna")
tabletQuest.addDeliveryItem("Citizen Tablet")


Log.debug("done with mobserver.py")


instance.py

Code:



from java.lang import Long
from multiverse.server.plugins import *
from multiverse.server.objects import *

instance = Instance.current()
instanceOid = Instance.currentOid()

garrisonLoc = instance.getMarker("garrisonmarker").clone()
garrisonLoc.getPoint().setY(0)
spawnData = SpawnData()
spawnData.setFactoryName("garrisonsoldierFactory")
spawnData.setInstanceOid(Long(instanceOid))
spawnData.setLoc(garrisonLoc.getPoint())
spawnData.setNumSpawns(4)
spawnData.setSpawnRadius(40000)
spawnData.setRespawnTime(1000)
MobManagerClient.createSpawnGenerator(spawnData)

guidemarker = instance.getMarker("guidemarker").clone()
guidemarker.getPoint().setY(0)
spawnData = SpawnData()
spawnData.setFactoryName("citizenguideFactory")
spawnData.setInstanceOid(Long(instanceOid))
spawnData.setLoc(guidemarker.getPoint())
spawnData.setNumSpawns(1)
spawnData.setSpawnRadius(0)
spawnData.setRespawnTime(1000)
MobManagerClient.createSpawnGenerator(spawnData)

tele1Loc = instance.getMarker("origin_marker").getPoint()
tele1Dest = instance.getMarker("dest_marker").getPoint()
spawnData = SpawnData()
spawnData.setFactoryName("Tele1Factory")
spawnData.setInstanceOid(Long(instanceOid))
spawnData.setLoc(tele1Loc)
spawnData.setNumSpawns(1)
spawnData.setSpawnRadius(0)
spawnData.setRespawnTime(1000)
spawnData.setCorpseDespawnTime(0)
MobManagerClient.createSpawnGenerator(spawnData)



What's going on?!

I can't believe it is so hard to add mobs, seriously!


Tristan
Back to top Go down
http://www.3dmodeller.info
zoot686
Foundation Donor
avatar

Posts : 78
Join date : 2012-02-15
Location : USA

PostSubject: Re: Mob Spawning   Mon 27 Feb - 12:27

yeah drag n' drop meshes and textures into a folder and quick edit of a text list defining name and number of mobs and their location would be nice.*grins*

Back to top Go down
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Mob Spawning   Mon 27 Feb - 12:55

It looks like there is a problem in the InventoryPlugin namely when equipping the items that you have the template is requesting to be equipped
Code:
tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS,
                "*Leather Tunic; *Leather Pants; *Leather Boots")
The stars here tell the server to equip those items when the object is created. It doesnt look like these are in your template.py they might be in another file if they are let me know and we can try to trace the problem.
Back to top Go down
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Mon 27 Feb - 19:46

zoot686 wrote:
yeah drag n' drop meshes and textures into a folder and quick edit of a text list defining name and number of mobs and their location would be nice.*grins*


Yeh, that's exactly what we need!
I'm going to start looking into creating some sort of visual Mob Creator tool (similar to the asset importer) where you define the locations of the mob files, and then just type in:
Template: Name, Inventory items, Stats, Combat Y/N, Attackable Y/N, Trainer Y/N (then define skills)
Mobserver: Combat Behaviour (then the various settings for roam radius, patrol waypoints etc) or Quest Name (End Quest X, Start Quest X, End Quest X (if that makes sense))
Instance_load: Location/Marker, Factory Name, NumSpawns, SpawnRadius, RespawnTime

and so on.

A Quest creator might be good as well, working along the same principles (minus the Template and Instance_load of course). Though saying that, defining quests is pretty easy, so probably isn't worth the effort.

Thoughts?


delurin wrote:
It looks like there is a problem in the InventoryPlugin namely when equipping the items that you have the template is requesting to be equipped
Code:
tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS,
                "*Leather Tunic; *Leather Pants; *Leather Boots")
The stars here tell the server to equip those items when the object is created. It doesnt look like these are in your template.py they might be in another file if they are let me know and we can try to trace the problem.

Now that you mention it, I don't think I've defined the human_male.mesh submeshes, like clothing, whereas human_female has them defined by default. As you say, that's probably causing the problem. I don't think the Male ones have been defined anywhere, in fact. When I get back to working on the project tonight, I'll check that out.

Thanks Very Happy
Back to top Go down
http://www.3dmodeller.info
Tristan
Administrator
Administrator
avatar

Posts : 306
Join date : 2011-08-03
Location : Liverpool, UK

PostSubject: Re: Mob Spawning   Sun 11 Mar - 22:31


In the World Editor, there's a section of the properties where you can define mob behaviours - can that be used to create individual mobs?

I think that it would be much easier, especially if you're only creating one character, to just be able to add the character model, then give it a behaviour to walk around. You could then define inventory by just stating the object's template name, and so on.
Back to top Go down
http://www.3dmodeller.info
Delurin
Head of Platform Development


Posts : 424
Join date : 2011-08-03

PostSubject: Re: Mob Spawning   Mon 12 Mar - 1:45

I have tried to use that but I dont think it is very customizable. I usually just end up spawning them in on instance load
Back to top Go down
Sponsored content




PostSubject: Re: Mob Spawning   

Back to top Go down
 
Mob Spawning
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Moga Village Forecast
» gidbinn npt spawning help? do i have to make new char?
» [BUG] Awkward spawning
» Breaking News: About spawning, respawning and spawnkill
» [BUG] Cazadore nests spawning in the sky

Permissions in this forum:You cannot reply to topics in this forum
 :: Development :: Client Scripting and Development-
Jump to: