Aller au contenu

Photo

Need help rewriting this script: 10% XP given to party.


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

#1
MokahTGS

MokahTGS
  • Members
  • 946 messages
 I need a little help rewriting this script so that it gives the XP reward to the entire party and not just the player.

Help would be appreciated.

#2
kevL

kevL
  • Members
  • 4 078 messages
hey MTGS,

you probly want to use

GetFirstFactionMember(oPC, FALSE)
&
GetNextFactionMember(oPC, FALSE)


( otherwise only mainPC's are included )

#3
kamal_

kamal_
  • Members
  • 5 260 messages
//added some debug code, see if you are cycling through things correctly.

     void main()
     {
     object oPC = GetFirstPC(TRUE);
    object oMember = GetFirstFactionMember(oPC);
    SendMessageToPC(oPC, "Debug: first faction member is " + GetTag(oMember));
     while(GetIsObjectValid(oMember))
         {
         int nLevel = GetTotalLevels(oMember, FALSE);
         SendMessageToPC(oPC, "Debug: nLevel =" + IntToString(nLevel ));
         int nXP = (nLevel * 1000)/10;
         SendMessageToPC(oPC, "Debug: Granting xp:  " + IntToString(nXP));
         GiveXPToCreature(oMember, nXP);
         SendMessageToPC(oPC, "Debug: Grantied xp:  " );
        oMember = GetNextFactionMember(oPC);
        SendMessageToPC(oPC, "Debug: next faction member is " + GetTag(oMember));
       }
    }

#4
MokahTGS

MokahTGS
  • Members
  • 946 messages
Thanks guys...will test this in a bit.

The idea here is that as the player progresses, they get 10% of the experience needed toward leveling for each stage of the quest line.

#5
nicethugbert

nicethugbert
  • Members
  • 5 209 messages
Hmm, debug code would be a good way to help beginners learn to script beyond the basics. Some common problems, debug code, toy problems, etc.