View Full Version : Grappling Hook:

06-03-2002, 06:12 AM

Well I have been tryin to hack the grapple outta the quake3 source with not much luck at all. The model is being worked on. Not sure if i'll get this done before someone else does it. I havent had any luck finding any pics of the stormtrooper utility grapple that luke used in a new hope. I would like to do the mod using that grapple with some looped animation seq's to simulate some kinda spinning of the grapple hook. Again I dont know how far ill get on this or weather ill finish it at all. Just wanted to post here in case anyone is working on it already or has some feedback.

06-03-2002, 07:04 AM
This shouldnt be 2 hard, part of the grapple for ctf is still in the source, basicly you could try just copy n pasting working code from q3 into jk2 and make adjustments where needed.

06-03-2002, 10:00 AM
I think it should be cool if you make it a weapon you pick up on the map.

you can also make it like web that should be cool be just like spiderman! :D

06-03-2002, 10:17 AM
LOL =)

06-03-2002, 10:44 AM
Well i found some cling ceiling and drop from celing animations.. And like i said .. im tryin to get the quake3 grapple source in here.. The format of the 2 seems to be a little different .. im sure ill have to look at it alot more before it starts makin more sence.

06-05-2002, 03:35 AM

How far have you gotten? I'm trying to add the static binding controls at this moment but the code is a mess.

I often wonder wtf was Raven thinking when they write this stuff. Let me know, maybe we can hack this crap together. PM or IM me.

06-05-2002, 04:19 AM
Ya im not having much progress. Everytime i fix one error it makes another. And ya raven seems to have coded this alot differently than quake3 so these tutorials arent helping much. Ive been tryin to recruite some help but im thinkin i might just leave it to some more experienced coders or maybe wait for some more info.

06-05-2002, 04:36 AM
Ya Raven made the functions a bit different.

the Getting the grapple hook to work is a LOT of work.

Some comments Raven left in as a "hint" to get the grapple going but there are entire pieces of code missing.

Like WP_GRAPPLING_HOOK is there but if you look in the g_weapons.c file there is nothing for the hook there.

If you take a look at the g_missle.c/h fire you dont see the fier_grapple func there either...

Wish I had some help with this... there are a lot of files to cover....
plus ravan has separated some definitions into other .c and .h files...

I've basically been looking/comparing code using
PURECTF's code however I'm concentrating on getting the hook in the game rather than fast grapple mode or a server side var....

06-05-2002, 04:47 AM
Well what i did was grab every scrap of the grappling hook code from the quake3 source and put it into its respective jk2 source equilivent, some seemed to need to go in other files and what not. And then i tried converting some of it to ravens style of codeing but i managed to break everything in between. Then i tried doing that along with most of the grappling hook tutorials i found for quake3. Ive really just about givin up ... I do know a couple of expert programmers and with any luck ill get them to help.

06-05-2002, 05:46 AM
I'm making a lot of progress now, probably 25% done through the code....

I'd also like to be notified of anyone makes a hook model, I'll probably sub in a missle model or something small to test if it works but I'd like to sub in a real hook model...

06-05-2002, 06:08 AM
Well I just grabbed the grapple hook from quake3 and was using that .. Not that ive gotten that far.. Always gettin compile errors.. But i just installed visual c++ an am gonna look into it some more. I cant find any pics of the stormtrooper utility grapple used by luke in ep4. But i have found many pics of the ascention gun (at the top of the thread). I kinda got a buddy of mine workin on it but who knows.

06-05-2002, 06:13 AM
Dont try to compile til you're completely done subbing in all the code in the right places....

Right now, I'm subsituting the animations for the Therms and using a therm as the model.

It's such a bitch to translate.. you look at Raven's code and id's code. You wonder... so how did Raven do this.. fakkkkkk

Eyes.. burning.......

I've just reached the part where I need to call/add the event when the hook is used in bg_pmove.c

augh..maybe I''ll stop here today.. before I compare the code...

06-05-2002, 06:50 AM
So just cause:

game\be_aas.h(35):#define TFL_GRAPPLEHOOK 0x00004000 //grappling hook
game\be_ai_move.h(21):#define MOVE_GRAPPLE 8
game\be_ai_move.h(32):#define MFL_ACTIVEGRAPPLE 128 //bot is using the grapple hook

game\be_ai_move.h(32):#define MFL_ACTIVEGRAPPLE 128 //bot is using the grapple hook

game\be_ai_move.h(33):#define MFL_GRAPPLERESET 256 //bot has reset the grapple

game\be_ai_move.h(55):#define RESULTTYPE_BADGRAPPLEPATH 4 //grapple path is obstructed

game\bg_public.h(811): ET_GRAPPLE, // grapple hooked on wall

