Aller au contenu

Photo

Noob scripting


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
zethrenx99

zethrenx99
  • Members
  • 2 messages
Hi Im pretty new to scripting and was wundering if there is a way to save a PC's ability scores, and appearance when they enter the module so that i can call upon these variables in my other scripts, they have to be somehow stored by character so that it dosnt get mixed up with other players characters. any help will be greatly appreciated thanks.

#2
Shaughn78

Shaughn78
  • Members
  • 637 messages
The functions would be

GetAbilityScore
GetAppearanceType

Both of these functions will return integers and they can be saved as local variables

#3
Darin

Darin
  • Members
  • 282 messages
 // name the script
/*
   Description:
      This will grab the ability scores and appearence of an object that enters
       the trigger it's set on (may also work OnClientEnter, but not 100% on that)

       Stores as LocalInt on object with the following names:
           nSTR, nDEX, nCON, nINT, nWIS, nCHA, nAppearance
           
           Use GetLocalInt(oPC,"nSTR") in scripts to grab the strenght, etc.
*/

//Darin LaSota on 12/27/2012
//your name here

void main()
{
   object oPC = GetEnteringObject();
   if(GetLocalInt(oPC,"nSTR")==0) //this makes sure we only run once, if you don't want this, kill this loop
   {
      //replace FALSE with TRUE if you don't want the modified version
      int nSTR = GetAbilityScore(oPC, ABILITY_STRENGTH,FALSE) ;
      int nDEX = GetAbilityScore(oPC, ABILITY_DEXTERITY, FALSE) ;
      int nCON = GetAbilityScore(oPC, ABILITY_CONSTITUTION, FALSE) ; 
      int nINT = GetAbilityScore(oPC, ABILITY_INTELLIGENCE, FALSE) ;
      int nWIS = GetAbilityScore(oPC, ABILITY_STRENGTH, FALSE) ; 
      int nCHA= GetAbilityScore(oPC, ABILITY_CHARISMA, FALSE) ; 
   
      int nAppearance = GetAppearanceType(oPC);

      //now to save them
      SetLocalInt(oPC,"nSTR",nSTR);
      SetLocalInt(oPC,"nDEX",nDEX);
      SetLocalInt(oPC,"nCON",nCON);
      SetLocalInt(oPC,"nINT",nINT);
      SetLocalInt(oPC,"nWIS",nWIS);
      SetLocalInt(oPC,"nCHA",nCHA);
      SetLocalInt(oPC,"nSTR",nSTR);
      SetLocalInt(oPC,"nAppearance",nAppearance);
   }
}