Page 1 of 2

Starkson Wand Scripts

Posted: Tue Mar 20, 2007 2:21 am
by Jazelle
Driller I'm going to post the scripts here so that we can find out the problem. I went over all the scripts and there is no difference between what is run in LoT and what I gave you. SOOO.

There were a few bugs found that have happened before but I know were fixed.

1. When in party using a wand, targeting and giving a key to another party member in the same zone can at times result in someone else in party getting a key who is not in the same zone.

2. If two people in the same zone use the same wand, targert it, it can result in the wrong person getting a key in the same zone.

3. This one was I know fixed by Adrian but happened just today. ORty was in the Keep's temple and used the Sovereign's wand to port to the hall of mirrors. The result was I would guess that someone else porting at the same time ended up in the hall of mirrors on Starkson. The wand was targerted on Orty.

Alright those are the three bugs I found. Like I said they did not show up on a clean cep2.0 version of the mod. I think there is just needed some slight tweeking to get them to work since well the DM wands work in much the same way there is no reason these can't work too.

Oh your corrections on the Zapper worked great so that wand is fine.

Anyway I will post under this thread each kind of script being used on the wands. I hope we can correct these problems quickly since over all the wands work like a charm.

Note these scripts were written by Adrian not I. I can't write a script for my life.

Posted: Tue Mar 20, 2007 2:22 am
by Jazelle
sks_stk_castle.nss (this one is the same for all the keys given out I only used this one as a example. It is also used to give out the Council, Golem and Zapper wands.)

Code: Select all

void main()
{
     object oTarget = GetItemActivatedTarget();
     if (GetIsPC(oTarget))  // If it is a pc, assign the key.
     {
        CreateItemOnObject("sks_stk_castlek", oTarget);
     }
}

Posted: Tue Mar 20, 2007 2:24 am
by Jazelle
sks_stk_cncl.nss (this script operates the council and Sovereign wands.)

Code: Select all

#include "x2_inc_switches"
void main()
{
    int nEvent = GetUserDefinedItemEventNumber();    //Which event triggered this
    object oPC = GetItemActivator();
    object oTarget = GetItemActivatedTarget();

    if (GetIsPC(oTarget))
    {
      switch (nEvent)
      {
          case X2_ITEM_EVENT_ACTIVATE:
              // * This code runs when the Unique Power property of the councilwand is used
              // * Note that this event fires for PCs only
             AssignCommand(oPC, ActionStartConversation(oPC, "sks_stk_cncil", TRUE));
             break;
      }
    }
    else
    {
      SendMessageToPC(oPC, "That is not a valid target to give keys to...");
    }
}

Posted: Tue Mar 20, 2007 2:27 am
by Jazelle
sks_stk_scan.nss (This script is used on both the Council and Sovereign wands to scan a person and see if they have any Starkson items on them.)

Code: Select all


