Author Topic: Random Area Transition  (Read 353 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Random Area Transition
« on: May 19, 2012, 10:31:19 pm »


               I'm wanting to have a script on a door's OnAreaTransitionClick that randomly moves the player to another door.
I would like to be able to use this script again if I can, so I'm saveing area variables to the door.

The area I'm getting is "DECLARATION DOES NOT MATCH PARAMETERS" on case 1



void main(){
object oPC = GetClickingObject();if (!GetIsPC(oPC)) return;


string oWP1 = GetLocalString(OBJECT_SELF, "oWP1");string oWP2 = GetLocalString(OBJECT_SELF, "oWP2");string oWP3 = GetLocalString(OBJECT_SELF, "oWP3");string oWP4 = GetLocalString(OBJECT_SELF, "oWP4");string oWP5 = GetLocalString(OBJECT_SELF, "oWP5");string oWP6 = GetLocalString(OBJECT_SELF, "oWP6");

int nCommonRoll = d6();
            switch(nCommonRoll)            {            case 1: AssignCommand(oPC, JumpToObject(oWP1));break; //Error begins here.            case 2: AssignCommand(oPC, JumpToObject(oWP2));break;            case 3: AssignCommand(oPC, JumpToObject(oWP3));break;            case 4: AssignCommand(oPC, JumpToObject(oWP4));break;            case 5: AssignCommand(oPC, JumpToObject(oWP5));break;            case 6: AssignCommand(oPC, JumpToObject(oWP6));break;
            }



Any suggestions as to what I'm doing wrong is welcome. Thank you kindly!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Random Area Transition
« Reply #1 on: May 19, 2012, 10:51:57 pm »


               void main()
{
  object oPC = GetClickingObject();
  if (!GetIsPC(oPC)) return;
 
  string oWP1 = GetLocalString(OBJECT_SELF, "oWP1");
  string oWP2 = GetLocalString(OBJECT_SELF, "oWP2");
  string oWP3 = GetLocalString(OBJECT_SELF, "oWP3");
  string oWP4 = GetLocalString(OBJECT_SELF, "oWP4");
  string oWP5 = GetLocalString(OBJECT_SELF, "oWP5");
  string oWP6 = GetLocalString(OBJECT_SELF, "oWP6");

  int nCommonRoll = d6();
  switch(nCommonRoll)          
 {          
     case 1: AssignCommand(oPC, JumpToObject(oWP1));
     break;
    //Error begins here.           
    case 2: AssignCommand(oPC, JumpToObject(oWP2));break;
    case 3: AssignCommand(oPC, JumpToObject(oWP3));break;
    case 4: AssignCommand(oPC, JumpToObject(oWP4));break;
    case 5: AssignCommand(oPC, JumpToObject(oWP5));break;
    case 6: AssignCommand(oPC, JumpToObject(oWP6));break;
  }
}
Script repost.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Random Area Transition
« Reply #2 on: May 19, 2012, 10:55:19 pm »


               It looks like your problen is that oWP*  are not objects, they are strings.

So if the local strings are the tags for the waypoints do something like:

object oWP1 =  GetWaypointByTag(GetGetLocalString(OBJECT_SELF, "oWP1"));
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Random Area Transition
« Reply #3 on: May 20, 2012, 03:15:12 pm »


               object oWP1 = GetWaypointByTag(GetLocalString(OBJECT_SELF, "oWP1"));

That did the trick! Thanks Lightfoot8!