Aller au contenu

Photo

Help with OnEnter Script


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
Xanos Magicfingers

Xanos Magicfingers
  • Members
  • 9 messages
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.

#2
Fester Pot

Fester Pot
  • Members
  • 1 394 messages

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 .


#3
Xanos Magicfingers

Xanos Magicfingers
  • Members
  • 9 messages
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 :\\

#4
Fester Pot

Fester Pot
  • Members
  • 1 394 messages

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!

#5
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
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.

#6
Jassper

Jassper
  • Members
  • 571 messages
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.'


#7
zero-feeling

zero-feeling
  • Members
  • 144 messages
new players start with 0 xp, as Jassper said, you need this line there:

if(GetXP(oPC) > 0) or at least something like it :)

... jasper taught me that :)

hi jasper.... *waves*

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


#8
Xanos Magicfingers

Xanos Magicfingers
  • Members
  • 9 messages
Yeah, lol, I already changed it automatically, I forgot that new chars start with 0 XP :P