PDA

View Full Version : Melee Attack


HAcKSaw
05-03-2005, 08:46 PM
This may sound like what's already been posted currently here, but read on and see that it's not.

I need a melee attack. Not like an individual weapon, this will be a function that can be used on every gun. I've pieced together an idea of what to do, but have no idea on how to do it. I need to link a cog into the jkstrings.uni for a new hotkey and make a generic cog linked into each weapon cog. The KEY file for the melee attack will be one of the saber slices, but I haven't picked one yet.

For reference, I looked at RANGI.gob,available here, but I want it available with every player.

If you can help me, please do so. I also am not as skilled with cogs as most people, so you might have to explain or just write it for me. Thanks.

Giraffe
05-04-2005, 03:52 AM
You mean something like smacking with the butt of your gun?

You might do well to investigate the Spork mod, as that had a "kick" attack that wasn't dependent on having a particular weapon selected.

HAcKSaw
05-04-2005, 07:59 AM
Okay, I will. One more thing, to see what I'm trying to do, download RANGI, play single player and use the special ability. Oh and yes, it is hitting with the butt of your gun.

JediKirby
05-04-2005, 10:38 AM
When I get home I'll post the cog for one of the UR weapons. All of them had a melee butt attack.

HAcKSaw
05-04-2005, 12:55 PM
Okay. Sorry I won't be able to get it until tomorrow, but I have dial up at home and my dad is starting to get mad at me for (GASP) asking to get on every day!!!

HAcKSaw
05-04-2005, 01:02 PM
Wait, I just remembered something. Will this melee attack be secondary fire, or a seperate function in itself. I need to keep secondary fire unused, as I already have a COG I edited with secondary fire for every weapon.

LKOH_SniperWolf
05-04-2005, 02:44 PM
Here's the way to do it nicely...

symbols
int player local

message startup
message activated
end

code
startup:
player=GetLocalPlayerThing();

activated:
SendMessage(GetInvCog(player,GetCurWeapon()), user0);
return;

end

Your melee hotkey ^

Now, in each of the weapon cogs, add this thing to them.

user0:
if(!isActivated){
FireProjectile(player, projectile, -1, 18, '0.02 0.03 0', '0 0 0', 1.0, 0, 0.0, 0.0);
jkPlayPOVKey(player, meleeAnim, 1, 0x0a);
meleeing = 1;
SetTimerEx(2.0, 14756, 0, 0);
}

timer:
if(GetSenderID() == 14756)
meleeing = 0;


Now in your weapon cog, you'll need to add a couple things.

Just before ActivateWeapon(); put this line:
isActivated = 1;
Just before DeactivateWeapon(); put this line:
isActivated = 0;

(Define isActivated as a int or bool in your symbols, with a default of 0; same for meleeing)

And, at the start of your activated message:

if(meleeing)
return;

This should cover it. I think, at least. This'll prevent them from meleeing at the same time as using the weapon, and it'll allow you to play different keys for different weapons (in case you wanted custom animations for some of those weapons)

HAcKSaw
05-04-2005, 08:35 PM
Thanks. I'll try it tomorrow after school lets out. One question though. Where in the symbols do I put the melee KEY file name?

JediKirby
05-04-2005, 10:26 PM
As always, sniperwolf's cog is much cleaner than what I've got, and it suits your needs a bit better. Ours was far more focused and specific for each weapon.

JediKirby

HAcKSaw
05-05-2005, 11:11 AM
Alright, thanks any ways Kirby. I'll put you in my credits as you have helped me with other stuff. Sniperwolf gets in also. Thanks.

LKOH_SniperWolf
05-05-2005, 12:25 PM
keyframe meleeAnim=blank.key local

You'll also have to define projectile template...

I'd suggest the one for punching, which I think is the following

template projectile=+punch local

HAcKSaw
05-05-2005, 08:28 PM
Guys, you're probbly getting sick of hering this, but I can't seem to get it to work, (I haven't tried the projectile thing yet though) . Would any of you guys, (preferbly LKOH_Sniperwolf or jEDIkIRBY) just take the files I've included and make them do a melee attack? I can replicate it, but I just need to do it once or twice to get used to it. I have a zip included that has probably all the original files needed. I'll transfer them to my own later.

LKOH_SniperWolf
05-05-2005, 10:16 PM
This is what I got. Untested, but it should work.

HAcKSaw
05-06-2005, 11:58 AM
Got it, I'll try it tonight and let you guys know if I have any trouble. Thanks.

HAcKSaw
05-08-2005, 05:58 PM
I was out of town on Saturday, so I tried it today. While it was untseted, it didn't work either. I'm not sure what it was, and I changed the meleeAnim to sabrf1.key. Any ideas? Will it only work if its in all the weapons at once??

Lord_Grismath
05-08-2005, 06:16 PM
Did you put all the files in the proper places?

HAcKSaw
05-08-2005, 08:59 PM
Yeah. Items.dat goes in the misc directory, jkstrings.uni goes in the ui directory, and the cogs go in a cog directory. Why? Did they work for you?

LKOH_SniperWolf
05-10-2005, 10:35 AM
Ok, I did find two minor errors, but I'd created an improved version anyways...

(The errors were the hotkey needed flags 0x120, and the other was GetCurWeapon() needed the player as an argument...)

So here.

LKOH_SniperWolf
05-10-2005, 10:37 AM
a

HAcKSaw
05-10-2005, 12:28 PM
I'lll have it by tonight, I don't have any floppy discs with me, and right now I'm at school on a MAc with no USB port. They're really crappy.

HAcKSaw
05-11-2005, 11:26 AM
Okay, I love it. I added a key for outside view and a sound for it. One question though. Can you show me how to make it so that you execute the melee attack every time you hit the hotkey. To get it to go, you have to hit it 3 times for it to cycle through.

LKOH_SniperWolf
05-11-2005, 12:18 PM
Huh? What are you talking about 3 times for it to cycle through? (Are you trying to do it in between a delay... It's not like the repeater, firing off at super high rates...)

HAcKSaw
05-11-2005, 08:12 PM
No, go try it. You hit the key once: it works. Hit it again, it says 0 or 1( I forget). Hit it One more time and then after that it works again. I tweaked it to have sounds and stuff and combined it with the cogs I'm using and now it only works the first time you hit it at all. This problem's my fault. Ideas?

LKOH_SniperWolf
05-11-2005, 09:15 PM
Those are debug messages. You should remove them from your final cog.

1
0

Means that you haven't waited long enough since your last melee. There's a time delay preventing it from going too fast.

It's teh SetTimerEx line. I think the delay was at 2.5 for testing purposes. Just lower the value on the timer (first value), and it'll be able to be fired faster. Shouldn't set it too low though.

As for the sounds stuff, I'd have to see how you modified the cog.

HAcKSaw
05-12-2005, 10:41 AM
Okay. I'll change that, then I'll go back and try to remake mine with your melee cogs. Thanks