SetGender()?
#1
Posté 02 septembre 2011 - 03:50
#2
Posté 02 septembre 2011 - 06:09
Is SetGender supposed to also alter the appearance or does it just alter the settings on the object so that GetGender will return the expected value? I suspect the later. Create a conversation for them that tells what their gender is before and after SetGender and see if it changes. I suspect changing the appearance is going to be more problematic.
Regards
#3
Posté 02 septembre 2011 - 07:05
It technically changes the sex, but the appearance won't change until the info is re-read, which might mean booting the player or loading an area again, i was not able to see this happen though. To do it in MP use a bic editing script or tool is probably a better idea.
#4
Posté 02 septembre 2011 - 11:04
#5
Posté 02 septembre 2011 - 11:27
Trannies.The Fred wrote...
So GetGender() will return the newly modified value, but the appearance won't change? Hmm, that would kind of suck, I thought the whole point of the function was so we didn't need appearance workarounds.
#6
Posté 04 septembre 2011 - 02:18
#7
Posté 04 septembre 2011 - 06:33
I think the best way is just going to be to use different appearance lines. Is there a (simple) isomorphism between those lines and the default appearances, or am I looking at a big switch here (or I guess you could cache the lines on module load)?
#8
Posté 09 septembre 2011 - 04:32
Make generic blueprints of each of the races and make a script to check the race and gender that needs to be changed. Script to change to one of the generic blueprints.
#9
Posté 09 septembre 2011 - 04:49
It works just like swimming, and is reversable, and is also well tested. ( and you can see it in my appearance picker so a DM can apply it at their whim, or fix it )
I'd strongly suggest getting my code and row numbers( it actually is just a small sliver of the CSL which is needed and Pains monster pack ), just to ensure this sort of things is interoperable with other community content. It's already in my monster pack, and it's the same code that does swimming, horses, etc so this would reduce overhead if you used those things as well. There is no real link by default, but if everyone uses my mappings, then it can be assumed if a creature is in a range, then you know they are female overriden and their original appearance is X. I configure it via a 2da, so you can add new features as needed. ( code is in the appearance include, and i think there are a few other includes you'd need but those could be rewritten easily or hard coded so just a few functions are needed )
No idea how to change blueprints on a creature, much less a player.
Modifié par painofdungeoneternal, 09 septembre 2011 - 04:54 .
#10
Posté 11 septembre 2011 - 11:38
So if youw ant to use it, you make a "lobby module", in your module when you call setgender on a PC, you make him load the lobby module and you get him back the the place he left,.
#11
Posté 12 septembre 2011 - 08:15
I'm thinking rather than using a massive switch it might be better to go through the 2da lines are startup and save them as variables on a waypoint or ipoint or something. The labels for each line have the number of the corresponding original line in them so that should be easy. Then you can just look up a number on the given object (in my language, I guess that object would be embodying the isomorphism between the 2da rows
Modifié par The Fred, 12 septembre 2011 - 08:17 .
#12
Posté 05 octobre 2011 - 11:55
It uses two switches, one inside the other. It won't deal with more than 11 at any one pass, doing a switch with 200 values is not a good idea.
Here is the original code -->
http://nwcitadel.for...read.php?t=1766
( note that the current CSL has this updated, and you can just copy any functions you need out of it )
Other benefit is that i am updating the monster pack, so anything that uses this will get both script and 2da that match as new things are released. I am only doing the monster pack because i need synergy with the monsters and the scripting. You probably want to use my monster constants for appearance, so as i integrate more, it's just going to work. ( the default game provided ones have too much leftover content from NWN1 )
I also have a 2da i use to allow you to add your own sets, i have swimming, horse riding and 2 genders at the moment. 2da is so you can disable this entirely if you don't have the haks related to horse riding in your module. Advantage to using one lookup code, is it's shareable between all 4. I am working on a way to regenerate the appearance lines dynamically so any edits done to the original rows can be easily copied to each appearance override row.
( horse riding is just mocked up, but hellfire is busily working on it ATM )
Reversing out the value is easy, if its in that range, it's an override, and the reverse value for what the player was is easy to obtain. For the most part you just need to use the overall function, but it's very efficient in how i got it working.
I'd suggest applying a appearance override AND setting the gender, followed by a forced save of their character, and when they re-enter the module, remove the override entirely and they should stay changed to the other sex. This lets you use both features, and just use the override as a temporary fix to make it visible they got gender changed, but using setgender to make sure they are actually changed.
You probably want a remove override on PC loaded regardless.
Modifié par painofdungeoneternal, 05 octobre 2011 - 11:57 .
#13
Posté 07 octobre 2011 - 12:04
In terms of switching a PC's gender, it's probably easier just to simulate it by altering their appearance and leaving the gender as it is. This might require a bit more work for certain unusual instances but as far as the gender switching goes, it beats kicking them out of the module and having them rejoin. I guess you can send them to a mini-module and back but that also seems awkward.
For NPCs, I can't remember now whether I determined jumping them to another area and back does actually work or not, but since the primary use I can think of is to populate and area with random NPCs, it mightn't ever matter what their gender actually is (though you could get some weird issues if it ever did...).
#14
Posté 07 octobre 2011 - 01:02
So if the range starts at 200, human is 7, and it's the 4th one in the row ( guessing on that, it does not matter ).
Then we have ranges - see this -> http://nwn2.wikia.co...rved_2da_ranges
3600 3799 = male
3800 3999 = female
4000 4199 = swimming
4200 4999 = climbing / riding / whatever and i intend on extending this out
5000 is in the wrong row, and i just have it there for legacy support ( i think i skip row 0 anyway to label teh ranges so it could be just used technically with no issues )
There are so many blank rows, my intention is to keep adding blocks of 200 above 5000, and put any real monsters into the area below. If you are doing monsters, i am more than happy to help prep the rows involved so they work well.
Inside each range it's the same pattern, all the ranges are contiguous, as new humanoid creatures are added ( and i am the one doing that ATM ) i can add them to the switch and 2da, and this uses a 2da to configure now so it's not all hard coded. I plan on having my tools available so you can do it yourself as well.
Given the above human, he's at 3604 at the moment.
So if the appearance is above 3599, its a an override, if it's below that i don't have to do anything as it's not using my system at all. This makes sure i only do work if needed.
If it's 3600-3799, i know its a male override. Since it's 4 into that range, i then use a switch to lookup the original value. Unless we redo appearance.2da completely it has to use a switch like this, and this basically converts 4 to 7 and 7 to 4.
So i see 3604, i pass it's appearance in and it changes it to 7. I have a male override and apply a female override, it converts it quickly to a 7, then to 3804. An issue with this is that it's hard to store data on the player without some unreliable solution using items in inventory, creature hides, databases or whatnot, and if they logout and come back in, that appearance is permament.
SetGender is a good idea since you can ONLY do one appearance override at the moment, and unless they are SP ( in which case you pop em to a new module for a minute ), they will likely only be logged in for 3-4 hours at most. On player loaded you should remove the override, other wise if the player logged out while they were swimming in the lake, and your server resets, they will show up in your game lobby swimming. Using setgender and override work well together, and it's easy to do the function that comes with the game when you apply the override, assuming its permament.
Right now i do the master 2da for appearance, if anyone wants to do something using this, just release it and i will put it into the appearance.2da. I can set up a appearance override using this pattern very quickly, just copy paste and then search and replace the needed lines. Going to have a more advanced tool that recreates it as needed.
At the moment my appearance.2da is the most widely used 2da for appearance, and if not the particular lines can be merged in to your own 2da. Whenever a new monster who uses the 5 skeletons ( human, elf, dwarf, gnome, ogre ) is added, i will go and do what is needed to make it work with all appearance overrides known.
#15
Posté 07 octobre 2011 - 11:27
there are 3 things that i see when i look for gender in the game
getgender
setgender
and gender.2da
What is unclear to me is, how getgender works...if so many things are linked to gender, how come u can just pick it up like this but cant dynamically modify it, is getgender actually linked to some reference or function that actually gets u to gender(or what ?).
Things iw been thinking(theoretical idk how to do it, or even possible):
- add 1 more gender to 2da and somehow tie it into some script or logic to enable setgender instantly
- if all instances where gender is needed use getgender, than perhaps somehow changing what getgender can pick up(create an overload, or some interface),or maybe new function to replace getgender altogether
-my original idea was to find the memory address where gender is stored, and change it, but im not even sure that it works that way
(iw got no solid hold of the things here so correct me if im wrong)
Modifié par aramoro999, 07 octobre 2011 - 11:36 .
#16
Posté 07 octobre 2011 - 02:58
Gender is almost solely used to determine sound set, using a ? is swapped out for loading resources, models, animations, and sounds - the ? is for example in the appearance.2da. In other countries there also is a gender specific tlk file to account for languages like german having gender specific words.
getgender is used mostly for dialogs, so you can do different wording for dialogs. Setgender almost does not work.
Most of what it does is completely ignored.
If you want to do memory addresses, you want to be doing NWNx development ( http://www.nwnx.org ), which allows you to add completely new features just like the devs can. I can think of a lot more important things that we'd need if you have the chops for that. Note that the setgender issue is not going to be easily fixed without redoing far more than just a memory address.
#17
Posté 07 octobre 2011 - 04:23
In terms of changing a person's gender, as Pain says SetGender() barely even does anything useful. For an SP mod (particularly an English one), it's probably simpler never actually to change the gender and just deal with everything by hand.
#18
Posté 07 octobre 2011 - 05:55
I get to work and see how far i can get...
#19
Posté 08 octobre 2011 - 10:53
The Fred wrote...
Obviously because the new lines work at offsets, you can biject between them using +/- the offset value quite easily. All I'm saying is that it's a shame it's not easier to go from the original entries to the new ones (you need a big switch for this). It might actually have been better to repeat the whole 2da file again, or at least the range with the PC models in (though you get issues if you then want to add a new dynamic model) with the same gaps between them, only that would leave you with a massively bloated file. This sounds like a job for the auto-installer, if only it existed.
I get the feeling that you are assuming things based on not looking at the code, but based on how you'd do it yourself, not sure where the big switch is as i've designed it so that is not an issue.
It only has to switch about 30 entries at most, with it being on average closer to 10, so it's not a 200 item switch but a big 20 item switch with a set of smaller 10 item switches inside. How it's done is very efficient and no real work for the computer to do. Note that getting a localstring actually requires the game to iterate all the variables on the target until it gets the correct one underneath the hood, which is a reason i get variables by index now when possible.
I'd think redoing the 2da just to make this work without a switch is going to cause major compatibility problems all over the place, even with the installer, it would make every module, instanced creature, character bic and blueprint suddenly need to be redone, not even paying attention to the 2da's for polymorph, subraces and the rest.
Modifié par painofdungeoneternal, 08 octobre 2011 - 10:55 .
#20
Posté 10 octobre 2011 - 08:18
#21
Posté 13 octobre 2011 - 09:35





Retour en haut






