Vruki Salet Posted June 23, 2006 Share Posted June 23, 2006 I have made a command in g_cmds.c that needs the game to make like BUTTON_ATTACK has been pressed without the player really doing so. in bg_pmove.c, within PM_Weapon, I have the following: #ifdef QAGAME if (g_entities[pm->ps->clientNum].client->vsnSaberCombat.swingingSaber == qtrue) { pm->cmd.buttons |= BUTTON_ATTACK; } #endif As you can see it's only in QAGAME so it works fine if my client is the same as my server like when I run it as a non-dedicated listening server, but doesn't work for any clients when I run the code on a dedicated server. How can I make the cgame also virtually press BUTTON_ATTACK at the same time? PS.: I tried out ways that avoided using #ifdef QAGAME but it didn't seem to help. "cmd.buttons |= BUTTON_ATTACK" still didn't work from cgame files though I tried it in various places. As it is now the QAGAME version is back since it's more convenient in other ways. Link to comment Share on other sites More sharing options...
Tinny Posted June 23, 2006 Share Posted June 23, 2006 Well you can get rid of the qagame, but the client will still need the dll to have this to work I believe. Link to comment Share on other sites More sharing options...
Vruki Salet Posted June 23, 2006 Author Share Posted June 23, 2006 I did get rid of QAGAME but I'll do it again to see what happens. Having the client isn't an issue at the moment. Can you recommend an good place to put some version of "cmd.buttons |= BUTTON_ATTACK" into cgame? Link to comment Share on other sites More sharing options...
Tinny Posted June 23, 2006 Share Posted June 23, 2006 If you wanted it in just cgame you can use the #ifdef CGAME tag in pmove. I'm not sure if that's what you're asking though. Link to comment Share on other sites More sharing options...
Vruki Salet Posted June 23, 2006 Author Share Posted June 23, 2006 It turns out I made a mistake. I am using a modified copy of PM_SaberAttackForMovement and when I got rid of the QAGAME I forgot that the whole function is wrapped in #ifdef QAGAME so I didn't get rid of those. Now I got rid of them and it helps. Thanks for pointing me in the right direction Tinny. Link to comment Share on other sites More sharing options...
Vruki Salet Posted June 23, 2006 Author Share Posted June 23, 2006 Now there's another problem to address, maybe you can help again. It goes like this: I have a command set up in g_cmd.c that swings the saber in various directions by feeding a version of PM_SaberAttackForMovement virtual movement directions and then causing a simulated attack button press to fire within PM_Weapon in bg_pmove.c. This works great in standalone client games and listen servers, where I can use 7 numpad keys to make the saber swing all over the place, and I can do swing combos (like yellow scissors etc.) just like regular mouse-driven sabering in normal JKA. Transitions all work like they're supposed to. However now when I run the game as a dedicated server and join it, the buttons swing my saber in the right direction but I can't combo anymore, now in all stances the saber has to do a full swing 100% then come back all the way back to "ready" before it will let me swing again with the keys. There are no transitions and no flowing from one swing into another. Any ideas why this might be happening? Link to comment Share on other sites More sharing options...
razorace Posted June 23, 2006 Share Posted June 23, 2006 How are you transmitting the data to the server and when are you handling the combos? On saber impact, or at the end of the animations? Link to comment Share on other sites More sharing options...
Vruki Salet Posted June 23, 2006 Author Share Posted June 23, 2006 If I get you right then the answer to the first question is that I make a console command and bind it to the key I want and it makes a command define in g_cmds.c go. For the second question, I made it so that the next swing could only be commanded during certain times (experimented with various: e.g. once the original swing was 40% done), so the command wouldn't count outside of those times, but when I hit this current problem I opened it up to make the server allow the command at any time. UPDATE: I have a variable (vsnInt1, essentially userInt1) that when greater than 0 tells the server to "press" BUTTON_ATTACK for me. It used to be "pressed" in bg_pmove.c but I moved it to pm_weaponlightsaber. (Both places behave the same.) I need it to be reset to 0 after a swing so it doesn't just swing forever once it's been made greater than 0 by the command in g_cmds.c, so I put "pm->ps->vsnInt1 = 0;" before returns in my equivalent of PM_SaberAttackForMovement at first, and then changed it to the end of pm_weaponlightsaber. (Both places behave the same.) This is giving a clue to the problem. Without the "pm->ps->vsnInt1 = 0" I swing perpetually once the first command is given. With it, I can make exactly 1 full swing at a time always returning to ready stance before I can swing again. Link to comment Share on other sites More sharing options...
Vruki Salet Posted June 23, 2006 Author Share Posted June 23, 2006 Hey is there a big lag problem with setting saber swings via g_cmd.c? I'm having second thoughts about the whole thing because of that. How much more priority are buttons given? Link to comment Share on other sites More sharing options...
razorace Posted June 24, 2006 Share Posted June 24, 2006 I'm not sure about this but I believe that placing it in g_cmd.c won't cause lag. I believe that the taunt and meditate emotes are controlled that way. Basically, the command will be processed and applied to the playerstates on the game side. Technically it won't be applied until the next server frame, but that's the case no matter what you do. Link to comment Share on other sites More sharing options...
ensiform Posted June 24, 2006 Share Posted June 24, 2006 taunt and meditate are controlled via a gencmd which are hard coded. Link to comment Share on other sites More sharing options...
razorace Posted June 24, 2006 Share Posted June 24, 2006 Ok, I was mistaken. Anyway, it really depends on how often you're going to be using this ability. Link to comment Share on other sites More sharing options...
Vruki Salet Posted June 28, 2006 Author Share Posted June 28, 2006 The whole thing seemed easier to do & more reliable with buttons so that's what I did. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.