Hello again! So, I had great success with my last thread asking for help with the CCEX plugin, and now I have a followup problem that I could use some help in resolving.
To recap: I have my character creator set up so that when a player selects a certain body type, it sets a variable to a certain value, which then shows the player the clothing folders associated with that body type. This works as desired, and I'm thrilled! However, when playtesting, I ran into a new dilemma. If the player chooses a "female" body type and adds a shirt to the body, which has breasts, then they decide to switch the body to a "male" body type with a flat chest... they're stuck with the shirt that has breasts.
I've been poring over the code for the Character Creator EX as well as Dynamic Actors (which uses a notetag <Force [section] Piece: [file-name]> to change the custom character's clothing) to see if there's some way I can use the same logic to resolve this situation. Ideally, I'm trying to create a condition to activate when the player selects a new body type that's like "If the preview image includes 'Clothing (i)' in Section ('Female Top'), change Clothing (i) to Clothing (0) in Section ('Female Top'), and equip 'Clothing (i)' in Section ('Male Top')." In this example, Clothing (0) is the "blank" image that is used to remove a section piece, and Clothing (i) is the offending article of clothing, which can be anywhere from Clothing (1) to Clothing (10).
I imagine I would have to use a for loop to check for each possibly equipped item -- that, I can set up. What I'm stuck on is the actual script to forcibly equip a piece in a section.
Within the CCEX .js, this code is used to add the image for the currently selected Section and Piece. I was hoping I could modify this to specifically reference a different Section and a different File, instead of currentSection and currentFile, but I've not had any luck.
Can anyone offer any suggestions to maybe steer me in the right direction? You can view the code for CCEX by clicking on "view" at the links above. I'm still a novice to JS (been going thru W3Schools as I study this code to try and educate myself on what I'm looking at!) but I'm determined to make this work. Any advice would be much appreciated! Thanks for all your help so far, folks!
To recap: I have my character creator set up so that when a player selects a certain body type, it sets a variable to a certain value, which then shows the player the clothing folders associated with that body type. This works as desired, and I'm thrilled! However, when playtesting, I ran into a new dilemma. If the player chooses a "female" body type and adds a shirt to the body, which has breasts, then they decide to switch the body to a "male" body type with a flat chest... they're stuck with the shirt that has breasts.
I've been poring over the code for the Character Creator EX as well as Dynamic Actors (which uses a notetag <Force [section] Piece: [file-name]> to change the custom character's clothing) to see if there's some way I can use the same logic to resolve this situation. Ideally, I'm trying to create a condition to activate when the player selects a new body type that's like "If the preview image includes 'Clothing (i)' in Section ('Female Top'), change Clothing (i) to Clothing (0) in Section ('Female Top'), and equip 'Clothing (i)' in Section ('Male Top')." In this example, Clothing (0) is the "blank" image that is used to remove a section piece, and Clothing (i) is the offending article of clothing, which can be anywhere from Clothing (1) to Clothing (10).
I imagine I would have to use a for loop to check for each possibly equipped item -- that, I can set up. What I'm stuck on is the actual script to forcibly equip a piece in a section.
Within the CCEX .js, this code is used to add the image for the currently selected Section and Piece. I was hoping I could modify this to specifically reference a different Section and a different File, instead of currentSection and currentFile, but I've not had any luck.
JavaScript:
this._previewWindow.addImage(this._fileList.currentFilePath(), this._fileList.currentSection(), this._fileList.currentFile());
Can anyone offer any suggestions to maybe steer me in the right direction? You can view the code for CCEX by clicking on "view" at the links above. I'm still a novice to JS (been going thru W3Schools as I study this code to try and educate myself on what I'm looking at!) but I'm determined to make this work. Any advice would be much appreciated! Thanks for all your help so far, folks!