| Projectile: Server/Client update SOLVED (NOT A BUG) | |
|
|
Author | Message |
---|
Guest Guest
| Subject: Projectile: Server/Client update SOLVED (NOT A BUG) Sat 15 Sep - 3:40 | |
| Currently the implementation in TestProjectile.py doesn't seem to update the server or other clients with an animation in SampleWorld so there is no animation in the target's client. Only a test I know but thought the behavior would already be there. Projectile script needs to update the server so it can update the target's client to run an animation. Time to get my hands dirty. If someone wants to see this in Sampleworld 1) Open 2 clients and connect them to your server 2) Ctrl-Alt-P to fire projectile at a target, not just any mesh since the projectile is fired at the target's socket. The key assignments are in: \SampleAssets\sampleworld\Interface\FrameXML\Bindings.txtWorking with Effects: http://www.multiversemmo.com/wiki/Coordinated_Effects_Example_-_FireballCheers
Last edited by Koron on Fri 21 Sep - 8:19; edited 1 time in total |
|
| |
Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) Sat 15 Sep - 6:28 | |
| That is intentional. It was a test just to see how you would implement a projectile. If you want to have all the players see it you need to send a command to the server. You could make a real simple one by adding - Code:
-
class ProjectileCommand (ProxyPlugin.CommandParser): def parse(self, cmdEvent): playerOid = cmdEvent.getObjectOid() targetOid = cmdEvent.getTarget() projectilemsg= AnimationClient.InvokeEffectMessage(playerOid, "TestProjectile") projectilemsg.setProperty("targetOID", targetOid) projectilemsg.setProperty("sourceOID", playerOid) Engine.getAgent().sendBroadcast(projectilemsg)
proxyPlugin.registerCommand("/projectile", ProjectileCommand()) to extension proxy | |
|
| |
Guest Guest
| Subject: As always Sat 15 Sep - 10:49 | |
| Thanks Delurin! Will post when I get it to work. Now it's off to play games. Cheers |
|
| |
Guest Guest
| Subject: Cast to Long() Fri 21 Sep - 8:31 | |
| |
|
| |
Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) Fri 21 Sep - 8:37 | |
| Sorry I think I add a long() conversion for every effect and forgot that it wasnt standard | |
|
| |
Guest Guest
| Subject: Pointed me in the right dir though Fri 21 Sep - 9:24 | |
| Not a problem. You pointed me in the right direction. I gotta learn this stuff anyway and that made me dig through stuff more than I would've. |
|
| |
Guest Guest
| Subject: Key bindings Sat 22 Sep - 7:10 | |
| And in Bindings.xml changed the key binding to use my /fireball Changed - Code:
-
<Binding name="PROJECTILETEST" header="ACTIONS"> ClientAPI.InvokeEffect("TestProjectile", ClientAPI.GetLocalOID(), {'targetOID': MarsTarget.GetCurrentTarget().OID, 'sourceOID':ClientAPI.GetPlayerObject().OID}) </Binding>
To - Code:
-
<Binding name="PROJECTILETEST" header="ACTIONS"> ClientAPI.Network.SendTargetedCommand(MarsTarget.GetCurrentTarget().OID, "/fireball") </Binding> This is too much fun. |
|
| |
rotello Super Contributor
Posts : 215 Join date : 2012-12-06
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) Thu 28 Mar - 20:28 | |
| Hey Koron, I'm also getting a BigInteger error log and have no clue where to set long OIDs. Do you have a sample file(s) that I can check out? | |
|
| |
Delurin Head of Platform Development
Posts : 424 Join date : 2011-08-03
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) Fri 29 Mar - 0:20 | |
| Basically in effect files when you execute the effect you should cast to long just to make sure (it doesnt take much processing power so its better just to be safe) - Code:
-
def ExecuteEffect(self, targetOID, sourceOID): # convert the object IDs sent from the server to the actual WorldObjects target = ClientAPI.World.GetObjectByOID(long(targetOID)) caster = ClientAPI.World.GetObjectByOID(long(sourceOID)) this function requires longs - Code:
-
ClientAPI.World.GetObjectByOID(variableName) so just add a long() to it - Code:
-
ClientAPI.World.GetObjectByOID(long(variableName)) And that should fix your problem | |
|
| |
rotello Super Contributor
Posts : 215 Join date : 2012-12-06
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) Fri 29 Mar - 1:37 | |
| Thanks Delurin, I will try that out. | |
|
| |
rotello Super Contributor
Posts : 215 Join date : 2012-12-06
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) Sat 30 Mar - 18:20 | |
| Still no luck, I have modified the TestProjectile.py lines 32 - 33 below - Code:
-
target = ClientAPI.World.GetObjectByOID(long(targetOID)) caster = ClientAPI.World.GetObjectByOID(long(sourceOID))
Added this set of code to extension_proxy.py: - Code:
-
class ProjectileCommand (ProxyPlugin.CommandParser): def parse(self, cmdEvent): playerOid = cmdEvent.getObjectOid() targetOid = cmdEvent.getTarget() projectilemsg= AnimationClient.InvokeEffectMessage(playerOid, "TestProjectile") projectilemsg.setProperty("targetOID", targetOid) projectilemsg.setProperty("sourceOID", playerOid) Engine.getAgent().sendBroadcast(projectilemsg)
proxyPlugin.registerCommand("/projectile", ProjectileCommand()) And set Bindings.xml to Koron's code (Note that he used /fireball instead of /projectile which is the correct and registered command above - Code:
-
<Binding name="PROJECTILETEST" header="ACTIONS"> ClientAPI.Network.SendTargetedCommand(MarsTarget.GetCurrentTarget().OID, "/projectile") </Binding>
This is the error log I'm getting... - Code:
-
ERROR [2013-03-30 15:25:20,169] SQ-Message-4 SQ MessageCallback multiverse.server.util.MVRuntimeException: MVByteBuffer.putEncodedObject: no support for object of class class java.math.BigInteger at multiverse.server.network.MVByteBuffer.putEncodedObject(MVByteBuffer.java:496) at multiverse.server.network.MVByteBuffer.putPropertyMap(MVByteBuffer.java:646) at multiverse.mars.plugins.AnimationClient$InvokeEffectMessage.toBuffer(AnimationClient.java:130) at multiverse.server.plugins.ProxyPlugin$InvokeEffectHook.processMessage(ProxyPlugin.java:2182) at multiverse.server.plugins.ProxyPlugin$MessageCallback.doWork(ProxyPlugin.java:727) at multiverse.server.util.SQThreadPool.run(SQThreadPool.java:106) at java.lang.Thread.run(Thread.java:722) Am I still missing something here? | |
|
| |
Sponsored content
| Subject: Re: Projectile: Server/Client update SOLVED (NOT A BUG) | |
| |
|
| |
| Projectile: Server/Client update SOLVED (NOT A BUG) | |
|