Author Topic: Help with OnEnter Script  (Read 285 times)

Legacy_Xanos Magicfingers

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Help with OnEnter Script
« on: December 18, 2010, 08:40:07 pm »


               Hello, I was having trouble making a script.


What I was wanting was a script that does the follows;

OnEnter the starter map ---> If the PCs XP = 1 --> Nothing happens for three seconds (3 sec pause) then PC ported to (TAG OF WAYPOINT).

NOTE:  If the XP > 1 noting happens.

I don't know how to make the delay for 3 seconds ... it automaticly ports the PC right away.



I thank you in advance for all help offered.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Help with OnEnter Script
« Reply #1 on: December 18, 2010, 09:17:14 pm »


               

void main()
{
    object oEntering = GetEnteringObject();

    object oTarget = GetWaypointByTag("TAG_OF_WAYPOINT_HERE");
   location lTarget = GetLocation(oTarget);

   if (!GetIsPC(oEntering)) return;

    if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

    if (GetXP(oEntering, >= 1))
    {

     while (GetIsObjectValid(oTarget))
         { 
         AssignCommand(oEntering, ClearAllActions());

     DelayCommand(3.0, AssignCommand(oEntering, ActionJumpToLocation(lTarget)));
         oTarget=GetNextFactionMember(oEntering, FALSE);

         }
    }
}


FP!
               
               

               


                     Modifié par Fester Pot, 18 décembre 2010 - 09:19 .
                     
                  


            

Legacy_Xanos Magicfingers

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Help with OnEnter Script
« Reply #2 on: December 18, 2010, 09:51:16 pm »


               Good job! thanks alot, but there seems to be a problem with line 12



if (GetXP(oEntering, >= 1))



So I tried replaing the line with the line



if (GetHitDice(oPC) > 1) return;



which shows as ERROR also :\\
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Help with OnEnter Script
« Reply #3 on: December 18, 2010, 10:12:51 pm »


               

void main()

{

  object oEntering = GetEnteringObject();



  object oTarget = GetWaypointByTag("TAG_OF_WAYPOINT_HERE");

  location lTarget = GetLocation(oTarget);

  int nCurrentXP = GetXP(oEntering);



  if (!GetIsPC(oEntering)) return;



  if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;



  if (nCurrentXP >= 1)

  {



    while (GetIsObjectValid(oTarget))

    {

    AssignCommand(oEntering, ClearAllActions());



    DelayCommand(3.0, AssignCommand(oEntering, ActionJumpToLocation(lTarget)));

    oTarget=GetNextFactionMember(oEntering, FALSE);



    }

  }

}




FP!
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Help with OnEnter Script
« Reply #4 on: December 18, 2010, 10:50:25 pm »


               Change this line:

if (nCurrentXP >= 1)

to:

if(nCurrentXP == 1)



The OP said they wanted the PC to only jump if XP equals exactly 1.
               
               

               
            

Legacy_Jassper

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Help with OnEnter Script
« Reply #5 on: December 19, 2010, 03:10:51 am »


               You might want to check (or maybe this isn't for a new PC). but if you are porting a newly created PC, if I remember right, they have 0 xp.



I have been out for a while though.'

               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
Help with OnEnter Script
« Reply #6 on: December 19, 2010, 07:14:31 am »


               new players start with 0 xp, as Jassper said, you need this line there:

if(GetXP(oPC) > 0) or at least something like it '<img'>

... jasper taught me that '<img'>

hi jasper.... *waves*
               
               

               


                     Modifié par zero-feeling, 19 décembre 2010 - 07:15 .
                     
                  


            

Legacy_Xanos Magicfingers

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Help with OnEnter Script
« Reply #7 on: December 19, 2010, 02:10:32 pm »


               Yeah, lol, I already changed it automatically, I forgot that new chars start with 0 XP '<img'>