Game Development Community

Is there a way to equip an object(not its image)

by Nelson A. K. Gonsalves · in Torque Game Engine · 10/02/2001 (10:07 am) · 2 replies

I just cant get it to work,
using mountImage(ObjectImage,Mount) works great... but
using mountObject(Object,Mount) dont works, I mean, I get no errors but I dont see any items equiped also...
I need to equip the object cause every object got various unique variables that need to be kept... The currently "hacky" way Im doing it is mounting the image and hiding the object, and getting the info I need from the object that is hided.

If I get it from the image, every player in the game would share the same variable values... in my case the same backpack... it is quite funny to have a universal backpack but thats just not right... lol

#1
10/03/2001 (11:11 am)
I'm not sure that the Item class supports being mounted on another object... hmm, in fact it probably doesn't, which would explain why it's not working :) Would not be too hard to add though, but that would involve changes to the Item C++ code.

Objects are pretty heavy weight in terms of network traffic which is why we use images. If you can work it out using images, it would be better.
#2
10/03/2001 (5:15 pm)
You would probably want to just transfer the data over to the player object.

For example when you pick up a backpack you would pull the information you need and store it in an array tied to the player.

%player.backpack[{name},{setting}]={value};

Basically you add the extra information into the inventory system. Then when you drop and item you would pull the data from the player and use it when creating the object again.

If you're going to allow someone to carry multiple items that might be of the same type but could have different statistics you will need to give each one a unique identifier on pickup so you can tell the difference between them when dropping.

I've used this type of method before with a Tribes 1 modification that allowed for weapons to take damage. I never completed all of the code, but the transfer of information from object to player and back to object was working.