Game Development Community

IncInventory() too slow!!!

by Stephen Clark · in Torque Game Engine · 08/14/2003 (1:17 pm) · 3 replies

I am doing something in my game where I want the player to only be able to have x number of projectiles out (fired) at a time. I set my inventory to x, and of course it decrements just fine, but the problem is that in onCollision I put in something like (sorry, not in front of my PC right now)

%obj.client.Player.incInventory(RifleAmmo,1);

And this works just fine, I have x ammount out at a time, but it doesnt update quickly enough for my tastes...

Any Ideas?

Thanks,

-s

#1
08/14/2003 (11:13 pm)
Do it in C++; it'll be faster :)

I think that incInventory involves a remote call, which means that you have to wait for a round trip across the network before your projectile count goes up. If you can find a way to avoid this trip (or fake it, assuming it will work) you'll be golden.
#2
08/17/2003 (5:14 pm)
Stephen,
I wanted something similar, so when a client connects I create a group in script (under MissionCleanup) with the client number as part of the group name. When a projectile is fired, I add it to the client's group, and then I use the group.count() rather than using inventory to set ammo states. It works fairly quickly.
#3
08/18/2003 (2:20 pm)
Thanks for the suggestions peeps!

gracias,

-s