Posts | ||
---|---|---|
Help coding a "hook-like" weapon | Locked | |
Thread Options | ||
Feb 2 2015 Anchor | ||
I'm working on a gold source mod (mortal kombat), and I need some help with my code to make it attract the people it hits. It's currently based on the crossbow code for it, and added an extra "think", so when it hits a player it retracts and when it doesn't, well, doesn't.
I'm currently very noob at coding, and yes this looks like a mess. What I tried to do there was this
I really need help D: Thanks in advance. |
||
Feb 4 2015 Anchor | ||
Hello, Now you didn't declare the speed at the bottom, with the *50, is that an OOP thing? Because I only have commandline experience. Also what does the ' -> ' mean? And there's different ways of programming the hook(I think), you could program it as a PULL to shooter, which you did. Or you can program it as, check what the distance traveled by hook was, PUSH the player that was hit by hook towards the shooter by: Also, it looks to me like you programmed it to pull ONLY when the player that gets hooked is under 45 hp. Try using more enters bro, a tip from a fellow noob :) Also, I think you need to declare: I really hope this helps, maybe they're bad idea's, but I usually get idea's from other people's idea's. |
||
Feb 4 2015 Anchor | ||
I really really appreciate your help. I'm going to use the second idea, the one that brings the victim to the player but the first statement. I would like to know how to get the distance that the hook has traveled minus the origin (which I already know). Also the -> is used to attribute something to an entity. pVictim->movetype = MOVETYPE_PUSH Would mean that the way the victim is going to move from now on is as if it's being pushed. |
||
Feb 16 2015 Anchor | ||
Hello Ian, So I'll give some examples per method: I hope this is clear enough also I think you misplaced a ";" right after case 4, you put it after the first "}", shouldn't that be after the 2nd "}" ? If you have any questions, feel free to ask here or pm |
||
Feb 16 2015 Anchor | ||
Oh ok. thanks for it, I still don't know how to track the distance traveled, and can't get the player who shot coordinates from a weapon ".cpp", nor the enemy's coordinates. I would like some help about this. |
||
Mar 1 2015 Anchor | ||
Hello Ian, I'm sorry bro, but that knowledge is out of my reach, like I said before, I'm new to programming as well. If you have any other questions, I'm still willing to help |
||
Mar 1 2015 Anchor | ||
I have no idea how to do it, nor where to find help for it, as most Half Life/Gold Source Coding tutorials are mostly dead, and the ones I could find where to add things I don't really need like, flashbang in Half Life, TFC styled Grenades and stuff like that. That's why I made this thread to see if people in here have knowledge about this specific thing D: |
||
Mar 7 2015 Anchor | ||
Dosnt the Barnacle does the "calculate distance" thingy? Maybe theres something in its code about "get player close to me" that can be used or taken as reference for this? |
||
Mar 8 2015 Anchor | ||
I checked the barnacle code before, as it was the first thought that came to my mind when looking for something that "Attracts" in the Half life's engine. Sadly I couldn't reproduce it's effect as it has other things to count. For example the "attract function" in the barnacle code, checks the (barnacle's) model size to know where the neck of the prey is to know where to begin damaging the prey. I might not be that hard to turn it into a weapon, but considering the barnacle is a separate entity, and a weapon is an entity held by(or that depends on) another separate entity. It sounds quite hard.
Remember I'm still learning, and would like to get as much help as I can.
I made it work |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.