Author Topic: BROKEN!  (Read 550 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« on: July 14, 2015, 06:27:22 pm »


               

I think I broke a script and do not really know how to fix this....


 


I am using  http://neverwinterva...rp-award-system<-  for my module and also imported the DMFI widgets (latest version)  and  created a script that I got the widgets once the character got into the ooc room (preferably would like some pointers to make it check if the player has visited for the first time so it won't give the player the widgets on each reset.)


 


it looks like this: 


 


void main()

{

    // Get the creature who triggered this event.

    object oPC = GetEnteringObject();

 

    // Only fire for (real) PCs.

    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )

        return;

 

    // Only fire once per PC.

    if ( GetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF)) )

        return;

    SetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

 

    // Give stuff to the PC.

    CreateItemOnObject("dmfi_pc_emote", oPC);

    CreateItemOnObject("dmfi_pc_dicebag", oPC);

    CreateItemOnObject("dmfi_pc_follow", oPC);

    CreateItemOnObject("dmfi_playerbook", oPC);

    CreateItemOnObject("rp_awards", oPC);

}

 

 

but now the widget for the rp award system keeps giving me a  "IMPROPER USE OF ITEM!" which is in my experience that I broke the script.....

 

anyone know how to fix this?


               
               

               
            

Legacy_The Mad Poet

  • Hero Member
  • *****
  • Posts: 715
  • Karma: +0/-0
BROKEN!
« Reply #1 on: July 14, 2015, 06:35:55 pm »


               

I was pretty sure when set up properly DMFI is already set to give players those items.


 


If the item that your using is giving you the 'IMPROPER USE OF ITEM!" error it isn't in this script, which is an on enter script and not an item use script. Post the item script instead.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #2 on: July 15, 2015, 09:11:07 am »


               
//script name:  rp_awards

//////////////////////////////////////////////////////////////////////////

//Created By: Geinsys (Guile)

//Created On: 9/01/09

/////////////////////////////////////////////

/*

   This script is for the DM item named:

   DM - Role Playing Wand

 

   Which will start a conversation with

   the DM and allow them to do a variety

   of functions based upon the selections

   available within the converation named

   "dm_rp_conv"

 

   see ***NOTE*** to adjust this script

*/

/////////////////////////////////////////////

 

//Required Include

#include "x2_inc_switches"

 

//Main Script

void main()

{

 

 //Stop here if the PC is not activating the item

 int nEvent =GetUserDefinedItemEventNumber();

 if(nEvent !=  X2_ITEM_EVENT_ACTIVATE)return;

 

 //Define all Variables here..

 object oPC = GetItemActivator();

 object oTarget = GetItemActivatedTarget();

 object oItem = GetItemActivated();

 object oMe = oPC;

 

 object oRP = GetItemPossessedBy(oPC, "rp_awards");

 int nRP = GetLocalInt(oRP, "DM_RP_AWARDS");

 string sRP = "You currently have ";

 sRP += IntToString(nRP);

 sRP += " Role Playing Points Awarded by DMs.";

 

 FloatingTextStringOnCreature(sRP, oPC, FALSE);

               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
BROKEN!
« Reply #3 on: July 15, 2015, 05:16:22 pm »


               

If I'm understanding you right it sounds like you have 2 different problems going on?


 


As for the issue with the items being created more than once, the problem is that variables that you add to the player don't stick over a reset. You can put the variables on items the player possesses though and they will. So the "DO ONCE" variable is not there when the script is looking for it. To fix this you can do one of 2 things. Either just check to see if the player has one of the items and if they don't then give them. Or add the "DO ONCE" variable to a "database item" the player will always have. For the first option something like this:


 


void main()

{

    // Get the creature who triggered this event.

    object oPC = GetEnteringObject();


    // Only fire for (real) PCs.

    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )

        return;


    // Test for one of the items. If not possessed give stuff.

    object oTest = GetItemPossessedBy(oPC, "tag of player book here");

    if (oTest == OBJECT_INVALID)

    {

        // Give stuff to the PC.

        CreateItemOnObject("dmfi_pc_emote", oPC);

        CreateItemOnObject("dmfi_pc_dicebag", oPC);

        CreateItemOnObject("dmfi_pc_follow", oPC);

        CreateItemOnObject("dmfi_playerbook", oPC);

        CreateItemOnObject("rp_awards", oPC);

    }

}


 


 


As for the second issue with the rp rewards wand, the script you posted isn't complete. It's missing some stuff. The description says it's suppose to start a conversation with the DM but there's no line to do so. Not sure if that's the only problem with that one or not.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #4 on: July 18, 2015, 06:45:37 am »


               


If I'm understanding you right it sounds like you have 2 different problems going on?


 


