Jump to content

Home

How would one go about "grabbing" a player/npc's attrib, skill and fp values?


mrdefender

Recommended Posts

How does one go about grabbing a party member's influence, attributes, skills and/or force point value?

 

Sortof like that 'remote gets party influence' modification, I want to add all mentioned above to my party editing options for my wrist console. So far you're editing blind. Would be nice to be able to see the current value of one of those during/after changing it...

 

int PlayerStrength = GetAbilityScore( GetPCSpeaker(), ABILITY_STRENGTH );
int PlayerAwareness = GetSkillRank( SKILL_AWARENESS, GetPCSpeaker() );

int AttonStrength = GetAbilityScore( GetObjectByTag("Atton"), ABILITY_STRENGTH );
int AttonAwareness = GetSkillRank( SKILL_AWARENESS, GetObjectByTag("Atton") );

SetCustomToken(11,PlayerStrength);
SetCustomToken(12,PlayerAwareness);
SetCustomToken(21,AttonStrength);
SetCustomToken(22,AttonAwareness);

Current Player Strength <CUSTOM11>
Current Player Awareness <CUSTOM12>
Current Atton Strength <CUSTOM21>
Current Player Awareness <CUSTOM22>

 

I'm guessing the "get object by tag" , instead of get pc speaker, for NPCs

 

Can't seem to figgure out how the influence would work.... ??? :giveup:

Link to comment
Share on other sites

So far I've got this:

 

int StartingConditional() {

 object oPlayer = GetFirstPC();
 object oAtton	 = GetObjectByTag("Atton");
 object oBaodur = GetObjectByTag("Baodur");
 object oMand	 = GetObjectByTag("Mand");
 object oG0T0	 = GetObjectByTag("G0T0");
 object oMaiden = GetObjectByTag("Handmaiden");
 object oHK47	 = GetObjectByTag("HK47");
 object oKreia	 = GetObjectByTag("Kreia");
 object oMira	 = GetObjectByTag("Mira");
 object oT3M4	 = GetObjectByTag("T3M4");
 object oVisas	 = GetObjectByTag("VisasMarr");
 object oWookie = GetObjectByTag("Hanharr");
 object oMical	 = GetObjectByTag("Disciple");

// ================================================================================ //
// ================================================================================ //
// ================================================================================ //
// ================================================================================ //
// ================================================================================ //

 // PLAYER ATTRIBUTES //
 int PlayerAttribSTR = GetAbilityScore( GetFirstPC(), ABILITY_STRENGTH );
 int PlayerAttribDEX = GetAbilityScore( GetFirstPC(), ABILITY_DEXTERITY );
 int PlayerAttribCON = GetAbilityScore( GetFirstPC(), ABILITY_CONSTITUTION );
 int PlayerAttribINT = GetAbilityScore( GetFirstPC(), ABILITY_INTELLIGENCE );
 int PlayerAttribWIS = GetAbilityScore( GetFirstPC(), ABILITY_WISDOM );
 int PlayerAttribCHA = GetAbilityScore( GetFirstPC(), ABILITY_CHARISMA );

 // PLAYER SKILLS //
 int PlayerSkillComputer 	= GetSkillRank( SKILL_COMPUTER_USE, GetFirstPC() );
 int PlayerSkillDemolition 	= GetSkillRank( SKILL_DEMOLITIONS, GetFirstPC() );
 int PlayerSkillStealth	= GetSkillRank( SKILL_STEALTH, GetFirstPC() );
 int PlayerSkillAwareness 	= GetSkillRank( SKILL_AWARENESS, GetFirstPC() );
 int PlayerSkillPersuade 	= GetSkillRank( SKILL_PERSUADE, GetFirstPC() );
 int PlayerSkillRepair 	= GetSkillRank( SKILL_REPAIR, GetFirstPC() );
 int PlayerSkillSecurity 	= GetSkillRank( SKILL_SECURITY, GetFirstPC() );
 int PlayerSkillTreatInjury 	= GetSkillRank( SKILL_TREAT_INJURY, GetFirstPC() );

 // PLAYER FORCE POINTS //

 int PlayerForcePoints = GetMaxForcePoints(GetFirstPC());

 // PLAYER CUSTOM TOKENS //
 SetCustomToken(11,PlayerAttribSTR); [b](* this is line 54 *)[/b]
 SetCustomToken(12,PlayerAttribDEX);
 SetCustomToken(13,PlayerAttribCON);
 SetCustomToken(14,PlayerAttribINT);
 SetCustomToken(15,PlayerAttribWIS);
 SetCustomToken(16,PlayerAttribCHA);

 SetCustomToken(17,PlayerSkillComputer);
 SetCustomToken(18,PlayerSkillDemolition);
 SetCustomToken(19,PlayerSkillStealth);
 SetCustomToken(20,PlayerSkillAwareness);
 SetCustomToken(21,PlayerSkillPersuade);
 SetCustomToken(22,PlayerSkillRepair);
 SetCustomToken(23,PlayerSkillSecurity);
 SetCustomToken(24,PlayerSkillTreatInjury);

 SetCustomToken(25,PlayerForcePoints);

}

 

 

 

But I get these errors when I try to compile the script, sadly I'm not sure what's going on with that...

 

Lookup path root set to: C:\Games\KOTOR2\
Loaded nwscript.nss via key file lookup
Compiling: defmod_c_stats.nss
defmod_c_stats.nss(54): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(55): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(56): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(57): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(58): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(59): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(61): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(62): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(63): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(64): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(65): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(66): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(67): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(68): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(70): Error: Type mismatch in parameter 2 in call to "SetCustomToken"
defmod_c_stats.nss(72): Error: Not all paths return a value
Compilation aborted with errors
Total Execution time = 31 ms
Press any key to continue . . .

Link to comment
Share on other sites

int PlayerAttribSTR = GetAbilityScore( GetFirstPC(), ABILITY_STRENGTH );

(snip)

SetCustomToken(11,PlayerAttribSTR);

(snip)

defmod_c_stats.nss(54): Error: Type mismatch in parameter 2 in call to "SetCustomToken"

 

The SetCustomToken() function takes a string value as the second parameter, while you are trying to use an integer variable. You'll have to typecast your integer to a string like...

SetCustomToken(11, IntToString(PlayerAttribSTR));

...for it to work.

 

defmod_c_stats.nss(72): Error: Not all paths return a value

 

Since you use a StartingConditional() and not a main() function you must return TRUE some place that will always be arrived at in the script, suitably at the bottom since you don't have different paths of execution as far as I can see.

Link to comment
Share on other sites

The SetCustomToken() function takes a string value as the second parameter, while you are trying to use an integer variable. You'll have to typecast your integer to a string like...

SetCustomToken(11, IntToString(PlayerAttribSTR));

...for it to work.

 

Done :)

 

Since you use a StartingConditional() and not a main() function you must return TRUE some place that will always be arrived at in the script, suitably at the bottom since you don't have different paths of execution as far as I can see.

 

Heh. tried "return true;" , but it's case sensitive... "return TRUE;" hehe... :$

 

Would this cause any problems? I tried simply adding "return true;" at the end but the compiler didn't like that :lol:

int align = GetGoodEvilValue(GetPCSpeaker());

if(align >= 0 && align <= 30) { return TRUE; }

else { return FALSE; }

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...