Adding weapons
by Robert Brighton · in Torque Game Engine · 05/21/2004 (1:56 pm) · 10 replies
Help i ve made a machine gun 3d model how do i add it to my game so my player can use it
many thanks
many thanks
#2
many thanks
05/21/2004 (3:08 pm)
Searched the forums using the search functions searched the tutorial section and gone through the faqs could not find any refererence to adding first person weapons if i have missed some thing or overlooked something can you please provide me with a link?many thanks
#3
I really can't help you as I haven't messed with that part of Torque yet.
05/21/2004 (3:37 pm)
You could always tear apart the demo -- you pick up a crossbow in that one and can fire it.I really can't help you as I haven't messed with that part of Torque yet.
#4
many thanks
05/23/2004 (3:10 pm)
Cant any body tell me the easiest way to add a gun to my game ive searched the forums and read the faqs if ive missed something someone please let me know but i thought it would be an easy question other than been told to read the forums come on guys help a begginer out please any help would be greatfully appreatiedmany thanks
#5
05/23/2004 (3:49 pm)
Ok believe i found the answer thanks to noescape tutorials thanks
#6
Simply rename the default model to crossbow.bak (or something similar), and export your new model as crossbow.dts, and save in the correct folder.
The demo should load your new model whenever an instance of a crossbow is created.
Note, however that this weapon will behave exactly like the default crossbow. Changing this will require editing the script.
BTW - Please don't whine. It's unbecoming. ;-) All the information I gave above is _readily_ available to anyone spending more than 10 minutes in these forums. Just dig a little harder next time you need something.
05/23/2004 (3:51 pm)
The easiest? Well, as long as you're not trying to add new functionality for your new weapon, you can simply replace the default crossbow model with your own weapon model.Simply rename the default model to crossbow.bak (or something similar), and export your new model as crossbow.dts, and save in the correct folder.
The demo should load your new model whenever an instance of a crossbow is created.
Note, however that this weapon will behave exactly like the default crossbow. Changing this will require editing the script.
BTW - Please don't whine. It's unbecoming. ;-) All the information I gave above is _readily_ available to anyone spending more than 10 minutes in these forums. Just dig a little harder next time you need something.
#7
For a newbie, thats done a fair bit of research on these forums - it's quite difficult getting to grips with TGEs terminology. Indeed, if it can be confusing to a seasoned programmer, a newbie programmer/modder will find it extremely fustrating.
Sure, all newbies should look at www.catb.org/~esr/faqs/smart-questions.html
But if you know the answer to a question I think it's just polite to include a url, or helpful directions that will point the user to the information that you think that they're looking for.
If you find out the answer to a question that you've asked by yourself, it's always a good idea to include a url to the resource that you've found, as it will certainly help other users who have searched for the same question as you have asked!
All that said these forums are a fantastic source of info, though alas it is difficult to mine them :-D Perhaps there should be a license-owners advanced search perhaps?
The occasional post when cvs is updated wouldn't go amiss either, but I'll stop there before I start rambling :-)
(edited a stupid misspelling - no preview post ? :( )
05/23/2004 (7:00 pm)
Just my 2p ... For a newbie, thats done a fair bit of research on these forums - it's quite difficult getting to grips with TGEs terminology. Indeed, if it can be confusing to a seasoned programmer, a newbie programmer/modder will find it extremely fustrating.
Sure, all newbies should look at www.catb.org/~esr/faqs/smart-questions.html
But if you know the answer to a question I think it's just polite to include a url, or helpful directions that will point the user to the information that you think that they're looking for.
If you find out the answer to a question that you've asked by yourself, it's always a good idea to include a url to the resource that you've found, as it will certainly help other users who have searched for the same question as you have asked!
All that said these forums are a fantastic source of info, though alas it is difficult to mine them :-D Perhaps there should be a license-owners advanced search perhaps?
The occasional post when cvs is updated wouldn't go amiss either, but I'll stop there before I start rambling :-)
(edited a stupid misspelling - no preview post ? :( )
#8
www.planetquake.com/noescape/torque/basicweapon.htm
basicly just copy the default crossbow.cs and rename it to machinegun.cs and search in the new .cs for crossbow and change them all to machinegun.
and execute the new.cs in game.cs
05/23/2004 (7:28 pm)
Heh, i did this along time agowww.planetquake.com/noescape/torque/basicweapon.htm
basicly just copy the default crossbow.cs and rename it to machinegun.cs and search in the new .cs for crossbow and change them all to machinegun.
and execute the new.cs in game.cs
#9
I copied the crossbow.cs file renamed it to gun.cs and replaced everything in there to point to my new gun graphics etc.
This file creates a GunImage instead of a crossbowImage so now it exists.
next I added this line to my game.cs file to load the gun data
exec("./gun.cs);
Then in player.cs I added this
function MyPlayer::onAdd( %this, %obj )
{
parent::onAdd( %this, %obj );
%obj.mountImage( GunImage, 0 ); //or crossbowImage
%obj.setImageAmmo( 0, 1 );
}
Hope this helps and if any of you guru's out there see if this is wrong please let me know.
05/24/2004 (9:51 am)
Not sure if this is the right way or not but here goes:I copied the crossbow.cs file renamed it to gun.cs and replaced everything in there to point to my new gun graphics etc.
This file creates a GunImage instead of a crossbowImage so now it exists.
next I added this line to my game.cs file to load the gun data
exec("./gun.cs);
Then in player.cs I added this
function MyPlayer::onAdd( %this, %obj )
{
parent::onAdd( %this, %obj );
%obj.mountImage( GunImage, 0 ); //or crossbowImage
%obj.setImageAmmo( 0, 1 );
}
Hope this helps and if any of you guru's out there see if this is wrong please let me know.
#10
thanks again
05/25/2004 (10:48 am)
Thanks for your help guys it helped big time what i am trying to do is implement a weapons inventory system i have managed to combine the information given here and the information given in the forums to create a workable weapons inventory system once ive finished testing it ill post it as a resource for other new users thanks again
Torque Owner Stefan Lundmark