02-10-2009, 08:56 AM | #1 |
Help on melee fighting
Okay, so this post is the result of a fledgling newbie that has a rough understanding of the coding in eduke. Sorry if I should've put this somewhere else.
Basically I want to flesh out the melee combat in duke, and I've looked through the wiki, and FAQ's, and asked around a bit (over PM's, which might've been a mistake), and what I've gathered is that adding new melee attacks/weapons involves defining new projectiles. That makes sense to me, and I've learned how to make certain 'types' of new projectiles, but doing it with melee is kind of throwing me off, and I'm still left with a lot of questions. A) Is the actual animation for the attack carried out through the defineprojectile commands, and if so, how do you string them all together (since someone swinging a sword is pretty clearly going to involve more than just one tile)? Are there any limitations to the number of tiles? B) Other than what the weapon shoots, what other changes have to be done to the weapon in order for it to sync up properly with the projectile? Assuming that I'm right about the projectile command governing the attacking tiles (and I'm probably not, but for all intents and purposes...), doesn't that mean you'd have to delete the original weapon tiles altogether? C) If I get the melee attack working the way I want, are there ways to vary how you attack with said weapon? Like the attack key combined with certain directional keys produces a different animation, or pressing the attack key in a certain sequence produces a sort of combo involving different animations (like the warrior's fist attacks in Hexen)? Any help I can get on this would be greatly appreciated, and I'm hoping nobody's going to think I haven't given this stuff a shot. I have tried it, and had success with other less important things, and like I said, I kind of know how to go about doing it, but I really need somebody to help me connect the dots. As it is right now, I just feel like I'm blindly fumbling around with it, and I really want to understand it. |
|
02-10-2009, 09:25 AM | #2 | |
Re: Help on melee fighting
Quote:
You can't put animation of weapons with just defineprojectile, it needs more work than just that. B) See FIREDELAY for making it fire on the right frame. C) Yes you can have varieties, and most likely make fighter's punch and even the knockback for it, but you need some extra work, I say try to get yourself a working punch first, mainly base it around with something like Doom's fist; then add more complexity to it.
__________________
---HELLDUKE TC--- NEW STABLE MIRROR SECONDARY MIRROR ---GAMEPLAY VIDEO--- Gameplay Footage of my Mod. |
||
02-10-2009, 10:02 AM | #3 |
Re: Help on melee fighting
Thanks for the help, I went ahead and got the animations for the Doom punch from an old mod to work with your suggestion. A few quick questions before I try to work on it; if I'm trying to replace an existing weapon, I've noticed that the majority of the Duke weapons have one tile for your character holding the weapon, then separate tiles for shooting, and those tiles only cover the tip of the weapon, while the initial tile remains the same. That's fine for a ranged weapon, but it won't work out with the Doom punch (or any other melee attack, probably). Is that hard-coded, or is there anyway to change it? I wanna say that it could just be done by changing the definition for the weapon you want to replace in the defs.con, but it probably isn't that easy.
I'd never heard of weaponcount before, but I read old FAQ's over eduke (which explicitly stated that the number of frames in a weapon animation couldn't be changed) so it's not too surprising that it's not familiar. It's a gamevar, so would I set it up like this? gamevar weaponcount <weapon number> <number of tiles> sorry if that's not right or completely off the mark. Also, if projectiles don't determine tiles in the weapon animation, then what are they capable of changing for a melee attack? Just the range? Because it seems like anything else you'd need could be done by changing the values for that specific weapon. I also know what you mean about the attack variations. I'm trying to take it all in stride, so those changes will come when I'm good and ready for them, but I figured I'd go ahead and ask right of the bat. Again thanks a lot for taking the time to help me out. Because it's looking like I'm really gonna need it. |
|
02-10-2009, 10:18 AM | #4 |
Re: Help on melee fighting
See EVENT_DISPLAYWEAPON and the whole event list, read the whole wiki and then ask (or better, search there first)
You check the weapon counts value in order to display something on screen, see rotatesprite.
__________________
---HELLDUKE TC--- NEW STABLE MIRROR SECONDARY MIRROR ---GAMEPLAY VIDEO--- Gameplay Footage of my Mod.
Last edited by XTHX2; 02-10-2009 at 10:21 AM.
|
|
02-26-2009, 12:34 PM | #5 |
Re: Help on melee fighting
Alright after a long struggle I've finally figured out how to move around/add new frames to the weapon tiles, so the basic part is knocked out. Now I'm trying to figure out how to vary the attacks by combing the fire button with certain other keys. I was hoping one thing I could do would be to combine fire with the strafing buttons, but I think that'd have to be done through the event list, and the different animations must be added through the display weapon event, if I'm correct, so what I 'want' to do probably isn't possible.
Right now I've got a somewhat sloppy code involving ifp commands that still needs alot of touching up before it looks good, but now I'm wondering if there's another way to go about doing this. So question is as follows; is the display weapon event the ONLY way to get different tiles for weapon attacks to show up and if it is, have I overlooked something in regards to getting it to work with things other than ifp commands? ...And before anybody tells me to, I've already read the wiki. |
|
02-26-2009, 01:02 PM | #6 |
Re: Help on melee fighting
There are various display events which can be used to display tiles on the screen, including DISPLAYWEAPON, DRAWWEAPON (not sure what the difference between those is, but I always use the second one) and DISPLAYREST.
So that answers the question you asked, but I don't see how it helps you, because adding new animations should have nothing to do with using more than one display event.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
02-26-2009, 01:56 PM | #7 |
Re: Help on melee fighting
Yeah, I guess I should have phrased the question a bit more clearly. Basically Iwant to get a different attack animation with the same weapon by combining the fire key with either of the strafe keys. To the best of my knowledge, the only way to get that animation onto the screen is through an event (any of the events you mentioned, apparently) BUT the only way to get the strafing called in as well is ALSO through an event (event_strafeleft/right), and it says right there on the wiki that events are accessed only through the onevent command. So I was wondering if there was any way to call in the strafe key without using an event, or if there was someway to call in an event inside another event (?) Sorry if it's still awkwardly worded.
I've also just now noticed that, though my sloppy ifp command code works insofar as getting the alternate animation to show up, the original idle animation I have at the other end of the screen is still sitting there. Not quite sure how to get it to go away. |
|
02-26-2009, 02:15 PM | #8 |
Re: Help on melee fighting
You can collect input data and put it into a variable, then you can check the variable in the player code. It is similar using ifhitspace, but you would be checking the strafing keys or any others you like.
http://wiki.eduke32.com/wiki/Bits http://wiki.eduke32.com/wiki/Extbits You grab the input data like this: Code:
gamevar bits 0 1 gamevar extbits 0 1 onevent EVENT_PROCESSINPUT getinput[THISACTOR].bits bits getinput[THISACTOR].extbits extbits endevent for example: Code:
ifvarand bits 1 ifvarand extbits 4 { quote 125 }
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
02-26-2009, 02:15 PM | #9 |
Re: Help on melee fighting
Thank you, thank you, THANKYOU
...and now for the next (and hopefully/probably 'last') problem. The alternate attack works, but somethings up with the frames for the two seperate attacks getting tangeled up with eachother. the sword on the left is the normal attack, about halfway through. The sword on the right is the same, but for the alternate attack. I've looked through the code, and can't figure out where it's going wrong. Both of the attacks are in seperate states, and the displayweapon event has specific circumstances for how the animations show. Here's the state for the normal attack (which replaces weapon 0, the foot) "state displayblade switch weaponcount case 0 setvar xweapon 270 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 230 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 0 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 1 case 2 case 3 case 4 setvar xweapon 250 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 225 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 1 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 5 case 6 case 7 case 8 setvar xweapon 230 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 220 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 2 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 9 case 10 case 11 case 12 setvar xweapon 210 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 215 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 3 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 13 case 14 case 15 case 16 setvar xweapon 190 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 210 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 4 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 17 case 18 case 19 case 20 setvar xweapon 170 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 205 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 5 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 24 setvar xweapon 150 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 200 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 6 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break endswitch ends " then the state for the alternate attack "state cleavesword switch weaponcount case 0 setvar xweapon 275 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 250 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 11 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 1 case 2 case 3 case 4 setvar xweapon 260 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 250 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 11 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 5 case 6 case 7 case 8 setvar xweapon 255 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 235 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 12 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 9 case 10 case 11 case 12 setvar xweapon 252 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 230 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 13 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 13 case 14 case 15 case 16 setvar xweapon 249 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 225 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenum 14 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 17 case 18 case 19 case 20 setvar xweapon 245 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 220 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenum 15 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break endswitch ends " then the event that calls them... "onevent EVENT_DISPLAYWEAPON ifvare currentweapon 0 { setvar RETURN -1 { state displayblade } } ifvarand bits 4 ifvarand extbits 4 { state swingswordright } ifvarand bits 4 ifvarand extbits 1 { state cleavesword } endevent " ...The only thing I can figure is that the fire key is getting them tangeled up somewhere, but I'm not sure how and if there's anything I could do about it. Would I just have to nix the fire key altogether? I've noticed when I hold the key down more of the alternate animation comes onto the screen which is...odd...
Last edited by EmericaSkater; 02-26-2009 at 03:39 PM.
|
|
02-27-2009, 08:32 AM | #10 |
Re: Help on melee fighting
What is swingswordright state? Also, put your code in code tags like this.
Code:
Example.
__________________
---HELLDUKE TC--- NEW STABLE MIRROR SECONDARY MIRROR ---GAMEPLAY VIDEO--- Gameplay Footage of my Mod.
Last edited by XTHX2; 02-27-2009 at 08:35 AM.
|
|
02-27-2009, 10:21 AM | #11 |
Re: Help on melee fighting
Nix that, that one little tip you gave helped me figure it out.
|
|
02-28-2009, 02:26 PM | #12 |
Re: Help on melee fighting
Everything's going swimmingly now, so this is more a curiosity question than anything else; when i hold the attack button down, the alternate animation plays completely through. That's how I want it, so I'm not bothered, I'm just wondering why it does that automatically.
|
|
02-28-2009, 03:53 PM | #13 | |
Re: Help on melee fighting
Quote:
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
02-28-2009, 10:39 PM | #14 |
Re: Help on melee fighting
Ah, so to adjust that I'd just have to set weaponcount equal to the number of frames I have set aside for the attack in the event that calls it, right? Or would I have mess around with it's kickback pic? For this attack, it doesn't really matter to me, but I'm thinking if I wanted to make the same effect for a ranged sort of attack, it'd probably be better to have the whole animation play with one press of the fire button rather than holding it down.
|
|
02-28-2009, 11:15 PM | #15 | |
Re: Help on melee fighting
Quote:
I can tell you're struggling with some stuff, and maybe this will help. The kickback_pic member of the player struct holds the current weapon frame. Actually, "frame" is misleading, because there need not be different pics displayed for each one. Kickback_pic is used as a counter that starts at 1 when the weapon fires and goes up to the TOTALTIME of the weapon. Kickback_pic will continue to increment automatically, and then will return to 0 (exception: certain weapons do not return to 0 if you hold down the fire key, they continue to cycle between the middle and end of the sequence). Here's another fun fact about kickback_pic: you can force a weapon to fire by setting it to 1, even if the player hasn't pressed the fire key (maybe you knew that already). This bring us to weaponcount: weaponcount is similar to kickback_pic, but it's a gamevar used for display purposes (do NOT use it outside of display events).
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
03-01-2009, 07:29 AM | #16 |
Re: Help on melee fighting
Hah, fledgling newbie, like I said. I'm just hoping the questions aren't irritating you guys, but I've read the wiki and gone through the faqs and all that good stuff, so when I can't figure something out, going to the forums is pretty much the only thing I can do. But hey, I've figured some stuff out on my own! I've gotten this far, right? (Opptomist...)
I actually did understand the kickback's function to an extent, but I didn't know that you could force a weapon to fire with it. But honestly, now that you've explained that, things are like, three times as confusing now. You said the problem was due to weaponcount incrementing automatically, so I'd pretty much have to work within the state I set for the weapon display right? Does kickback even have anything to do with it? At first the glitch didn't bother me too much, but now that I study it a bit more closely, I've notcied that hiting the fire button once (not holding it) makes the first tile for the alternate attack appear then stop, which makes the whole thing appear wonky and inconsistent. It'll still work if I hold it, but I'd rather know what's going on and how to fix it. But yeah, the code is pretty much the same, so I'm figuring I have to change something in the state or in my event... |
|
03-01-2009, 09:20 AM | #17 | |
Re: Help on melee fighting
Quote:
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
03-01-2009, 09:31 AM | #18 |
Re: Help on melee fighting
You said you made a sword too? I'd definately be interested in seeing that if you still had it, if nothing else just to see what it's like in-game...
Nixing the hard-coded stuff sounds appealing, but sort of intimidating at the same time. If I were to do that, would I set the animations up in an event still? I'd hate to ask you to walk me through this, but honestly, that's a pretty foreign concept to me. |
|
03-07-2009, 11:02 AM | #19 | |
Re: Help on melee fighting
Quote:
Code:
state cleaveblade switch weaponcount case 0 setvar xweapon 258 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 200 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 0 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 1 case 2 setvar xweapon 260 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 250 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 11 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 3 case 4 setvar xweapon 255 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 235 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 12 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 5 case 6 setvar xweapon 252 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 230 addvarvar yweapon looking_arc subvarvar yweapon gun_pos setvar tilenumweapon SWORD addvar tilenumweapon 13 ifvare weaponcount 6 break myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break endswitch ends Code:
ifvare currentweapon 0 ifvarand extbits 1 ifvarand bits 4 { state cleaveblade shoot MELEEHIT } ..and so on so forth. I've seriously hit a wall, here. What the heck am I doing wrong? |
||
03-08-2009, 04:04 PM | #20 | |
Re: Help on melee fighting
I didn't really get what your problem is... maybe I'm just too dumb <.<
Quote:
__________________
---HELLDUKE TC--- NEW STABLE MIRROR SECONDARY MIRROR ---GAMEPLAY VIDEO--- Gameplay Footage of my Mod. |
||
03-08-2009, 10:15 PM | #21 |
Re: Help on melee fighting
Well, I actually got it working the way I want just now Remember those alternate melee attacks we talked about way earlier in the thread? Basically when I started putting them in, something weird happened in the attacks that required the fire button (ifvarand bits 4) where only tapping the attack button once would only show the first frame, but holding it down would repeat the middle of the attack animation. I found a work-around to it earlier this morning though by taking the firing command out of the displayweapon event, and moving my shoot command (which shot the projectile that would make the alternate attack do more damage) to the state which actually 'displayed' the attack. It works like a charm now.
|
|
03-08-2009, 11:26 PM | #22 |
Re: Help on melee fighting
I'm not sure why that worked for you, but in general you shouldn't have anything that changes the game world (such as shooting a projectile) occuring in a display event or in a state called by it. In some cases, changing the game world in a display event is a necessary evil in order to achieve certain effects, but it breaks multiplayer. Also, shooting something in a display event sounds like it would risk having the timing and/or quantity of the shots depend on your framerate (although it depends on how it is coded).
One solution to your kickback_pic progression problem would be to change the flags in the workslike value of the weapon that is being fired during your melee attacks. But the solution I prefer, (as I mentioned several posts ago) is to forego using a real weapon like that and code your melee attacks from scratch. Maybe you don't know what I mean by that.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
03-09-2009, 11:15 AM | #23 | |
Re: Help on melee fighting
Quote:
|
||
03-09-2009, 11:19 AM | #24 | |
Re: Help on melee fighting
Quote:
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||
03-09-2009, 11:40 AM | #25 | |
Re: Help on melee fighting
Quote:
|
||
03-09-2009, 12:32 PM | #26 |
Re: Help on melee fighting
To answer the question you quoted: You would still use a display event to display the animation. The main difference is you would be displaying the frames based on your own counting variable, instead of using weaponcount. You can set the variable to any number you want, depending on what the player is doing. You can make it start at 1 when pressing a certain key and then count up, or whatever you want.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
03-09-2009, 02:26 PM | #27 | |
Re: Help on melee fighting
Quote:
__________________
EDuke32 - "The corrupt doctrine of terror has begun." |
||
03-10-2009, 02:15 AM | #28 | |
Re: Help on melee fighting
Muy bien, how it displayed was one of the things that really threw me off. But at this going rate, does this mean there isn't going to be an idle animation for the attack if it isn't technically a weapon, or am I just initiating the counter to different values when the player is standing and walking? If the player 'is' walking, how would I retain the weapon sway for an idle animation? Are the weapon xoffset, lookingang and gunpos commands still applicable to something that isn't a weapon? Sorry for asking all the questions, but I'm only doing so because you've piqued my curiosity.
Quote:
|
||
03-10-2009, 06:06 PM | #29 |
Re: Help on melee fighting
I tried to completely recode all of the weapons for my old mod, but I never got to the swaying and bobbing. Your best bet is to port code out of the source. I do know that you have to do something with the hardcoded, constantly updated variables looking_angSR1 and gun_pos, as the game automatically changes them for the bobbing and swaying, and also disables it when the menu option for it is turned off.
|
|
04-09-2009, 08:28 AM | #30 |
Re: Help on melee fighting
okay, I'm finally fed up trying to screw around with hardcoded crap in the player structure to get my melee stuff to work, so I took DT's suggestion and started working on a way to get it to work through my own variables. I got the first part knocked out by disabling the original function for WEAPKEY1 and setting one of my own varaibles to a particular value when that key is pressed, so the game will know it's armed. I used the DRAWWEAPON event to display the idle animation. I got that working the way I wanted it to, so now I'm trying to get the attacking animation to work when you press the fire button, and that brought me to the next level of confusion; I'm not sure how I should go about getting the tiles to play in the appropriate sequence. Should I just animate them through Dukeres, then try to find a way to make it stop once it hits the last tile? Or am I supposed to supposed to use ifcount commands in my gamevars so they'll work in tandem with what I've got in the display event? DT, you said that I'm supposed to use my own counters to get it to increment, so does that mean I'm just using addvar commands and if so, how do I control how fast it goes?
If I can just figure out how to get the attack to animate, I'm sure I can string the rest of this stuff together... |
|
04-09-2009, 09:00 AM | #31 | |||
Re: Help on melee fighting
Quote:
Quote:
Quote:
gamevar counter 0 1 gamevar meleepic 0 1 Then, in the player code: Code:
ifvarg counter 0 // counter got set to 1 when you started the attack { switch counter case 1 case 2 setvar meleepic 3460 break // or whatever the first frame is case 3 case 4 setvar meleepic 3461 break // etc endswitch addvar counter 1 ifvarg counter 26 setvar counter 0 }
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
||||
04-10-2009, 07:40 AM | #32 |
Re: Help on melee fighting
Alright, I'm that much closer to getting this figured out. First expiriment was largely following the example you gave, wherein I made two new gamevars, FISTPIC and COUNTER, then put this into the player code...
= Code:
ifvare FISTARMED 1 { ifvarand bits 4 { setvar COUNTER 1 } ifvarg COUNTER 0 { switch COUNTER case 1 case 2 setvar FISTPIC 3665 break case 3 case 4 setvar FISTPIC 3666 case 5 case 6 setvar FISTPIC 3667 endswitch } Code:
ifvare FISTARMED 1 { ifvarg COUNTER 0 { ifvare COUNTER 2 { rotatesprite 166 195 65536 0 FISTPIC 0 0 0 0 0 xdim ydim } ifvare COUNTER 4 { rotatesprite 166 195 65536 0 FISTPIC 0 0 0 0 0 xdim ydim } This was the state Code:
state swingfist switch COUNTER case 0 setvar xweapon 165 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 195 addvarvar yweapon looking_arc subvarvar yweapon gun_pos ifvare hudtype 1 { addvarvar yweapon 31 } setvar tilenumweapon 3664 addvar tilenumweapon 1 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 1 case 2 case 3 case 4 setvar xweapon 185 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 210 addvarvar yweapon looking_arc subvarvar yweapon gun_pos ifvare hudtype 1 { addvarvar yweapon 31 } setvar tilenumweapon 3664 addvar tilenumweapon 2 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break case 5 case 6 case 7 case 8 setvar xweapon 200 addvarvar xweapon weapon_xoffset subvarvar xweapon looking_angSR1 setvar yweapon 220 addvarvar yweapon looking_arc subvarvar yweapon gun_pos ifvare hudtype 1 { addvarvar yweapon 31 } setvar tilenumweapon 3664 addvar tilenumweapon 3 myospal xweapon yweapon tilenumweapon gs orientationweapon palweapon break endswitch addvar COUNTER 1 ifvarg COUNTER 26 setvar COUNTER 0 ends |
|
04-16-2009, 10:24 PM | #33 |
Re: Help on melee fighting
Well, it looks really nice now. I even threw in some extra variables to keep track of what sequence it's pressed in so it will display an extra attack when the button is pressed a second or third time. One question though, is there any hard-coded way to tell the game whether or not the button is being held or pressed? Because I've noticed that if the attack button is held it stays on the first tile, and if it's pressed too rapidly, it'll skip the other animations based on what sequence the button is pressed in...
Last edited by EmericaSkater; 04-17-2009 at 01:32 PM.
|
|
04-16-2009, 11:50 PM | #34 |
Re: Help on melee fighting
You can tell whether a button is being pressed at any particular moment by checking the relevant input bit, as I showed you earlier. If you want to know whether a button is being held down (i.e. whether the pressed button was also pressed during the previous tic) then you need to add some more code to make that determination. The way I do it is like this: when the player presses the button, I mark the time of the press by putting the elapsed game time (player_par) into a variable, then add 1 to it. On the next button detection (i.e. every button detection), if the button is pressed and the time stored in the variable (prior to the variable being updated) is equal to the current elapsed time, then the button is being held.
__________________
DUKE PLUS New map effects and various optional extras for Duke 3D. DUKE NUKEM: ATTRITION XP based weapon upgrades, progressive difficulty, and more. |
|
04-17-2009, 03:41 PM | #35 |
Re: Help on melee fighting
I can't possibly thank you enough, DT. It's friggen gorgeous now!
|
|
Bookmarks |
|
|