As for the issue with the items being created more than once, the problem is that variables that you add to the player don't stick over a reset. You can put the variables on items the player possesses though and they will. So the "DO ONCE" variable is not there when the script is looking for it. To fix this you can do one of 2 things. Either just check to see if the player has one of the items and if they don't then give them. Or add the "DO ONCE" variable to a "database item" the player will always have. For the first option something like this:


 


void main()

{

    // Get the creature who triggered this event.

    object oPC = GetEnteringObject();


    // Only fire for (real) PCs.

    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )

        return;


    // Test for one of the items. If not possessed give stuff.

    object oTest = GetItemPossessedBy(oPC, "tag of player book here");

    if (oTest == OBJECT_INVALID)

    {

        // Give stuff to the PC.

        CreateItemOnObject("dmfi_pc_emote", oPC);

        CreateItemOnObject("dmfi_pc_dicebag", oPC);

        CreateItemOnObject("dmfi_pc_follow", oPC);

        CreateItemOnObject("dmfi_playerbook", oPC);

        CreateItemOnObject("rp_awards", oPC);

    }

}


 


 


As for the second issue with the rp rewards wand, the script you posted isn't complete. It's missing some stuff. The description says it's suppose to start a conversation with the DM but there's no line to do so. Not sure if that's the only problem with that one or not.




 


 


thanks dude! that script can fix a big issue we would be having! '<img'>


               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #5 on: July 19, 2015, 06:32:57 am »


               

okay for some reason I do not know how to fix this..... this system http://neverwinterva...rp-award-system


 


I want to install in my module and according to the instructions and the demo mod all I have to do is to import the erf file and thenI should be ready to go.....


 


but that is not really happening.


 


 


 


So I checked the module scripts of that module, those are all standard scripts and all the scripts for the items are imported....so what am I doing wrong?



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
BROKEN!
« Reply #6 on: July 19, 2015, 09:12:16 am »


               

What part isn't working exactly? The DM wand? The player wand? The reward items not being created? All of it? '<img'>



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #7 on: July 19, 2015, 09:17:07 am »


               All of it, yes...
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
BROKEN!
« Reply #8 on: July 19, 2015, 09:43:44 am »


               

Hmm. So looks like you need an item for DMs with the tag "rp_awarder" and an item for players with the tag "rp_awards" (both without the quotes)? And you need to make the 10 items and give them the specific res refs? And of course this system relies on tag-based scripting so make sure it is turned on in your module/pw?


 


P.S. Looks like the author got his commenting mixed up at the top of the scripts. Or at least the "rp_awards". That one is not for the DM. And it's confusing about the naming part. You can give it whatever "name" you want. You just have to be exact with the tag.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #9 on: July 19, 2015, 04:27:14 pm »


               Hmm quite possible that I  Accidentally turned it off.


So any additional help on how to get this fixed would be grand!
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
BROKEN!
« Reply #10 on: July 19, 2015, 08:37:30 pm »


               

To make sure it is on go into your modules "OnModuleLoad" script and scroll down a little ways through the switches and look for the line:


 


SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);


 


And make sure it is not commented out. However, depending on how your module is set up to handle item scripts, this might have adverse effects like items firing scripts multiple times and other weird stuff.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #11 on: July 20, 2015, 07:25:22 am »


               

 I am currently still using the generic script for that since I have not implemented a  DB for it cause I FIRST want this to work '<img'>


 


so that like is actually in there on module load....



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
BROKEN!
« Reply #12 on: July 21, 2015, 10:59:35 am »


               

I'm not sure what to tell ya. I just imported it. Used the player item that the system comes with and I got the message it's supposed to give.



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #13 on: July 21, 2015, 08:45:44 pm »


               


I'm not sure what to tell ya. I just imported it. Used the player item that the system comes with and I got the message it's supposed to give.




 FIXED! It was actually very simple, the line HAD to be at the top of the script since otherwise it would simply take waaaay too long for the module to load so basically not loading it at all...


               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
BROKEN!
« Reply #14 on: July 22, 2015, 07:45:24 am »


               

Okay it WAS fixed, then I added something new and now it does not work anymore.... I have searched and tried to locate the error by myself BUT obviously to no avail otherwise I wouldn't be here to ask '<img'> 


 


I have currently 2 items that appear to use the tag system to work, however they just...don't.... if anyone can locate the problem then that would be grand!


 




#include "da_includefile_1"

#include "x2_inc_switches"

#include "sha_subr_methds"

//  If your module's OnActivateItem has custom scripting, just paste the following into it.

//  Be sure to include the file "da_includefile_1" at the very top, as it is here, above the void main().

void main()