//::///////////////////////////////////////////////
//:: SKS Key Scrying Script v2.0
//::
//:: Copyright (c) 2005 Adrian Dion
//::
//:: This script will allow the one who possesses an SKS Key Wand
//:: to determine if a selected target has any Starkson property and
//:: if so, which keys, wands and scrolls.
//::
//:://////////////////////////////////////////////
void main()
{
// Start main script
// First, get the one who was targetted by the wand.
object oTarget=GetItemActivatedTarget();
// Who activated the wand?
object oUser=GetItemActivator();

// Initialize: Get the first inventory item
object oCurrentItem=GetFirstItemInInventory(oTarget);
SendMessageToPC(oUser, "Items found:");
// Loop through all items in inventory
while (oCurrentItem != OBJECT_INVALID)
  {
   //Compare the inventory item we are currently on to all Starkson items.
   //Any matches?
    if (GetTag(oCurrentItem)=="sks_stk_scroll")       {SendMessageToPC(oUser, "Starkson Scroll of Citizenship");}
    else if (GetTag(oCurrentItem)=="sks_stk_castlek") {SendMessageToPC(oUser, "Starkson Castle Key");}
    else if (GetTag(oCurrentItem)=="sks_stk_councilk"){SendMessageToPC(oUser, "Starkson Council Key");}
    else if (GetTag(oCurrentItem)=="sks_stk_innkey")  {SendMessageToPC(oUser, "Starkson Inn Key");}
    else if (GetTag(oCurrentItem)=="sks_stk_knightk") {SendMessageToPC(oUser, "Starkson Knights Key");}
    else if (GetTag(oCurrentItem)=="sks_stk_hou1k") {SendMessageToPC(oUser, "Starkson House Key 1");}
    else if (GetTag(oCurrentItem)=="sks_stk_hou2k") {SendMessageToPC(oUser, "Starkson House Key 2");}
    else if (GetTag(oCurrentItem)=="sks_stk_hou3k") {SendMessageToPC(oUser, "Starkson House Key 3");}
    else if (GetTag(oCurrentItem)=="sks_stk_hou4k") {SendMessageToPC(oUser, "Starkson House Key 4");}
    else if (GetTag(oCurrentItem)=="sks_stk_sovk")  {SendMessageToPC(oUser, "Starkson Sovereign Key");}
    else if (GetTag(oCurrentItem)=="sks_stk_cncil")   {SendMessageToPC(oUser, "Starkson Council Wand");}
    else if (GetTag(oCurrentItem)=="sks_stk_sov")     {SendMessageToPC(oUser, "Starkson Sovereign Wand");}
    else if (GetTag(oCurrentItem)=="sks_stk_zapper")  {SendMessageToPC(oUser, "Universal Key Zapper");}
    else if (GetTag(oCurrentItem)=="sks_stk_golcom")  {SendMessageToPC(oUser, "Starkson Golem Command Wand");}
    //If current item is any one of these, display in the server message window
    //the name of the found Starkson item. Then move on to the next item and
    //begin the comparison again.
    oCurrentItem=GetNextItemInInventory(oTarget);
  } // end while
} // end main

Posted: Tue Mar 20, 2007 2:29 am
by Jazelle
sks_stk_scroll.nss (This script operates the Starkson Citizenship Scroll and ports the person into the Courtyard.)

Code: Select all

//::///////////////////////////////////////////////
//:: SKS Starkson Protectorate Citizenship Scroll v1.0
//::
//:: Copyright (c) 2005 Adrian Dion
//::
//:: This script will take the user of the scroll to the courtyard
//:: of Starkson Castle.
//::
//:://////////////////////////////////////////////

#include "x2_inc_switches"

void main()
{
  //Make sure this script only executes when the user has activated the scroll.
  if ( GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE ) return;

  //Who activated the scroll?
  object oPC=GetItemActivator();

  //Where should we teleport them?
  object oTarget = GetWaypointByTag("SC_Scroll_Dest");
  location lTarget = GetLocation(oTarget);

  //Use the unsummon VFX
  effect eVis = EffectVisualEffect(VFX_FNF_NATURES_BALANCE);

  //Make sure that you don't teleport into a silly place like in a wall.
  if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

  //Make sure the user is not doing anything else.
  AssignCommand(oPC, ClearAllActions());

  //Float some text that the coin was broken.
  string sCoinSnap = "As you read the scroll you feel magical energy building...";
  FloatingTextStringOnCreature(sCoinSnap, oPC, TRUE);

  //Start teleport VFX then teleport to the destination.
  DelayCommand(7.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC));
  DelayCommand(10.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
}

Posted: Tue Mar 20, 2007 2:31 am
by Jazelle
sks_stk_sovhall.nss (This script will take the user of the Sovereign Wand to the Hall of Mirrors within Starkson Castle.)

Code: Select all

//::///////////////////////////////////////////////
//:: SKS Starkson Protectorate Hall of Mirrors Teleport v1.0
//::
//:: Copyright (c) 2005 Adrian Dion
//::
//:: This script will take the user of the Sovereign Wand
//:: to the Hall of Mirrors within Starkson Castle.
//::
//:://////////////////////////////////////////////

#include "x2_inc_switches"

