Game Development Community

Get Mounted Weapon as Object

by Matt Cuda · in General Discussion · 01/20/2008 (7:52 pm) · 3 replies

How do I get a mounted weapon as an objet and then set the scaling of the weapon?

I need to be able to dynamically modify weapon properties in torque script.

#1
01/30/2008 (12:36 am)
I'm pretty sure you'll have to delve into the source to do that for an Image object. You can get the weapon object with something like %player.getMountedImage().

It would be easy to do, I believe, with a TSstatic object, for example, as you could just delete and recreate the object at a different scale. But I think weaponImages are scaled by the DTS file itself in stock Torque.

I'm talking slightly over my head, here, but I have some experience with it.
#2
02/05/2008 (6:05 am)
Another thing you can look at: when you get the mounted image, if you follow the torque design then the image will have a field "item" which you can use to get the object assocated with the image,
so if %player.getMountedImage() doesn't have the information you're looking for, try %player.getMountedImage().item (not a function, just a field).
#3
02/05/2008 (7:17 am)
Images are datablocks, so you'll either have to put the functionallity on the player, make a seperate object that holds modifications or make a new class. I've tried both of the latter and making a seperate object (much like the structs which holds states in the player class) was easier by quite a bit.