Game Development Community

C coding question?

by Tim Heldna · in Torque Game Engine · 05/01/2005 (8:47 am) · 5 replies

I have a coding question..

Im in the projectile.cc script.
I want an effect to occur only to the player's bullets not eveyone
else's. I have got this effect to work but I occurs every time a bullet is fired
from any player or bot.

I found a function called isControlObject() in the player.cc script that may be the one I need , but how can I acess it in the projectile script?

I'm still learning with scripting so any help would be great!

#1
05/01/2005 (10:42 am)
The projectile trackes, I believe, who its owner is. That might be a good way to check - compare the owner with the player on this system.

Or just have the packUpdate pack a flag if the server is packing it to the owning player... Then the player doesn't have to know anything.
#2
05/01/2005 (11:30 am)
Sounds like a simple binary (true/false) applied to that player instance to me. But I wouldn't know because I'm lost in where or how to code anything in TGE. Oh well...
#3
05/01/2005 (7:23 pm)
I'm sure you'll figure it out in time. :)
#4
05/01/2005 (9:32 pm)
I worked it out... I was doing it in the onAdd() function, and I thought I could
somehow reference the player camera,big waste of time.

Instead I used the getUpdatePriority() function which checks if the one who shot the round is the camera.
Worked like a charm.
#5
05/01/2005 (10:02 pm)
That works... I'd have done it in packUpdate. Since packUpdate has the GameConnection it can easily tell who the player is and make determinations there.