Obsidian Conflict Forums

Have you seen my coffee cup?
It is currently Mon Dec 18, 2017 4:42 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: The Grapple Hook
PostPosted: Thu May 05, 2011 11:40 pm 
Offline
Pixel

Joined: Thu May 05, 2011 11:36 pm
Posts: 1
Has thanked: 0 time
Have thanks: 0 time
Hey Guys

I am currently testing ideas for a modification i am soon to create and i came acroos your grapple hook code. I am building for the single player version of hl2 (2007 build) and i am wondering what I would have to change in order for this to work in my mod. Credits will be added upon completion.
http://developer.valvesoftware.com/wiki/Grapple_Hook

"The weapon is designed for multiplayer, but should work fine in a single player mod once you swap out references to hl2mp. It uses the crossbow model."

Its the single player reference I dont know or to change.

Thanks


Top
 Profile  
 
 Post subject: Re: The Grapple Hook
PostPosted: Mon May 09, 2011 3:14 am 
Offline
Lead Coder
Lead Coder
User avatar

Joined: Tue Aug 15, 2006 3:39 pm
Posts: 1812
Location: Germany
Has thanked: 12 times
Have thanks: 29 times
Do I really have to explain that?
Seriously, if you can't figure that simply thing out then you might stay away from things like coding? (Hint: "HL2MP" -> "HL2" or was it "HL2SP", no idea, but I'm not really here to solve that for you...)

_________________
ImageImage

Image

Image

Image


Top
 Profile  
 
 Post subject: Re: The Grapple Hook
PostPosted: Tue May 10, 2011 12:24 am 
Offline
Level 10 Bug Hunter
Level 10 Bug Hunter
User avatar

Joined: Wed Jul 01, 2009 3:26 pm
Posts: 595
Location: $Recycle.Bin
Has thanked: 26 times
Have thanks: 78 times
I'd change the code for you, but doing so on a screen this size (it's a smartphone) will blind me, so I'll only be able do that when I get home.

Off the top of my head, you'll need to change references to HL2MP to HL2 (sometimes even HL), or in some cases remove it entirely. Common places to look at are header includes and class inheritances (whoa, is that even a word?).

Edit:
Also, since it's a singleplayer mod, you could attach the rope to the viewmodel instead of the weapon since it looks significantly better that way (can't do that in multiplayer because it looks really ugly for other players).

Edit 2:
Well, I've done edits to make it compile without errors in Episodic (Single Player).
Here they are: weapon_grapple.cpp and weapon_grapple.h. Place both of these files into the server/hl2/ folder and add them to the Server project in Visual Studio. You will most likely need to create a client-side version for this entity, see c_weapon_crossbow.cpp in the Client project for a quick example.
Keep in mind that the edits are rather very crude since I didn't have much spare time to work on it (also, I didn't actually test them out in-game, only checked that they compiled). Also, the grapple hook code on the Valve Wiki is actually derived from the Episode 1 (maybe even earlier!) version of weapon_crossbow, so I don't really recommend using these files as a long term solution until you've verified that you can ignore whatever has been changed.

Sorry that I couldn't do more, I'm really tight on time.

_________________
Apparently, Valve can't make games beyond the number 2.
I think the only time we'll get a Source SDK code update is when it starts having purchasable hats integrated, i.e. hatconomy.

Please do not make assumptions you are not knowledgeable enough to make - that just backfires on yourself.
Tick me off, and I'll be sure to give you the golden treatment. Haven't you heard? Silence is golden.


Top
 Profile  
 
 Post subject: Re: The Grapple Hook
PostPosted: Tue May 17, 2011 7:23 pm 
Offline
Pixel

Joined: Mon May 16, 2011 2:07 pm
Posts: 3
Has thanked: 0 time
Have thanks: 0 time
This is only partially related to the topic, but the grapple works really weirdly whenever I try to use it. Does it still use the code linked above?


Top
 Profile  
 
 Post subject: Re: The Grapple Hook
PostPosted: Wed May 18, 2011 12:31 am 
Offline
Level 10 Bug Hunter
Level 10 Bug Hunter
User avatar

Joined: Wed Jul 01, 2009 3:26 pm
Posts: 595
Location: $Recycle.Bin
Has thanked: 26 times
Have thanks: 78 times
I think so - the last time I tested a binary compiled with the provided grappling hook code, it behaved in the exact same way as it did in OC. That weirdness in movement is caused by use of IPhysicsSpring, but I don't know of any others that would be more suitable for this purpose... Yet.

_________________
Apparently, Valve can't make games beyond the number 2.
I think the only time we'll get a Source SDK code update is when it starts having purchasable hats integrated, i.e. hatconomy.

Please do not make assumptions you are not knowledgeable enough to make - that just backfires on yourself.
Tick me off, and I'll be sure to give you the golden treatment. Haven't you heard? Silence is golden.


Top
 Profile  
 
 Post subject: Re: The Grapple Hook
PostPosted: Wed May 18, 2011 2:22 am 
Offline
Pixel

Joined: Mon May 16, 2011 2:07 pm
Posts: 3
Has thanked: 0 time
Have thanks: 0 time
You may want to try setting the player origin every frame as well as the spring length. I think the current version is that of a spring that doesn't let the hook side rotate.

If you want the spring movement stuff outside of the physics system I have some code that should properly do the spring stuff.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

Protected by Anti-Spam ACP Powered by phpBB® Forum Software © phpBB Group