Cellprocesses Posted September 4 Posted September 4 So Im playing with adding new player/NPC stats to the game I started with adding new variables to the PlayerStateBase class defined in q_shared.h. I set default values in that definition, then set new values depending on the NPC class in the NPC_Begin function located in NPC_Spawn, ie: if ( ent->client->NPC_class == CLASS_KYLE) { ent->client->ps.wisdom = 12; ent->client->ps.charisma = 20; ent->client->ps.dexterity = 17; } I can then access this variable elsewhere in functions in say, wp_saber.cpp, using: attacker->client->ps.wisdom; So I now have added custom attributes to all NPCs and the player, and can access them in functions, but I cant seem to set specific values for the player, when I did if ( ent->client->NPC_class == CLASS_PLAYER) { ent->client->ps.wisdom = 10; ent->client->ps.charisma = 9; ent->client->ps.dexterity = 11; } the default values never update, because NPC_Begin(...) only initializes NPCs, and the player isnt an NPC. Ive done some digging trying to find where the player gets initialized, but cant find it. SP_NPC_Player(...) in NPC_Spawn.cpp looked like it, but adding the lines to set custom attributes at the end of that function did nothing. Where is the player entity initialized in OpenJK?
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