{

{

     object oItem = GetItemActivated();

 

     // * Generic Item Script Execution Code

     // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,

     // * it will execute a script that has the same name as the item's tag

     // * inside this script you can manage scripts for all events by checking against

     // * GetUserDefinedItemEventNumber(). See x2_it_example.nss

     if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)

     {

        SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);

        int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);

        if (nRet == X2_EXECUTE_SCRIPT_END)

        {

           return;

        }

 

     }

 

}

object oDA_ITEM = GetItemActivated();

string sDA_ITEM = GetTag(oDA_ITEM);

string sDA_DETECTOR = "da_gladetecto";

string sDA_ENFORCER = "da_enforcerke";

string sDA_ITEMLEFT13 = GetStringLeft(sDA_ITEM, 13);

object oDA_ACTIVATOR = GetItemActivator();

object oDA_TARGET = GetItemActivatedTarget();

string sDA_TARGET = GetTag(oDA_TARGET);

string sDA_TARGETLEFT12 = GetStringLeft(sDA_TARGET, 12);

string sDA_CONTAINER = "da_jailcrate";

 

if (sDA_ITEMLEFT13 == sDA_ENFORCER)  //The lines for the Enforcer Key.

 {

  int iENFORCER = GetIsEnforcer(oDA_ACTIVATOR);

  int iEXEMPT = GetIsExempt(oDA_TARGET);

  if (iENFORCER == FALSE)

   {

    DestroyObject(oDA_ITEM);         //Make sure only authorized enforcers can activate this item.

    FloatingTextStringOnCreature("Only authorized enforcers may use that key.", oDA_ACTIVATOR, FALSE);

   }

  else if (GetIsPC(oDA_TARGET))

   {

    SetLocalObject(oDA_ACTIVATOR, "da_mytarget", oDA_TARGET); //If the target if a player, start a conversation for more options.

    AssignCommand(oDA_ACTIVATOR, ActionStartConversation(oDA_ACTIVATOR, "da_cnv_enforcrky", TRUE));

   }

  else if (sDA_TARGETLEFT12 == sDA_CONTAINER)

   {

    effect eKNOCK = EffectVisualEffect(VFX_IMP_KNOCK);

    ApplyEffectToObject(DURATION_TYPE_INSTANT, eKNOCK, oDA_TARGET);

    SetLocked(oDA_TARGET, FALSE);                                        //Unlock the Confiscated Item Crate, if that's the target.

    AssignCommand(oDA_TARGET, SpeakString("**unlocks temporarily**"));

    FloatingTextStringOnCreature("This container will be unlocked for the next twenty seconds, or until someone opens it.", oDA_ACTIVATOR, FALSE);

    float fDELAY = 20.0;

    DelayCommand(fDELAY, SetLocked(oDA_TARGET, TRUE));

   }

  else FloatingTextStringOnCreature("The key is inert.", oDA_ACTIVATOR, FALSE);

 }

 

if (sDA_ITEMLEFT13 == sDA_DETECTOR)  //The lines for the Gladi-Detector.

 {

  if (GetIsPC(oDA_TARGET))

  {

   int iTEAM = GetLocalInt(oDA_TARGET, "da_Team");

   string sTARGETNAME = GetName(oDA_TARGET);

   switch (iTEAM)  //Inform the activator what color Gladiator, if any, the target is.

    {

     case 1:

       FloatingTextStringOnCreature(sTARGETNAME + " glows red.", oDA_ACTIVATOR, FALSE);

       break;

     case 2:

       FloatingTextStringOnCreature(sTARGETNAME + " glows blue.", oDA_ACTIVATOR, FALSE);

       break;

     case 3:

       FloatingTextStringOnCreature(sTARGETNAME + " glows green.", oDA_ACTIVATOR, FALSE);

       break;

     default:

       FloatingTextStringOnCreature(sTARGETNAME + " does not glow.", oDA_ACTIVATOR, FALSE);

       break;

    }

   DelayCommand(1.5, AssignCommand(oDA_ACTIVATOR, SpeakString("** examines " + sTARGETNAME + " with a Gla-Detector **")));  //Announce to the examination action to all.

  }

  else FloatingTextStringOnCreature("The detector is inert.", oDA_ACTIVATOR, FALSE);  //Do nothing if the target is not a player.

 }

//  Paste the above lines into your module properties' OnActivateItem script to enable the Enforcer Key and Token Detector.

 

{

     object oItem = GetModuleItemAcquired();

     // * Generic Item Script Execution Code

     // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,

     // * it will execute a script that has the same name as the item's tag

     // * inside this script you can manage scripts for all events by checking against

     // * GetUserDefinedItemEventNumber(). See x2_it_example.nss

     if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)

     {

        SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACQUIRE);

        int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);

        if (nRet == X2_EXECUTE_SCRIPT_END)

        {

           return;

        }

}

}

}

 



 



^on activate item script...