-
Posts
8 -
Joined
-
Last visited
Content Type
Profiles
News Articles
Tutorials
Forums
Downloads
Everything posted by Setrilo
-
That all makes perfect sense. I've seen those tutorials and planned on giving them a full read, but I wasn't sure they'd actually help this particular problem. However, the way you're explaining though seems really insightful. I might have to do everything again from the ground up, but honestly I'm not sure how well I expected outright copying a bunch of someone else's code to work anyway. Essentially, the problem I'm having does indeed revolve around the force power slots not being initiated. I think I have my head wrapped correctly around the code that actually bestows it to the player during spawn, but the initiation is a problem. I believe you're right and that those tutorials would fix that problem. I'm going to take another dive in tonight and see if I can apply all of this. I will let you know the results! About your problem with SP, I'm really not an experienced coder either. I'm just barely skirting by, hence the desire to copy paste code from other projects. I feel like the only way to learn is to keep at it and slowly branch out. It sounds like the problem isn't a limitation of your knowledge of coding but rather of the way this specific game works. Once I nail down this force power gunnery system problem I will have a much better understanding of the files, and I'm confident I'd be able to propose a solution to get some RPG elements in there. In fact, I've always wanted to see a bunch of RPG elements in Jedi Academy and would be happy to look into it further with you. Something small I can think of off the top of my head is that OJP Enhanced has an experience system which allows for a client to dynamically increase their force points with every kill. I'm sure this could be applied to SP, but this would essentially allow (if guns were tied to force points, or their own skill point system) you to buy guns with "money" that was earned from kills. Their code for the "ExpSys" as they call it is conveniently located within "//[ExpSys]" comments so you'd know if you're looking at something you might want to copy. Only trouble is their Exp System is linked heavily to their Gunnery System, and so following their code would lead you down the same path as me. Whatever you decide to do, I just thought I'd bring it up.
-
The basic functionality of OJP Enhanced's Gunnery System is that it creates a new window on the Force Power Selection Screen titled "Gunnery". Inside, there are a list of guns (Pistol, Blaster, Thermal Detonators, Rockets, etc) with different tiers that you can spend your unspent points on, much like how force powers work. The only difference is if you choose one of these gun talents, you don't get a force power, you just spawn with said gun. Just like when a force power gets stronger the higher its tier, the higher tier gun, the more ammo it has. In effect, choosing guns instead of force powers will make you more like a soldier instead of a Jedi. Or, you can be a hybrid. I have no doubt this system, or a very similar one, is how Movie Battles II treats its guns, but to my knowledge their project is not Open Source. So, the next best thing I could find was OJP Enhanced. I haven't looked into Jedi Knight Galaxies at all, but from what I understand their system does not use force powers but instead an item-purchasing and inventory-management system. The code I'm referring to has is not related to weapon slots or customization features, but if I get this code to run, anything is possible down the road. I'm using the JA++ code as a starting point with which to merge the OJP Gunnery functionality, using those commits from 2006 I linked above as exact instructions of which files I have to edit, and what exactly to change. As you can expect, this path has me editing a lot of files like: game/bg_misc.cpp (handles cost of each force tier. So for instance, how a Rocket Launcher costs 4 pts @ tier one, 6 pts @ tier two, and 8pts @ tier three) game/g_client.cpp (handles how you are bestowed the weapon, based on "skillLevel" upon spawn) game/g_items.cpp (not sure tbh since I have no idea what "RegisterItem(BG_FindItemForWeapon(WP_SABER))" and the like are actually doing. Anyone help?) game/w_force.cpp (handles resetting and applying force powers and "skilllevel"s at some sort of initialization step. Not sure what it is doing - this is the file I need help with) game/bg_public.h (replace NUM_FORCE_POWERS with NUM_TOTAL_SKILLS) game/g_local.h (defines "skillLevel" array) qcommon/q_shared.h (defines NUM_TOTAL_SKILLS as combination of NUM_SKILLS+NUM_FORCE_POWERS. NUM_TOTAL_SKILLS will replace NUM_FORCE_POWERS in files like bg_misc.cpp) ui/ui_force.cpp (changes from NUM_FORCE_POWERS to NUM_TOTAL_SKILLS) ui/ui_main.cpp (something about shifting an index of an array so that ownerDraw can identify new force powers? Also a similar function to ui/ui_shared.cpp with ownerDraw cases) ui/ui_shared.cpp (handles cases for ownerDraw, so it adds the UI_FORCE_RANK_PISTOL, UI_FORCE_RANK_BLASTER, etc integers as cases) ui/menudef.h (defines UI_FORCE_RANK_PISTOL, etc as integer values to be referenced later through ownerDraw in ingame_playerforce.menu) ui/ui_force.h (changes from NUM_FORCE_POWERS to NUM_TOTAL_SKILLS) I've come so far and made many changes. You can see exactly what I've done in the commit history of my GitHub I posted. The project builds successfully, but because of the bug with game/w_force.cpp, it doesn't function correctly and I don't know why. In addition (potentially unrelated to w_force.cpp), when I attempt to use my definitions "UI_FORCE_RANK_PISTOL" in ingame_playerforce.menu, I get a console error ingame which says ownerDraw was expecting an integer value. This makes sense, as UI_FORCE_RANK_PISTOL was defined as "299" in ui/menudef.h, and so changing ownerDraw UI_FORCE_RANK_PISTOL to 299 in ingame_playerforce.menu seems to remedy this problem. What would cause this definition to not be recognized? If you have any insights into any of this MP code, I would greatly appreciate it. Even explaining how the SP force powers operate could give some great insight into what's going on.
-
Hey all, I'm finally trying to get into source code edits and figured the best way to get my foot in the water would be to try and mix and match features from other code mods. In particular, I'm trying to bring the Gunnery System from OJP Enhanced to a clean build of JA++. I've learned quite a bit. OJP Enhanced essentially treats guns as new force powers. I got quite far just copying over lines from various files, but I got stumped with game/w_force.c From what I can tell, OJP's Gunnery code calls for me to execute this loop within void WP_InitForcePowers(): //[ExpSys] //apply our additional force powers for(i_r=0; forcePowers[i] && forcePowers[i] != '\n' && i_r < NUM_SKILLS; i_r++, i++) { readBuf[0] = forcePowers[i]; readBuf[1] = 0; ent->client->skillLevel[i_r] = atoi(readBuf); } //[/ExpSys] But JA++ looks like the void WP_InitForcePowers() function was rewritten drastically, using different variables and functions altogether. I'm looking at 2 GitHub commits from 2006 as my bible on this journey: JETPACK (Inception of Gunnery System): https://github.com/OpenJediProject/OJP/commit/49b0e5e4aec8ce5eea2ae86ffce9bb4a41c73b23 PISTOLS+BLASTERS+THERMALS+ROCKETS (Extra Guns added later) https://github.com/OpenJediProject/OJP/commit/05794119203790c198649fc5dee13799622839bb#diff-ed8f5bf9b1c13b35283e654fe8114bae You can take a look at my progress at this GitHub page: https://github.com/Setrilo/japp/tree/Setrilo-Gunnery-System/game It's just a fork of JA++ but with the changes I've implemented from looking at those OJP commits from 2006. The game/w_force.cpp within this repository is the one file in question. I would really appreciate any and all help getting over this roadblock. Even if it's just breaking down what the code I pasted is trying to do. I'd be especially grateful if someone is familiar with the changes to void WP_InitForcePowers() and could explain why they were made or how to interpret those changes. I plan on doing original code myself down the road but all of my ideas involve having a good understanding of how force powers, weapons, and character initialization/spawning are handled - so I'm eager to see this code work!
-
Okay so after some light investigating it was exactly as easy as I thought it would be thanks to some amazing comments. For anyone that's curious, I found the following code within bg_pmove.c: /* ============== PM_Accelerate Handles user intended acceleration ============== */ static void PM_Accelerate( vec3_t wishdir, float wishspeed, float accel ) { if (pm->gametype != GT_SIEGE || pm->ps->m_iVehicleNum || pm->ps->clientNum >= MAX_CLIENTS || pm->ps->pm_type != PM_NORMAL) { //standard method, allows "bunnyhopping" and whatnot int i; float addspeed, accelspeed, currentspeed; currentspeed = DotProduct (pm->ps->velocity, wishdir); addspeed = wishspeed - currentspeed; if (addspeed <= 0 && pm->ps->clientNum < MAX_CLIENTS) { return; } if (addspeed < 0) { accelspeed = (-accel)*pml.frametime*wishspeed; if (accelspeed < addspeed) { accelspeed = addspeed; } } else { accelspeed = accel*pml.frametime*wishspeed; if (accelspeed > addspeed) { accelspeed = addspeed; } } for (i=0 ; i<3 ; i++) { pm->ps->velocity[i] += accelspeed*wishdir[i]; } } else { //use the proper way for siege vec3_t wishVelocity; vec3_t pushDir; float pushLen; float canPush; VectorScale( wishdir, wishspeed, wishVelocity ); VectorSubtract( wishVelocity, pm->ps->velocity, pushDir ); pushLen = VectorNormalize( pushDir ); canPush = accel*pml.frametime*wishspeed; if (canPush > pushLen) { canPush = pushLen; } VectorMA( pm->ps->velocity, canPush, pushDir, pm->ps->velocity ); } } I removed the conditional, chipped away the bunny-hopping and voila: /* ============== PM_Accelerate Handles user intended acceleration ============== */ static void PM_Accelerate( vec3_t wishdir, float wishspeed, float accel ) { vec3_t wishVelocity; vec3_t pushDir; float pushLen; float canPush; VectorScale( wishdir, wishspeed, wishVelocity ); VectorSubtract( wishVelocity, pm->ps->velocity, pushDir ); pushLen = VectorNormalize( pushDir ); canPush = accel*pml.frametime*wishspeed; if (canPush > pushLen) { canPush = pushLen; } VectorMA( pm->ps->velocity, canPush, pushDir, pm->ps->velocity ); }
-
Hey all, I'm wondering if anyone could give me some insight into removing strafe jumping and bunny hopping from the multiplayer FFA/Duel gamemodes. I've noticed Siege disables strafe jump and would like to replicate this in the other game types, but I can only assume this is more difficult than copy-pasting some code and rebuilding from the OpenJK source. I plan to do some investigating later tonight, but if someone has already encountered this I'd mad appreciate some help.
-
You might be thinking of Singleplayer? I am talking about the Multiplayer screen where, after selecting "PROFILE" on the main menu, you get to the jamp/player.menu screen. This screen has a LISTBOX populated with the heads of all the models in the /models/players/ folder. For instance, if someone were to download and add their own model, my objective is to get this menu to also display a 3D preview of that model once they've selected it as their player skin. The "button" I created is just adding an action line to the LISTBOX so that every time they click it, ui_char_model is refreshed to be the model they selected. The problem is, I do not know how to make the "setcvar ui_char_model" line dynamic enough to change to the player's current character model (stored in the cvar: "model") JA+ and JA++ has this feature, but their creators edited the game's code to allow this. Same with, I believe, MOVIE BATTLES II. Thank you for the help (huge fan of your work btw). Just tried adding "setcvar ui_char_skin_head default" and "setcvar ui_char_skin_head model_default". Neither of those seem to change the value of ui_char_model though.
-
Thank you for the reply! But I think you didn't understand what I'm trying to do. I'm not trying to create separate buttons for a finite number of characters. What I'm trying to do is utilize the default table for character selection that comes with the scrollbar. That way, I can add an infinite number of characters and they all be able to be accessible without the need to create a button for each and every character. I want other people to be able to add their own models and not have to make any future edits to .menu files. A solution would be to do something like: setcvar "ui_char_model" "model", but I know that doesn't work because you can't pass a cvar value as the value for a cvar...as far as I know. Any ideas?
-
For MP Jedi Academy, I'm trying to edit a .menu file (specifically player.menu) to include a 3D preview of the selected player's model (much like the one in player2.menu). I understand that most people have achieved this by editing the game code itself, but I am wondering if anyone knows of a way to do this in just the vanilla version of Jedi Academy. I have copied the following lines from player2.menu into player.menu: itemDef { name character group models type ITEM_TYPE_MODEL rect 310 192 200 225 model_g2anim "BOTH_WALK1" asset_model "ui_char_model" model_angle 180 //mins maxs format is apparently z x y (hmmm... y x z?) model_g2mins -30 -15 -14 model_g2maxs 20 15 30 model_rotation 90 model_fovx 50 model_fovy 50 isCharacter 1 visible 1 decoration } However, "ui_char_model" only displays the model of "Jaden" in the Character Customization Window (player2.menu). The closest I have been able to get is adding these lines to the itemDef: action { setcvar "ui_char_model" kyle/default uiScript "characterchanged" uiScript "resetcharacterlistboxes" } As you can see, this just changes the model in the view to be Kyle Katarn. And even then, he has no textures applied to his model. Is there any way to set "ui_char_model" to the value stored in "model"? And how would I go about applying the texture?