Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   String being added twice (https://forums.graalonline.com/forums/showthread.php?t=68585)

Yen 09-07-2006 03:20 AM

String being added twice
 
The 'exp' portion of the code is adding the string twice..

PHP Code:

function CompleteQuest(acc) {
  
temp.reference findplayer(acc);
  for (
temp.0temp.this.questinfo.reward.size(); temp.a++) {
    if (
this.questinfo.reward[temp.a] == "gold") {
      
temp.reference.rupees += this.questinfo.reward[temp.a+1];
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "gold.");
    }
    else if (
this.questinfo.reward[temp.a] == "item") {
      
temp.ivars.loadvars("levels/archetype/" this.questinfo.reward[temp.a+1] @ ".arc");
      
temp.reference.AddItem(temp.ivars.wname,this.questinfo.reward[temp.a+1],this.questinfo.reward[temp.a+2]);
      
temp.reference.client.temp_addmessages.add("You gain" SPC temp.ivars.wname SPC "x" this.questinfo.reward[temp.a+2] @ ".");
    }
    else if (
this.questinfo.reward[temp.a] == "exp") {
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "EXP.");
      
temp.reference.AddEXP(this.questinfo.reward[temp.a+1]);
    }
  }



KuJi 09-07-2006 04:25 AM

Quote:

Originally Posted by Yen
The 'exp' portion of the code is adding the string twice..

PHP Code:

function CompleteQuest(acc) {
  
temp.reference findplayer(acc);
  for (
temp.0temp.this.questinfo.reward.size(); temp.a++) {
    if (
this.questinfo.reward[temp.a] == "gold") {
      
temp.reference.rupees += this.questinfo.reward[temp.a+1];
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "gold.");
    }
    else if (
this.questinfo.reward[temp.a] == "item") {
      
temp.ivars.loadvars("levels/archetype/" this.questinfo.reward[temp.a+1] @ ".arc");
      
temp.reference.AddItem(temp.ivars.wname,this.questinfo.reward[temp.a+1],this.questinfo.reward[temp.a+2]);
      
temp.reference.client.temp_addmessages.add("You gain" SPC temp.ivars.wname SPC "x" this.questinfo.reward[temp.a+2] @ ".");
    }
    else if (
this.questinfo.reward[temp.a] == "exp") {
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "EXP.");
      
temp.reference.AddEXP(this.questinfo.reward[temp.a+1]);
    }
  }



Did you try to debug it?
Try echoing this.questinfo.reward.size() at the top of the script.

If it returns it twice, that means two things are triggering to it - if thats > 1 that can also be why (just a thought)

ChibiChibiLuc 09-07-2006 04:51 AM

The EXP is only being added once, the function is only being called once, the item is only being called once, everything is only being called once.
I've debugged everything relating to it. I've even tried changing the order of operation.

contiga 09-07-2006 08:43 AM

Show the AddEXP function.
And an example of what this.questinfo.reward is set to.

Yen 09-07-2006 10:25 PM

Quote:

Originally Posted by contiga
Show the AddEXP function.
And an example of what this.questinfo.reward is set to.

Neither are the problem.

Admins 09-09-2006 05:36 PM

It must be AddEXP though?

contiga 09-09-2006 06:20 PM

Just show that string and function, I'm sure it must be in there.


All times are GMT +2. The time now is 11:23 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.