Grapple


(Devastator) #1

Howdy Chaps,

A quick thingymagoo , id like to add a grapple into my mod , i have been reading upon in the code and reading up and found some examples …

however without destroying too much of the work can anyone point me into some of the files that need to be modified to create this grapple feature ?

weapon has to be in_hand … can grapple solid terrain and structures , and most importantly players can be grappled aswel …

anyone have an idea?


(nUllSkillZ) #2

Aren’t there any Q1/Q2/Q3 mods with code available?


(Shanks) #3

Open the Quake 3 source code and search for WP_GRAPPLING_HOOK. Should be a nice base for your work.


(Cambodunum) #4

hmpf xD

greetz Cambo


(Nail) #5

http://www.quake3hut.co.uk/q3coding/grapple%20hook2.htm


(Devastator) #6

Daedlinx :frowning:

@ rest …

i have searched the code but only found a partial match inside the code of ET 255pro … missing to many references …

Find all “WP_GRAPPLING_HOOK:”, Subfolders, Find Results 1, “Entire Solution”
ui_players.c(105): //case WP_GRAPPLING_HOOK:
Matching lines: 1 Matching files: 1 Total files searched: 243

ill try the q3 code …


(acQu) #7

excuse me, but what is meant with ET 255pro, anything im missing here ?


(Devastator) #8

im using the ETPRO Version 2.55 sdk sourcecode…(cgame/game/ui only ) … meaning

in the Q3Source there are 24 references to the grapple , and in ETpro v255 only 1 or 2 … u’re missing nothing … im missing everything :frowning:

bah … that would mean re-adding old stuff , ergo destroying the simplicity … anyone know of a workable grapple in a mod , with source ?? :smiley: :wink:


(stealth6) #9

ye I think he’s wondering how you got the source of etpro? :slight_smile:


(Devastator) #10

who doesnt ? :stuck_out_tongue:


(NearlyFreeSpeech) #11

Metal Gear Solid style eh? Sounds good…


(Devastator) #12

yeah … the source … but merging the q3 source and ETPro is not my cup of tea … as i said … to many references to the grapple ( inside etpro code ) has been deleted …

only references to “hook” or WP_grapple… are 2 … and compared to the q3 code ( 24) … and the namechanges of files and stuff beeing re-located to bg_misc doesn’t make it easier to combine 2 sources :frowning:

might be able to add a new weapon with the same function . however then im faced with other trouble ,

i want the grapple to be voteable from referee mode… or selectable from ammobank 1 …

i haven’t found the place to edit weapon bank 1 yet …


(Nail) #13

[QUOTE=Devastator;248843]Daedlinx :frowning:

@ rest …

i have searched the code but only found a partial match inside the code of ET 255pro … missing to many references …

Find all “WP_GRAPPLING_HOOK:”, Subfolders, Find Results 1, “Entire Solution”
ui_players.c(105): //case WP_GRAPPLING_HOOK:
Matching lines: 1 Matching files: 1 Total files searched: 243

ill try the q3 code …[/QUOTE]

link works for me, it says:

I was going over the source and noticed that Quake 3 already has a grappling hook programmed by our lovely friend Zoid! It's not offhand (as far as I know, only been looking at the source for an hour), but the models, icons, and effects are all in the Q3 PK3 file. As of now, the model is just gray - unskinned, and the beam effect and sound come from the lightning gun (hint hint....new ability for lightning gun?). I'll show you how to give the player starting weapons by using the grappling hook as an example.
First make sure you're using the game project, then open up g_client.c. Go to the void ClientSpawn(gentity_t *ent) function and find these lines:


	client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MACHINEGUN );
	if ( g_gametype.integer == GT_TEAM ) {
		client->ps.ammo[WP_MACHINEGUN] = 50;
	} else {
		client->ps.ammo[WP_MACHINEGUN] = 100;
	} 


These essentially assign the player's inventory to one machinegun and some bullets, depending on whether or not it's teamplay.

Now to give the player additional weapons you'll use something like this:


	client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GRAPPLING_HOOK ); 


Put the above line just under the ones having to do with the machinegun. Notice that I'm using |= instead of just = as done in the original code above for the machinegun. Since the machinegun is the FIRST weapon assigned, you can use the assignment operator, but additional weapons need to use the |= in order to add them to the inventory, without overwriting the first one. If you look a few lines down in the code you'll see that the gauntlet is added to the player's inventory in the same way as I showed you with the grappling hook above. The above line will let you give players any weapon at spawning, just by changing the WP_ enumeration.

Now open up g_items.c. Since we're going to be using some of the models and effects for the grappling hook, and no maps have the actual weapon, we need to precache it. We also need to precache the lightning gun so the grappling rope is also loaded. Find the void ClearRegisteredItems( void ) function and add these to the existing list of weapons to be registered:


	// Willi - Grappling Hook
	RegisterItem( BG_FindItemForWeapon( WP_LIGHTNING ) );
	RegisterItem( BG_FindItemForWeapon( WP_GRAPPLING_HOOK ) );


Here's the complete list of weapon names you can use in g_client.c:


WP_GAUNTLET
WP_LIGHTNING
WP_SHOTGUN
WP_MACHINEGUN
WP_GRENADE_LAUNCHER
WP_ROCKET_LAUNCHER
WP_PLASMAGUN
WP_RAILGUN
WP_BFG
WP_GRAPPLING_HOOK


I hope you enjoy and use the grappling hook, which is activated by pressing 0 (or if that doesn't work, try /weapon 10 at the console) and the assignment of weapons.


(Devastator) #14

maybe im thick …

Find all “ClientSpawn(gentity_t *ent)”, Match case, Subfolders, Find Results 1, “Entire Solution”
Matching lines: 0 Matching files: 0 Total files searched: 243…

im thick … probably relocated and renamed … and re-funxored … but where …ayiee .

… im getting there … hopefully …