Aller au contenu

Photo

Gold for multiple items


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

#1
Bazilbrush

Bazilbrush
  • Members
  • 28 messages
I am a scripting newbie and I need some advice. I have a sewer keeper in my module who will give 15gp for each rat whisker the player gives him. The problem I am having is coming up with a script that will take all of the whiskers in theplayers inventory and give 15gp for each one. Can anyone help?

#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
"nw_i0_plot" has two useful functions in it for you.

GetNumItems

and

TakeNumItems

#3
Bazilbrush

Bazilbrush
  • Members
  • 28 messages
Thank you for taking the trouble to reply, Lightfoot. However, I am very new to scripting and wouldn't have a clue what to do with the functions. I was rather hoping that a generous soul would write a script for me lol. Hope someone can help!

#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
#include "nw_i0_plot"
const string  sRatWhisker = "Replace this with the tag of the rat wiskers";

void main()
{
  object oPC = GetPCSpeaker();
  int nNumWhiskers = GetNumItems(oPC,sRatWhisker);

  TakeNumItems(oPC,sRatWhisker,nNumWhiskers);
  GiveGoldToCreature(oPC,nNumWhiskers * 15);
}

Just place you tag for the whiskers in place of the string up top.

ex.
const string  sRatWhisker = "RatWhisker";

I also assumed that you wanted it wtitten for an 'Action Taken' script from a conversation node.

#5
Bazilbrush

Bazilbrush
  • Members
  • 28 messages
That works brilliantly, thank you so much Lightfoot.