game\bg_weapons.h(33)://WP_GRAPPLING_HOOK, (commented out)

/* Library variables:
game\botlib.h(463):"rs_startgrapple" "500" be_aas_move.c

game\botlib.h(490):"weapindex_grapple" "10" be_ai_move.c grapple weapon index for grappling (seems to be 10 still)

game\botlib.h(492):"offhandgrapple" "0" be_ai_move.c enable off hand grapple hook

game\botlib.h(493):"cmd_grappleon" "grappleon" be_ai_move.c command to activate off hand grapple

game\botlib.h(494):"cmd_grappleoff" "grappleoff" be_ai_move.c command to deactivate off hand grapple

game\chars.h(101)://tendency to use the grapple hook when available

game\chars.h(102):#define CHARACTERISTIC_GRAPPLE_USER 39 //float [0, 1] //use this!!

game\g_active.c(1545): client->fireHeld = qfalse; // for grapple

if ( !( ent->client->ps.eFlags & EF_FIRING ) ) { client->fireHeld = qfalse; // for grapple}

game\g_local.h(397): gentity_t *hook; // grapple hook if out

What ever all this ET_GRAPPLE stuff is for :(

animEnt->s.eType = ET_GRAPPLE; //ET_GRAPPLE is the reserved special type for G2 anim ents.

game\g_team.h(24):#define CTF_GRAPPLE_SPEED 750 // speed of grapple in flight

game\g_team.h(25):#define CTF_GRAPPLE_PULL_SPEED 750 // speed player is pulled at

Aweful lot of code for something removed from the game. And aside from all the ET_GRAPPLE which im sure has nothing to do with the grappling hook.. thats all the "grappl" instances i can find in the source.

game\bg_public.h(811):ET_GRAPPLE, // grapple hooked on wall

But then theres this so im confused again.

if ( tr.fraction != 1) {// never explode or bounce on sky
if ( tr.surfaceFlags & SURF_NOIMPACT ) {// If grapple, reset owner
if (ent->parent && ent->parent->client && ent->parent->client-zhook == ent) {ent->parent->client->hook = NULL;

Then theres this.

I dont know .. I lost myself again .. Lookin thru the quake 3 source. Well this was a long winded thread. And i didnt mean to spam so much. But i wanted to get it outta the way ;)

If you'ld like ... I can compile a list of all the grappl / hook instances within the q3a source also. If you havent already dont it it should make things a little easier.

Also i did just uncomment out the WP_GRAPPLING_HOOK line. And typeing weapon 10 at the console does not error.

06-05-2002, 07:48 AM
Thanks for the update.....

I missed quite a few with the grapple expression.

Now I guess I'm 15% done...

I've gone through and had to think where I should put this code and etc. The funny stuff is when I load JK2 to see the difference in code.

For example.. in bg_pmove.c, I wanted the therm animation for the hook when selected.

if (pm->ps->weapon == WP_THERMAL ||
pm->ps->weapon == WP_TRIP_MINE ||
pm->ps->weapon == WP_DET_PACK ||
pm->ps->weapon == WP_GRAPPLING_HOOK //Ves)

if (pm->ps->weapon == WP_THERMAL)
if ((pm->ps->torsoAnim&~ANIM_TOGGLEBIT) == WeaponAttackAnim[pm->ps->weapon] && (pm->ps->weaponTime-200) <= 0)

PM_StartTorsoAnim( WeaponReadyAnim[pm->ps->weapon] );
if ((pm->ps->torsoAnim&~ANIM_TOGGLEBIT) == WeaponAttackAnim[pm->ps->weapon] && (pm->ps->weaponTime-700) <= 0)
PM_StartTorsoAnim( WeaponReadyAnim[pm->ps->weapon] );

So at the top you can see I added the WP_Grap_Hook to toggle the waist animation.. I hadto load JK to tell the difference in the If statement is there is any...

I should probably add another OR there beside the Therm or another if so firing inbetween hooks should be less. I'm also NOT concentrating on the code for the AI of the bots. They dont need to be using Grapppling hooks atm. Goal is "GET IT WORKING".

One last note... when I was crusing the g_client.c code and noticed the jedivsmerc code, I couldnt resist sticking the hook in there for the mercs. Watch out Jedi, the mercs are gonna kick some ass!!

Jesus.. it's 6am already.... i should catch some Zzzs...

06-05-2002, 08:42 AM
Ya im still going here. Gonna try to add all this quake code to the jk2 again. Maybe pay a little more attention this time. Not going for any animations at this time, think ill just use normal gun stances and get rid of the lightning gun shaders from quake3 as thats what the grappling gun uses there.. Maybe i can convert the md3's to glm and mess around a little more. And i was lookin towards making it a default weapon for all game types not just jedi vs merc or ffa. Anywho.. Ill probalby catch u here tomarrow ;)

Since no1 else posted ill just edit...

So after a night of prodding and poking:

jk2mpgamex86.dll - 0 error(s), 26 warning(s)

Least I got rid of the errors. These are the same warnings i got to start with from files i didnt touch. Anywho, im done for the night at this point I have all the grapple code into the source compiling without errors. During game play it starts with what appears to be a constant drain effect on the hand moving is impossible and the leaks and trails are insane. On another try when selecting the saber i would get that little ball that follows you and shoots at stuff, my brain is fried tonight so forgive me if i cant remember what its called. It would also do some crazy animations when i jumped.. like it would go up legs out and drop flat like a death animation or something. Anywho.. if u wanna leave your email and look at where im at so far id be happy to send u a archived mod source. On another note. I didnt get there errors until:

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

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

I know this is probably the problem. well dont know .. but guessing.

// start MATT
for ( i = WP_NUM_WEAPONS - 2 ; i > 0 ; i-- ) {
// changed the -1 to a -2 so the grapple isn't selected by default
// end MATT

all i did also was just change the -1 to a -2

Im also assuming i left some of the weaponnumbers and model numbers from the inv.h the same as they were in the quake source or changed some of the numbers to an open one.

Oh an i was also able to get a dll to compile though im not real sure how to use it. Adding stuff to the mod dir doesnt seem to do anything for me. Was also able to run in debug with some minor errors cause i didnt install vc completely yet.

End Rant...... more nightmarish coding tomarrow im sure...

06-05-2002, 12:27 PM
Ok. I guess after my code demo today at work, I'll start working on this (at home...), too. My clan will appreciate it since they want this mod and I didn't want to make it. heh. If you guys have already finished it by the time I start, please drop me a PM so I don't reinvent the wheel. Otherwise, we can see how we're doing as time progresses.

06-05-2002, 12:48 PM
Well by all means work on it ;)

All ive done so far is move most of the quake3 grapple code into the jk2 source. And get it to compile without errors for once.. Im still not sure if ill ever get it to work properly, and im not much of a coder so. by all means plz plz someone else do it ;)

But im sure gonna keep tryin until its done or someone else gets it done.

06-05-2002, 01:07 PM
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_NONE )

if in your code it's written exactly like that...i suggest you add the | character, for it to do the OR (it will be:
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_NONE )

06-05-2002, 01:38 PM
Well im sure theres more to it than that. That line is commented out in my compile. I think it has something to do with the inv.h file maybe a few other things. This last comile was really nuts.. All the jumps and attacks seem to be wrecked somehow... SIGH, course i didnt really expect to get this far even ;)

06-05-2002, 08:33 PM
Just woke up 30 min ago.

I did try to follow Matt's tutorial but then I realize all since most of the stuff has been removed by Raven, to skip to Article 40.

I grabbed the source from PURECTF and ignored the tutorials and went on replacing/scouting code by code.

06-05-2002, 10:24 PM
No real updates huh.. Well i just got up.. ill get some food and tackel it again.

06-05-2002, 11:44 PM
Do me a favor and IM or PM me.


So far it looks like I'm done with the server code.

Now I gotta work the client side... jeebus.....

Da MaN
06-07-2002, 11:37 PM
I am close....

if I work on it tonight and get no errors I'll probably be testing it tomarrow...

06-08-2002, 01:07 AM
Well, ive gotten nowhere good. This model is lookin nice though ;)

06-08-2002, 04:12 AM
A grappling hook mod would be sweet for Jedi vs. Merc games, if they were given to the mercs.

06-08-2002, 04:18 AM
Actually, I did account for that gameplay in the server code.

So only mercs will have access to the hook. I was supposed to finish up on the FX/grapp ent behaviors tonight but I'm too tired from work to implement it.


Ahhh damn ilkasjdlkjalsd

Raven, you just had to make those iven items weapons huh? god damn 16 weapon limit.

06-09-2002, 03:24 AM
Fell down half a page couldnt find it huh :)

Lord Nodata
06-14-2002, 01:00 PM
Did anyone get this "grappling hook" working in Jedi vs Merc for JUST the mercs?

06-14-2002, 01:20 PM
this hook didnt work afaik
mine works in all games, but i haven't implemented a jedi Vs merc check, so both teams would have it
and this project is abandoned afaik
Vesentac and Cobra helped me on mine

Lord Nodata
06-14-2002, 02:02 PM
Ok...Is it possible for you to write up a Jedi vs Merc check for me ASK? I would love to put this on my Jedi vs Merc server, but to give it to the Jedi would be just overkill...:(