PDA

View Full Version : Throw Grenade With A Key



legacy-Zyz
07-04-2003, 09:40 PM
Hey, i'm fairly new to UScript, but not new to programming and concepts. Well if you any of you have played Team Fortress Classic, you throw grenades by pressing a button (or holding it down to prime). Well anyways, i'm still confused as to how I could make it so when you press a Button, it throws a grenade, then explodes like 2 seconds after you throw it. Any help is GREATLY appreciated.

legacy-Beefypeanut2
07-04-2003, 11:56 PM
prime? i think you mean cook, ive never played team fortress but when you hold on to a nade after you pull the pin so the enemy can't throw it back is called "cooking a grenade" Sorry to be an ass but i like to see things done properly ;)

legacy-monkeycircus
07-05-2003, 05:36 AM
well, the keybind to throw the grenade is done via a exec function in a controller class. So, you'd put something like:

exec Function ThrowGrenade()
{
//Tell the player to spawn the grenade if they have enougth ammo etc.
}

then, in your user.ini file in the /system directory, scroll down to a key (e.g. G=) and change it to Letter=ThrowGrenade (e.g. G=ThrowGrenade).

Then, when you press your key (e.g. G) ingame, it will call the code in that exec function.

(you also need to take a look at GUIUserKeybinding to see how to add your keybinds to the controls menu in UT2003)