void main()
{
  //Only fire this script when the item is used.
  if ( GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE ) return;

  //Who activated the Sovereign Wand?
  object oPC=GetItemActivator();

  //Where should we teleport them?
  object oTarget = GetObjectByTag("st_ro_mir");
  location lTarget = GetLocation(oTarget);

  //Use the unsummon VFX
  effect eVis = EffectVisualEffect(VFX_FNF_NATURES_BALANCE);

  //Make sure that you don't teleport into a silly place like in a wall.
  if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;


  //Make sure the user is not doing anything else.
  AssignCommand(oPC, ClearAllActions());

  //Float some text that the Rod was activated.
  string sCoinSnap = "The Sovereign Rod glows as it builds energy.";
  FloatingTextStringOnCreature(sCoinSnap, oPC, TRUE);

  //Start teleport VFX then teleport to the destination.
  DelayCommand(5.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC));
  DelayCommand(10.0, AssignCommand(oPC, ActionJumpToLocation(lTarget)));
}

Posted: Tue Mar 20, 2007 2:36 am
by Jazelle
There are the script that I think have the problem areas in them along with the other scripts that could be affected by changes. I did not post every key or wand script. But if one changes they all will need to be.

While I can plug in the tags, names and way points and understand about 25% of the scripting I leave this for those who can understand it 100%. Again I'm sure it is some minor tweeks needed to prevent the 3 bugs stated.

Thank you Driller for being so patient.

Posted: Tue Mar 20, 2007 8:43 am
by driller
The best thing to do is cache the target as a local object on the PC and call it from there. I will fix this for you.

-driller

Posted: Wed Mar 21, 2007 4:38 pm
by Jazelle
driller wrote:The best thing to do is cache the target as a local object on the PC and call it from there. I will fix this for you.

-driller
Thanks I was sure you woudl figure it out.

Posted: Wed Mar 21, 2007 6:01 pm
by driller
I fixed them best I could, but they really need to be re-written from the ground up. I don't have time for that right now.

-driller

Posted: Wed Mar 21, 2007 10:51 pm
by Jazelle
driller wrote:I fixed them best I could, but they really need to be re-written from the ground up. I don't have time for that right now.

-driller
Ah ok, Qabbal did a very nice wand for dms to change folks wings and tails or remove them. Let me have him make a go at it. Or if Adrian is reading this he could.

Posted: Thu Mar 22, 2007 5:10 am
by driller
That came across as a little gruff. The scripting is fine, I just had to change a few things. Everything is fixed and should work like a charm.

-driller
Jazelle wrote:
driller wrote:I fixed them best I could, but they really need to be re-written from the ground up. I don't have time for that right now.

-driller
Ah ok, Qabbal did a very nice wand for dms to change folks wings and tails or remove them. Let me have him make a go at it. Or if Adrian is reading this he could.

Posted: Thu Mar 22, 2007 6:04 pm
by Jazelle
driller wrote:That came across as a little gruff. The scripting is fine, I just had to change a few things. Everything is fixed and should work like a charm.

-driller
Jazelle wrote:
driller wrote:I fixed them best I could, but they really need to be re-written from the ground up. I don't have time for that right now.

-driller
Ah ok, Qabbal did a very nice wand for dms to change folks wings and tails or remove them. Let me have him make a go at it. Or if Adrian is reading this he could.
Ah ok I'll cehck it out then. I know last night I was having problems getting Orty into the hall of mirrors and scrying from the sovereign's wand.

I know the scroll works great might change that trans to a item like the scroll so that the wand will just give out the item...

I also wanted to make the wand quite and not spam folks.

As well as have it where you don't have to restart using it when you give out a key. Those features we could work on anyway.

Don't worry I know I'm a dope when it comes to scripting and coding so your not gruffy.

Posted: Thu Mar 22, 2007 8:38 pm
by Caesius
Jazelle wrote:I also wanted to make the wand quite and not spam folks.
Looking at the most recent version in my possession of BSK Starkson wand scripts (SKS_BSK_031506.erf), my guess is that line 15 of sks_stk_sov.nss should be:

Code: Select all

AssignCommand(oPC, ActionStartConversation(oPC, "sks_stk_sov", TRUE));
and not just:

Code: Select all

AssignCommand(oPC, ActionStartConversation(oPC, "sks_stk_sov"));
An oversight on my part. My apologies. If that script has been edited since March 15/06, the accuracy of this advice cannot be assured.

Posted: Thu Mar 22, 2007 8:52 pm
by Jazelle
Driller would have to post a copy of that script to be sure it is. Hey Adrian nice to hear from you.