Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Melee Attack
Melee Attack
2005-05-03, 5:46 PM #1
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.
2005-05-04, 12:52 AM #2
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.
2005-05-04, 4:59 AM #3
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.
2005-05-04, 7:38 AM #4
When I get home I'll post the cog for one of the UR weapons. All of them had a melee butt attack.
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2005-05-04, 9:55 AM #5
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!!!
2005-05-04, 10:02 AM #6
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.
2005-05-04, 11:44 AM #7
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.
Code:
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)
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-04, 5:35 PM #8
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?
2005-05-04, 7:26 PM #9
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
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2005-05-05, 8:11 AM #10
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.
2005-05-05, 9:25 AM #11
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
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-05, 5:28 PM #12
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.
Attachment: 4859/massassi.zip (15,948 bytes)
2005-05-05, 7:16 PM #13
This is what I got. Untested, but it should work.
Attachment: 4861/melee.zip (16,475 bytes)
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-06, 8:58 AM #14
Got it, I'll try it tonight and let you guys know if I have any trouble. Thanks.
2005-05-08, 2:58 PM #15
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??
2005-05-08, 3:16 PM #16
Did you put all the files in the proper places?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2005-05-08, 5:59 PM #17
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?
2005-05-10, 7:35 AM #18
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.
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-10, 7:37 AM #19
a
Attachment: 5000/melee.zip (17,911 bytes)
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-10, 9:28 AM #20
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.
2005-05-11, 8:26 AM #21
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.
2005-05-11, 9:18 AM #22
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...)
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-11, 5:12 PM #23
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?
2005-05-11, 6:15 PM #24
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.
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-05-12, 7:41 AM #25
Okay. I'll change that, then I'll go back and try to remake mine with your melee cogs. Thanks

↑ Up to the top!