Cerez Posted August 7, 2014 Share Posted August 7, 2014 Okay, unusual question: Is there any way to query the current player model and store the data in a custom variable through a console script (CFG) in JKA? Let's say I'm using the Kyle model, and I'd like to memorise the current model's gender and model name so that I can use it for reference in a script. What I'm trying to do is get the game to automatically determine if a player model is male, female, or alien, and load a new model in its place that corresponds to the appropriate gender, then toggle back to the original player model using the set variable. I know this is pretty advanced for JKA, but is there any way something like this could actually be accomplished? EDIT: I know that you can query the current player model with the model/playermodel command, but is there any way to store that info in a custom variable? Link to comment
Cerez Posted August 7, 2014 Author Share Posted August 7, 2014 Okay, I did some research and it turns out that you can set a custom variable (cvar) with the set command, but how do you transfer the value of model into the custom cvar? And, more importantly, is there a way to create a conditional (if-else) statement in a CFG script? Link to comment
therfiles Posted August 7, 2014 Share Posted August 7, 2014 And, more importantly, is there a way to create a conditional (if-else) statement in a CFG script? Currently, no. You can ghetto-rig it in SP by making a menu that opens, tests a cvar, runs the commands, and quits. Very hacky, though. May work in MP...not sure. Cerez likes this Link to comment
Cerez Posted August 7, 2014 Author Share Posted August 7, 2014 Currently, no. You can ghetto-rig it in SP by making a menu that opens, tests a cvar, runs the commands, and quits. Very hacky, though. May work in MP...not sure. Hmm… what would that involve? Does that mean changing the game code? How would you open a menu to test a cvar and run the commands? Link to comment
Asgarath83 Posted August 7, 2014 Share Posted August 7, 2014 I think you need to edit code for making something like the autodetecting base model. withiut code manipulation and conseqiuental headack, the faster way is to replace the stormtrooper model, when engine not found a model, set ever the stormtrooper as model default, you can see that using with cheat console "playermodel pappaperò" and you see a error message cannot found "pappapreo" model and the model begin a stormtrooper XD.sure in the mod you neet to configure the stormtrooper, shaders, and NPC files in another path of playermodel for fix that. on the UI command you can set something like that: setcvar snd "kron" setcvar g_char_model "reborn" setcvar g_char_skin_head "model_boss" setcvar g_char_skin_torso "model_boss" setcvar g_char_skin_legs "model_boss" setcvar g_char_color_red "255" setcvar g_char_color_green "255" setcvar g_char_color_blue "255" setcvar sex "m" setcvar g_saber_type "single" setcvar g_saber "single_9" setcvar g_saber_color "red" setcvar cg_crosshairForceHint "1" close all ; exec "exec gamestart.cfg" o suppose the existance of similar command for the gamestart or autoexe.CFG files Link to comment
Cerez Posted August 7, 2014 Author Share Posted August 7, 2014 Where did you get these commands Asgarath? Most of these cvars don't seem to be present in MP at all... However, "sex" is, and it holds the value I'm looking for for the gender of the character ("male" or "female"). Now I have all three variables that I need: 1. model = the current player model2. sex = the current player model gender3. old_model = my custom cvar used to store a string Now the question is whether/how it is possible to tell the engine to store the current value of model in old_model. set old_model model is interpreted literally, and not as a variable with a stored value. Is there a way to indicate that model is a variable, not a string? P.S. snd doesn't seem to work from the command line, either… :/ The voice seems to be tied to the sound.cfg defined in each model... Asgarath83 and therfiles like this Link to comment
therfiles Posted August 7, 2014 Share Posted August 7, 2014 I'm pretty certain those are all valid commands, but they are all in SP (as they involved character customization) What the menu idea would involve would be to create a menu, that's not fullscreen (so the background game is still drawn) and is completely clear, and then there would be an invisible button present via the cvar test feature (menus have the ability to show certain buttons when a cvar value is set correctly, we're simply stealing that functionality) and then the mouseover function would run the desired command. Again, it's hacky, only been tested in MP and displays the menu cursor briefly, disruping gameplay. I'd personally recommend looking into doing it via coding, as it will probably give you a much more successful result. Cerez likes this Link to comment
Asgarath83 Posted August 7, 2014 Share Posted August 7, 2014 i am not much expert of these things @ but in many mods i downloaded there is a CFG files... and many ui files. in the newgame_first.ui file of many mod SP you can found these parameters for define the appaereance of the player when you start the mod.otherwise, their are absoluteley value. you need code hacking like @@therfiles tells. and i cannot help to you with that. the other way is to making three button for start a new game: one for a male character, one for a female. at the menu opens, you can set the char paramter to a default \ undefinied alien sex model. so, maybe can be 3 bottoms: "PLAY AS MALE" "PLAY AS FEMALE" "CONTINUE" the first 2 bottons contains new cvars strings for chabnge character appereance and modeò. the CONTINUE, instead, reset all to defeualt, an example of this starting menu is for the SP little mod Revenge of the Droid, yoyu can choose of play the same level as some jedi males, females, asajj ventress, or a clone trooper, or a battledroid of the New Trilogy. Cerez likes this Link to comment
Cerez Posted August 7, 2014 Author Share Posted August 7, 2014 Thanks for your help guys. Hmm... This is not quite what I'm looking for. I have a mod that needs to activate a player model based on the player's current settings, and then revert back to the original model with the same toggle function. I need to be able to store a value from an existing cvar in a newly created one in order to remember the player's previous model and revert back to it. Link to comment
eezstreet Posted August 8, 2014 Share Posted August 8, 2014 CFGs don't handle conditional statements because they're just console commands that get executed, as you say. Your best bet would be to do something like an ICARUS script, assuming you're going for an SP map or mod or something. Then you would simply need to check the value of the "sex" userinfo cvar. Link to comment
Cerez Posted August 8, 2014 Author Share Posted August 8, 2014 Thanks, unfortunately this is for MP, and I'm okay to let go of the conditional concept (since there's no real scripting possibility in MP), but is there a way to transfer a value between cvars? Can I assign the value of one cvar to another through the console? Then I could create three different commands based on the player's gender/species, and make them toggle the new models on and off. Link to comment
therfiles Posted August 8, 2014 Share Posted August 8, 2014 I can't think of anything off-hand...would you mind breaking down exactly what you're looking for? Maybe we can think of some hacky work arounds... Cerez likes this Link to comment
Cerez Posted August 8, 2014 Author Share Posted August 8, 2014 Thanks @@therfiles. My idea is this: The player has selected a model/character at the beginning of the game. When the script runs as activated by a bound key, the value of the model cvar is saved in a newly created custom cvar called old_model. Then the model is changed to a new model as defined in the script (think change of clothes). When the player presses the action key again, the value from old_model is used to restore the player's previous model (clothing). I'm not sure if something like this would be possible to do in MP, but if we can somehow transfer a value between variables, then there's a chance I could finish this mod. therfiles likes this Link to comment
therfiles Posted August 8, 2014 Share Posted August 8, 2014 Would this be done via the profile menu? Or through a custom UI (where we can set and change cvars easily)? I suppose my real question is does this need to work for an undefined number of models? Or a set list? I've already got a few ideas! But no, there is no way to directly transfer one cvar to another, but don't give up hope. Give me a few more details then I can share what I have in mind (if I'm reading you right) Cerez likes this Link to comment
Asgarath83 Posted August 8, 2014 Share Posted August 8, 2014 mmm... it's an hard question. the unique variable you can change by key command is the key binding that you can set into the consol... or the CFG file. bind backspace dropsaberbind F1 "saber reaver1"bind F2 "saber reaver2"bind F3 "saber reaver3"bind F4 "saber reaver4"bind F5 "saber reaver5"bind F6 "saber reaver6" but their are absolutely value, as you can see.i understood what you want: you want something like certain mmorpg or RPG like Kotor or Neverwinter, when you can change appeareance of character changing the model. example: basic model is withut clothes. with button "add shoes 1" "add shoes 2" etc etc... and you add a new kind of shoes, in game, maybe after some event the character lose his shoes and you want he automatically revert, without any command specification to the default model without clothes and dresses, right? pity your mod is for MP, on SP you can use the "SET_PLAYERMODEL" and also the SET_SKIN command. if you use the variable with Declayre, set, if and else of icarus you can something like you want... in SP... maybe can must be also for MP, but you need to creat a map with the info_player_start of MP inside a trigger_once that activate the script of customization model cvars when start the map.i think can be the value of float 0 for the model_old and when you change a model ,the value lose -1 point, so if you have 5 models, 0 1 2 3 4 and you activate the script, the model 1 become the 0, the 2 is the 1, the 3 is the 2 and the 4 is the 3.at moment, i not have other ideas. :Sand i not think is the correct way... but maybe is a good suggeestion. i hope. i not know. :Sit's just theorical Cerez likes this Link to comment
Didz Posted August 10, 2014 Share Posted August 10, 2014 This is possible on Makermod using the Makermod Client Plugin that I wrote*. I have an evalset command where you can do this for example: /evalset model $old_model$ which would interpret the $old_model$ bit as a token that it will look-up in either Makermod-specific variables, serverinfo variables, or your game's cvars. I'm not sure how you can do this without a mod though. There might be a way to do it in ICARUS to set a cvar to another cvar's value, but I'm not sure. Certainly in ICARUS you can do SET_PLAYERMODEL, but I'm not sure how you would get the value of the other model to swap in. * Except the Makermod website is currently offline for some reason... Asgarath83 and Cerez like this Link to comment
Morabis Posted August 19, 2014 Share Posted August 19, 2014 Using Ja++ client and figuring out how to make a lua plugin might solve your problem. eezstreet likes this Link to comment
eezstreet Posted August 20, 2014 Share Posted August 20, 2014 Oh, I completely forgot about vstr. Try using them to achieve what you're going for.Here's a pretty extensive guide regarding what can be done with JA's .cfg files (it's identical to how it works in Q3):http://www.quakewiki.net/archives/scarab/Scripts_Toggles/scripts_toggles.html Cerez likes this Link to comment
Didz Posted August 20, 2014 Share Posted August 20, 2014 I don't think this can be achieved with vstr, at least not in the situation @@Cerez wants where the game will save the player's current model while the game is running. It's possible to do it statically without getting the model dynamically though. Aka you'd have to write down in a script what the old model is.set model1 "model kyle; set sex male; set switchModel vstr model2" set model2 "model jan; set sex female; set switchModel vstr model1" set switchModel "vstr model2" bind X "vstr switchModel" As Morabis mentioned above, this should actually be possible with the JA++ client in a Lua plugin. The Lua scripting interface that JA++ exposes is a very powerful tool. Cerez, eezstreet and Morabis like this Link to comment
Cerez Posted August 21, 2014 Author Share Posted August 21, 2014 What I'm effectively looking for is a way to pipe the results of a VSTR to a CVAR through the console in base JKA. I.e.: set oldModel "placeholder"set thisModel modelvstr thisModel --> pipe the result to oldModel EDIT: Even better; directly pipe the result of "vstr model" into a user variable. It's strange that the Quake 3 console should not have a way to pass the value of an returned command into a variable, or some way to directly pass on the value of a variable into another variable… :/ Link to comment
Didz Posted August 21, 2014 Share Posted August 21, 2014 It's strange that the Quake 3 console should not have a way to pass the value of an returned command into a variable, or some way to directly pass on the value of a variable into another variable… :/ The console/cvar/command system was only meant for configuration, not scripting. eezstreet likes this Link to comment
Cerez Posted August 22, 2014 Author Share Posted August 22, 2014 Darn… I'm going to give up on this one, then. If it won't work in base JKA, then I'm not really interested in developing this mod any further. My hope was that there was at least some way to store the player's current model in memory, and recall it when needed, but it seems the only place that can be done in the base game is through an SP Icarus script. The mod itself is a cloaking device, that lets the player cloak their character (make them hard-to-see/near-invisible) at the push of a button, and loads an appropriate stylistic visual representation based on the gender/type of the player's model (human male, human female, alien), then lets them toggle the cloaking device off with the same button, and reverts their model back to the default look. It was intended to add extra functionality and challenge in MP duels. I guess instead of making it a general function mod for all in-game models, I will have to make use of this as an additional skin/option for particular new models, with an additional script included that has this toggle function hard-scripted and bound to a key. Well, if anyone has a model/character who likes to use a special cloaking device to their advantage, and they are interested in incorporating my work in their player model release, let me know. Thanks everyone for your help. Asgarath83 likes this Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now