Author Topic: New to Scripting and i need help  (Read 307 times)

Legacy_slayerofdreams

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
New to Scripting and i need help
« on: June 13, 2011, 11:01:19 pm »


               Hi all hope you can help me out here, ive only recently started scripting for the server i play on and ive been doing a fair bit thanks to Lilacs script generator but ive been asked to do something and im having trouble with making the script.

The problem i have is this, i am wanting to make a wand that changes the LocalString (Name: Password, Value: Password ) of a door  to the name of the wand used and im unsure of how to go about doing this. I tried to use Lilacs script gen but all i could do with it was make the wand change the password to a preset-string eg from Password to Default. Although this method would work well for our first need of the wand it wouldnt help for our second need.

The first reason for wanting  this is the wand is like a magical lockpick for our String based passworded doors.
the passworded doors dont have a lock as such so we wanted a rp way to bypass the doors and we came up with the idea of the wand that changes the command word of the door to the same command word as the wand (hence making the string value match the wands name).

The second reason for the wand  is that we have some characters that would like to use the wand to change the passwords on their own player house doors. And the way of doing this is by using the naming quill (thanks to The_Krit for such a helpful item) to set the wands name to the name that is wanted for the doors password.


For some reason i feel im missing something simple and i think i just need an outsiders input on this.Thank you in advance for any replies i get.
               
               

               
            

Legacy_slayerofdreams

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
New to Scripting and i need help
« Reply #1 on: June 13, 2011, 11:13:24 pm »


               incase it helps this is what i made using the script gen.

void main()
{
object oPC;

oPC = GetItemActivatedTarget();

SetLocalString(oPC, "Password", "Default");

}


what i need is to just somehow make "Default" replaced by the wands name (whatever it may be at the time of using the wand).

and again incase it helps my wands details are

Name: Password setter
Tag: Passwordsetter
ResRef: passwordsetter

The wand uses Unique Power and for ease i didnt bother adding any restrictions to what it can target (let me know please if this is a bad idea).
               
               

               


                     Modifié par slayerofdreams, 13 juin 2011 - 10:19 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
New to Scripting and i need help
« Reply #2 on: June 14, 2011, 12:10:55 am »


               #include "x2_inc_switches"
 void main()
{
  if ( GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE) return;
  object oDoor=GetItemActivatedTarget();
  object oWand= GetItemActivated();
  string sPassword = GetName(oWand);
  if (GetObjectType(oDoor) == OBJECT_TYPE_DOOR)
    SetLocalString(oDoor, "Password",sPassword   );
}
               
               

               
            

Legacy_slayerofdreams

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
New to Scripting and i need help
« Reply #3 on: June 14, 2011, 11:47:26 am »


               thanks so much, id have never sorted this without help.