Author Topic: kill count, xp, rewards  (Read 303 times)

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
kill count, xp, rewards
« on: October 07, 2014, 07:12:53 am »


               

I was hoping to get some help with a script I have been working on.


Basically I’m trying to award exp and gold based on the number of kills a PC has.


 


So how it would work is the PC would talk to an NPC then the NPC would check how many kills the PC has then gives them the reward.


 


So let’s say each kill is worth 10 exp points, NPC checks PC. PC has killed five creatures the PC would get 50 exp points.


Here is the script I'm using.


 


#include "nw_i0_tool"

void main()

{


object oPC = GetPCSpeaker();

int K = GetLocalInt(oPC, "TotalRatsKilled");


if  (K == 1)

{

RewardPartyXP(10, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 2)

{

RewardPartyXP(20, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 3)

{

RewardPartyXP(30, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 4)

{

RewardPartyXP(40, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 5)

{

RewardPartyXP(60, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 6)

{

RewardPartyXP(80, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 7)

{

RewardPartyXP(100, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 8)

{

RewardPartyXP(110, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 9)

{

RewardPartyXP(120, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}


if (K == 10)

{

RewardPartyXP(130, oPC, FALSE);

SetLocalInt(oPC, "TotalRatsKilled", 0);

}

}


Is their an easy'ier or better way of doing this. basicly to get the count then multiply it by 10.


I’m not sure if this even possible but any help on this would be great.


               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
kill count, xp, rewards
« Reply #1 on: October 07, 2014, 06:40:03 pm »


               

Assuming you want to just give 10xp per kill (the example you provided gives more XP at higher kills), you're over-thinking it. Just get the number of kills, multiply by 10, and provide the XP:

 



#include "nw_i0_tool"

void main()
{
    object oPC = GetPCSpeaker();
    int nKills = GetLocalInt(oPC, "TotalRatsKilled");
    int nXP    = nKills * 10;

    RewardPartyXP(nXP, oPC);
    SetLocalInt(oPC, "TotalRatsKilled", 0);
}


               
               

               
            

Legacy_Surek

  • Full Member
  • ***
  • Posts: 169
  • Karma: +0/-0
kill count, xp, rewards
« Reply #2 on: October 08, 2014, 06:41:09 am »


               

Thank you for your help. '<img'>