Help with Inventory TGE 1_5_2
by Joel Low · in Torque Game Engine · 02/01/2015 (8:09 pm) · 8 replies
Hi I need help with inventory system, where I can press a key to pick up and store item in inventory, and open inventory to choose items to use or hold. - Joel
#2
02/02/2015 (9:00 am)
It's for school and according to them we must use this version, I really hope you can help me mate.
#3
here is a link to all references to "inventory" that are available on this site .
www.garagegames.com/community/search#gsc.q=inventory&gsc.tab=0
within the articles you may find references of 2 types .
1) as an alteration to the engine code , with scripting examples and , instructions for using the modification . If you do not have access to tools needed for recompiling the engine code then you wont be needing the articles related to modifying .CC and .H files , at this time .
2)scripting examples which utilize the engine ,as is . If youre using the TGE executable and you do not have the source code then these examples are what youre looking for .
Another thing , about looking for tutorials , examples , resources for the older engines like 1.5.2 . the resources section is full of useless links . The offered code example download links are usually non working . So , good luck rummaging around and good luck with your project .
BTW , Im just a noob , recenty began looking into GUI also . but ,
If 152 is similar to 112 ( I think it is ) then , it has a couple of inventory features ready to rock .
1). In youre player.cs file , in the new player datablock , you list the inventory allowed for that character . look at the bottom of the datablock and you see the weapons , ammo , maybe some coins listed and
the maximum number allowed for that player of that inventory item .
2). in the same file , player.cs , youll find the function , onCollision
within oncollision is a call to "pickup" a pickupable item , probably just a weapon at this time . That pickup gets the ball rolling toward adding the new item to your inventory . with a couple diversions to control/server/server.cs and control/server/misc/shapebase.cs <- some file structure similar to that i guess .
3). throw - this ones a bit trickier as , if its similar to 112 youll need to find out why throw isnt working :D , but youll find things in that same server.cs as well as shapebase.cs plus presetkeys.cs (keybinding) which is found in the common/client/ folder . Things relevant to the throw functionality , which will , in turn , decrease the inventory for the thrown item .
lastly , the available example for choosing an item , look to youre presetkeys again and find where the numbers 1 and 2 are bound to functions related to selecting an item for use .
youre Teacher should be able to help you with understanding the flow of these actions within the files and functions and methods .
hope this can help you get it going . and have a good day sir .
02/02/2015 (12:27 pm)
Mr Low ,here is a link to all references to "inventory" that are available on this site .
www.garagegames.com/community/search#gsc.q=inventory&gsc.tab=0
within the articles you may find references of 2 types .
1) as an alteration to the engine code , with scripting examples and , instructions for using the modification . If you do not have access to tools needed for recompiling the engine code then you wont be needing the articles related to modifying .CC and .H files , at this time .
2)scripting examples which utilize the engine ,as is . If youre using the TGE executable and you do not have the source code then these examples are what youre looking for .
Another thing , about looking for tutorials , examples , resources for the older engines like 1.5.2 . the resources section is full of useless links . The offered code example download links are usually non working . So , good luck rummaging around and good luck with your project .
BTW , Im just a noob , recenty began looking into GUI also . but ,
If 152 is similar to 112 ( I think it is ) then , it has a couple of inventory features ready to rock .
1). In youre player.cs file , in the new player datablock , you list the inventory allowed for that character . look at the bottom of the datablock and you see the weapons , ammo , maybe some coins listed and
the maximum number allowed for that player of that inventory item .
2). in the same file , player.cs , youll find the function , onCollision
within oncollision is a call to "pickup" a pickupable item , probably just a weapon at this time . That pickup gets the ball rolling toward adding the new item to your inventory . with a couple diversions to control/server/server.cs and control/server/misc/shapebase.cs <- some file structure similar to that i guess .
3). throw - this ones a bit trickier as , if its similar to 112 youll need to find out why throw isnt working :D , but youll find things in that same server.cs as well as shapebase.cs plus presetkeys.cs (keybinding) which is found in the common/client/ folder . Things relevant to the throw functionality , which will , in turn , decrease the inventory for the thrown item .
lastly , the available example for choosing an item , look to youre presetkeys again and find where the numbers 1 and 2 are bound to functions related to selecting an item for use .
youre Teacher should be able to help you with understanding the flow of these actions within the files and functions and methods .
hope this can help you get it going . and have a good day sir .
#4
Thanks for taking your time to answer my question, but I couldn't find the list of inventory as you said. But yes I've seen the onCollision, and for throwing, you mean it's not implementable?
My teacher said he had no idea how to do that, it's an elective probably that's why but I want to make this possible.
02/07/2015 (5:50 am)
Hello Mr Burch :)Thanks for taking your time to answer my question, but I couldn't find the list of inventory as you said. But yes I've seen the onCollision, and for throwing, you mean it's not implementable?
My teacher said he had no idea how to do that, it's an elective probably that's why but I want to make this possible.
#5
This link is probably what you are looking for.
A couple others are:
www.garagegames.com/community/forums/viewthread/127647
This one has a good discussion:
www.garagegames.com/community/forums/viewthread/110809
02/09/2015 (3:02 pm)
www.garagegames.com/community/forums/viewthread/75995This link is probably what you are looking for.
A couple others are:
www.garagegames.com/community/forums/viewthread/127647
This one has a good discussion:
www.garagegames.com/community/forums/viewthread/110809
#6
You should see those items listed at the bottom of the new playerdata datablock in your player.cs file . You should see items such as rifle , rifle ammo , crossbow , crossbow ammo maybe a cool tommygun and ammo .
they should look similar to
rifle = 1
rifle ammo = 100
tommygun = 1
tommygun ammo = 80
crossbow = 1
crossbow ammo = 20
the throw function works very well . the character literally throws an object out which falls to the ground . you can then pick it up again or let it timeout and disappear . you can experiment with the function and apply more or less impulse , making the Character throw the item farther or for less distance or , maybe set it to not be removed from the scene or disappear instsntly , whatev :)
(assuming that the throw function isnt working right)
Id like to suggest that you test it .
1) pick up a weapon .
2) hit the t key on your keyboard .
3) hit the teal key then look at the last line in the window , you can scroll down if you need to .
If there is no reference to the function youre trying to call then you likely do not have a key bound to the function . anything else should give you some indication as to what is wrong , such as
cant find the object
cant find the function
unknown command
etc.
Have a good day Mister Low :)
02/10/2015 (7:43 pm)
Joel, still here ? or have you moved on after those neat-O links ?!?You should see those items listed at the bottom of the new playerdata datablock in your player.cs file . You should see items such as rifle , rifle ammo , crossbow , crossbow ammo maybe a cool tommygun and ammo .
they should look similar to
rifle = 1
rifle ammo = 100
tommygun = 1
tommygun ammo = 80
crossbow = 1
crossbow ammo = 20
the throw function works very well . the character literally throws an object out which falls to the ground . you can then pick it up again or let it timeout and disappear . you can experiment with the function and apply more or less impulse , making the Character throw the item farther or for less distance or , maybe set it to not be removed from the scene or disappear instsntly , whatev :)
(assuming that the throw function isnt working right)
Id like to suggest that you test it .
1) pick up a weapon .
2) hit the t key on your keyboard .
3) hit the teal key then look at the last line in the window , you can scroll down if you need to .
If there is no reference to the function youre trying to call then you likely do not have a key bound to the function . anything else should give you some indication as to what is wrong , such as
cant find the object
cant find the function
unknown command
etc.
Have a good day Mister Low :)
#7
02/14/2015 (6:38 pm)
Are you talking about the player.cs from starter.fps?
#8
I am not learning with 1.5.2 and Im not familiar with starter.fps but , I am assuming that its files are similar . Did you see the other files , shapebase.cs and server/server.cs ? They could be named something different but are likely in the control folder .
02/17/2015 (10:47 am)
Mr. Low ,I am not learning with 1.5.2 and Im not familiar with starter.fps but , I am assuming that its files are similar . Did you see the other files , shapebase.cs and server/server.cs ? They could be named something different but are likely in the control folder .
Torque Owner Richard Ranft
Roostertail Games