|
| spawn issues | |
| | Author | Message |
---|
AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: spawn issues Mon 24 Jun - 10:55 | |
| So following the tutorial in the wiki about adding mobs to a world, I have followed it to a T.
Upon server restart to test it out, the server fails with the code provided in the tutorial and does so with out any errors in the logs.
Ok , next step, comment out all of MY code, and try to spawn a wolf mob,
server starts, however, in the game, at the location the spawn marker is placed, NO WOLVES.
Ok, next step, comment out : wolfMarker.setY(0)
so it would force the spawn generator to use all 3 (x,y,z) coords from the spawn marker placed in world builder.
restart server, login, NO WOLVES.
There are no errors in the logs so I am assumeing the spawns are happening ..........somewhere.... but I have no clue where they may be or if they are acculy spawning. | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Mon 24 Jun - 11:51 | |
| Upon Further inspection of the logs I have this in Instance.out: - Code:
-
ERROR [2013-06-23 20:28:08,545] Instance-2 ScriptManager.runPYFile: file=../config/sampleworld/instance_load.py Traceback (innermost last): File "../config/sampleworld/instance_load.py", line 21, 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:424) at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:458) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) Caused by: multiverse.msgsys.RPCException(org.python.core.PyException in mobserver) at org.python.core.Py.AttributeError(Unknown Source) at org.python.core.PyObject.noAttributeError(Unknown Source) at org.python.core.PyObject.__getattr__(Unknown Source) at org.python.core.PyObject.invoke(Unknown Source) at org.python.pycode._pyx10.makeObject$2(../config/sampleworld/mobserver.py:25) at org.python.pycode._pyx10.call_function(../config/sampleworld/mobserver.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$WolfFactory$0.makeObject(Unknown Source) at multiverse.mars.objects.SpawnGenerator.spawnObject(SpawnGenerator.java:108) at multiverse.mars.objects.SpawnGenerator.activate(SpawnGenerator.java:53) ... 6 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/sampleworld/instance_load.py:21) at org.python.pycode._pyx6.call_function(../config/sampleworld/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:129) at multiverse.server.plugins.InstancePlugin$CreateInstanceHook.createInstance(InstancePlugin.java:379) at multiverse.server.plugins.InstancePlugin$CreateInstanceHook.handleMessage(InstancePlugin.java:222) at multiverse.server.plugins.InstancePlugin$CreateInstanceHook.processMessage(InstancePlugin.java:216) at multiverse.server.engine.EnginePlugin.handleMessageImpl(EnginePlugin.java:424) at multiverse.server.engine.EnginePlugin$QueuedMessage.run(EnginePlugin.java:458) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) ERROR [2013-06-23 20:28:08,545] Instance-2 CreateInstanceHook: init world script failed fileName=../config/sampleworld/instance_load.py
Any Input on this? | |
| | | Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: spawn issues Tue 25 Jun - 2:55 | |
| Usually there is also an error in either the objmgr.out or the mobserver.out when you have an activate failed error. Can you post your instance_load.py or at least everything to line 21 and the factory and template it references. | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Tue 25 Jun - 6:30 | |
| instance_load.py - Code:
-
from java.lang import Long from multiverse.server.plugins import * from multiverse.server.objects import *
instance = Instance.current() instanceOid = Instance.currentOid()
wolfMarker = instance.getMarker("wolfmarker").clone() wolfMarker.getPoint().setY(0) spawnData = SpawnData() spawnData.setFactoryName("WolfFactory") spawnData.setInstanceOid(Long(instanceOid)) spawnData.setLoc(wolfMarker.getPoint()) spawnData.setNumSpawns(3) spawnData.setSpawnRadius(2) spawnData.setRespawnTime(60000) spawnData.setCorpseDespawnTime(30000) MobManagerClient.createSpawnGenerator(spawnData) and the Wolf template from templates.py: - Code:
-
# # Wolf Template # tmpl = Template("Wolf") tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_DISPLAY_CONTEXT, DisplayContext("wolf.mesh", True)) tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_OBJECT_TYPE, ObjectTypes.mob) tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS, "Wolf Skin; Wolf Bones") tmpl.put(CombatClient.NAMESPACE, "strength", MarsStat("strength", 20)) tmpl.put(CombatClient.NAMESPACE, "dexterity", MarsStat("dexterity", 20)) tmpl.put(CombatClient.NAMESPACE, "wisdom", MarsStat("wisdom", 20)) tmpl.put(CombatClient.NAMESPACE, "intelligence", MarsStat("intelligence", 20)) tmpl.put(CombatClient.NAMESPACE, "stamina", MarsStat("stamina", int(int(20)*1.5))) tmpl.put(CombatClient.NAMESPACE, "stamina-max", MarsStat("stamina-max", int(int(20)*1.5))) tmpl.put(CombatClient.NAMESPACE, "mana", MarsStat("mana", int(20)*2)) tmpl.put(CombatClient.NAMESPACE, "mana-max", MarsStat("mana-max", int(20)* 2)) tmpl.put(CombatClient.NAMESPACE, "health", MarsStat("health", int(20) * 2)) tmpl.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", int(20)*2)) tmpl.put(CombatClient.NAMESPACE, "experience", MarsStat("experience", 0)) tmpl.put(CombatClient.NAMESPACE, "level", MarsStat("level", 1)) 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", 10); tmpl.put(WorldManagerClient.NAMESPACE, "clickCommand", "/click") ObjectManagerClient.registerTemplate(tmpl) Also here is my code from the tutorial: Code in Templates.py - Code:
-
"""#Human Female Fighter ----------------------DARK FRONTIER ONLINE tmpl = Template("Human Female Fighter") tmpl.put(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_DISPLAY_CONTEXT, human_female_plate_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(WorldManagerClient.NAMESPACE, WorldManagerClient.TEMPL_RUN_THRESHOLD, Float(speed)) tmpl.put(InventoryClient.NAMESPACE, InventoryClient.TEMPL_ITEMS, "*sword7") tmpl.put(CombatClient.NAMESPACE, "health-max", MarsStat("health-max", 100)) tmpl.put(CombatClient.NAMESPACE, "health", MarsStat("health", 100)) tmpl.put(CombatClient.NAMESPACE, "mana-max", MarsStat("mana-max", 100)) tmpl.put(CombatClient.NAMESPACE, "mana", MarsStat("mana", 100)) tmpl.put(CombatClient.NAMESPACE, CombatInfo.COMBAT_PROP_AUTOATTACK_ABILITY, "attack ability") tmpl.put(CombatClient.NAMESPACE, "attackable", Boolean(True)) tmpl.put(CombatClient.NAMESPACE, "combat.mobflag", Boolean(True)) tmpl.put(WorldManagerClient.NAMESPACE, "clickCommand", "/click") ObjectManagerClient.registerTemplate(tmpl) """ Code in mobserver.py - Code:
-
"""class Hf_fighterFactory (ObjectFactory): def makeObject(self, spawnData, instanceOid, loc): obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc) behav.setMovementSpeed(1500) obj.addBehavior(behav) obj.addBehavior(CombatBehavior()) return obj
ObjectFactory.register("Hf_fighterFactory", Hf_fighterFactory("Human Female Leather"))"""
And code in instance_load.py - Code:
-
"""#----------------------------------DARK FRONTIER ONLINE hf_fighterLoc = instance.getMarker("hfmarker").getPoint().clone() hf_fighterLoc.setY(0) hf_fighterLoc = Point(247759, 20000, 423182) spawnData = SpawnData() spawnData.setFactoryName("Hf_fighterFactory") spawnData.setInstanceOid(Long(instanceOid)) spawnData.setLoc(hf_fighterLoc) spawnData.setNumSpawns(1) spawnData.setSpawnRadius(1) spawnData.setRespawnTime(60000) spawnData.setCorpseDespawnTime(100) MobManagerClient.createSpawnGenerator(spawnData)""" I have noticed the y coordnate for my spawn marker ( wolfmarker in this case ) is at 20000, I basicly started a freash world and saved it as sampleworld for simplicity till I get alot more complex stuff in my world lol so I usualy set y to match so it will acculy be in the right place, and I tested it by making it a particle fountain so I would know the spawn generator was showing up | |
| | | Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: spawn issues Tue 25 Jun - 6:39 | |
| Do you have a WolfFactory it should be in mobserver.py
you should also check that you have a marker wolfmarker but I am pretty sure that gives a nonetype error and not the error you are getting.
For the commented out problem do you have a marker named hfmarker in the world file that is calling the instance_load.py? you can probably comment that out since you are immediately replacing it with a hard coded location but it will still fail if it is missing. | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Tue 25 Jun - 6:48 | |
| One more thing, Python is an Interpreted language so if any changes I make are in python does it really require a server restart to take effect? and yes, forgot to post it lol - Code:
-
class WolfFactory (ObjectFactory): def makeObject(self, spawnData, instanceOid, loc): obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc)
wolfLoc = InstanceClient.getMarkerPoint(instanceOid, "wolfmarker") # add behavior behav = RadiusRoamBehavior() behav.setCenterLoc(wolfLoc) behav.setRadius(20000) obj.addBehavior(BaseBehavior()) obj.addBehavior(behav) obj.addBehavior(CombatBehavior()) return obj | |
| | | Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: spawn issues Tue 25 Jun - 6:55 | |
| Yes you do have to restart the server. You can write some ways to add mobs without using the python if you want to. For our game we have a mob creator that I can use to add a new mob in game that goes live in memory and I can edit and it saves the loading information to file so that when I reset the server it loads from the file instead. Reduces the number of resets while allowing for out of game editing and transferring/duplicating if need be. | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Tue 25 Jun - 6:57 | |
| Oh boy, I feel like a dufus lol
I checked objmgr.out and found the problem, There was one line of my added code I missed with the comment tag that was causing a syntax error. Fixed the comment and presto, wolves spawning as expected lol
Now I will go through and see if my code has a simple issue like that lol which it probably does .
EDIT:: ^ that sounds nifty lol , axiom used Ironpython but I am wandering how hard it would be to replace thet with stackless python. meh, something I am thinking about when I accully start looking at maybe implementing Irrlicht engine or straight up ogre3d
Last edited by AthlonJedi on Tue 25 Jun - 7:01; edited 1 time in total | |
| | | Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: spawn issues Tue 25 Jun - 7:00 | |
| You may have missed a line in posting or you are missing a line in the file but there should be a line where you register the factory. - Code:
-
ObjectFactory.register("WolfFactory", WolfFactory("Wolf")) And you should double check the wolfmarker I am not sure what the error of - Code:
-
wolfLoc = InstanceClient.getMarkerPoint(instanceOid, "wolfmarker") would be I would think the same nonetype but I dont really use the command so I can not say for sure (I generally just use the passed in loc from the makeObject but there might be times when this is not what you want to do.) | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Tue 25 Jun - 7:02 | |
| it was a syntax error, see post above lol
I have that line also, Just missed it in copy/paste but its at the end of the section where it is suposed to be lol | |
| | | Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: spawn issues Tue 25 Jun - 7:18 | |
| The server uses jython and you can reload the scripts stored in the interface directory using /reloadui it is not perfect since it does not resend requests to the server but you can modify it to fix that. You could also probably modify it to reload the scripts in the scripts directory but I dont know what side effects that would cause.
In reality you could also modify the server to reload the files when they change but it would probably be more of a pain than it is worth since you would have to figure out which ones are new, compare the old ones and then remove the old mobs/objects whatever and respawn them. I could see having a command to remove and reload a world file so that you can make changes and not have to take the server down and instead create a new instance of the world transfer all of the characters in that world file/instance to the new one and then remove the old one. That wouldnt be to hard to implement if you want to work on it let me know. | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Tue 25 Jun - 7:43 | |
| That would make the platform a little easier to deal with for new devs once they get past initial setup, to me its just a matter of convienence as my server box sits right behind me lol but for those using a VPS it may make things a little easier for them.
I might throw that on my pile of stuff to do soon, but for now, I have to finish "cleaning " the code for all the sites, Get the new Vhost up and online so we can transition the sites transparenly, work on my project some.. work on the platform a bit lol got plenty to accomplish in the next week or so. | |
| | | AthlonJedi Administrator
Posts : 213 Join date : 2012-07-19 Location : Walkerton, Indiana
| Subject: Re: spawn issues Tue 25 Jun - 10:06 | |
| ok got my spawn code to work with one exception, when I go to kill the spawn i get "That object has no action" in the chat. BUT I copied the behaviors from the wolf spawn and I can kill those just fine lol Here is the code in mobserver.py - Code:
-
class Hf_fighterFactory (ObjectFactory): def makeObject(self, spawnData, instanceOid, loc): obj = ObjectFactory.makeObject(self, spawnData, instanceOid, loc) hfFighterLoc = InstanceClient.getMarkerPoint(instanceOid, "hfmarker") behav = RadiusRoamBehavior() behav.setCenterLoc(hfFighterLoc) behav.setRadius(20000) obj.addBehavior(BaseBehavior()) obj.addBehavior(behav) obj.addBehavior(CombatBehavior()) return obj once again I have no errors what so ever in any of the server logs, I even deleted all the logs and restarted the server 3 times and checked all the logs, ^obj.addBehavior(CombatBehavior()) above *Should* make the spawn a combatant , but for some reason the behavior is not being added to the spawn lol | |
| | | Sponsored content
| Subject: Re: spawn issues | |
| |
| | | | spawn issues | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |