Author Topic: OnClient Enter - Do something only on first enter.  (Read 317 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
OnClient Enter - Do something only on first enter.
« on: April 08, 2012, 01:23:22 am »


                I have an on client enter, to strip them of all gear then give them two things (player widget and a tunic). But when they log out and back in again, the script strips them again. How can I get around this?
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
OnClient Enter - Do something only on first enter.
« Reply #1 on: April 08, 2012, 01:44:48 am »


               <pondering...>

Strip them only if they don't posses the player widget and tunic...?

<...imponderables>
               
               

               
            

Legacy_Wall3T

  • Hero Member
  • *****
  • Posts: 748
  • Karma: +0/-0
OnClient Enter - Do something only on first enter.
« Reply #2 on: April 08, 2012, 01:48:20 am »


               have you tried it as a once per pc only? such as:

void main()
{
   // Get the creature who triggered this event.
   object oPC = GetEnteringObject();

   // Only fire for (real) PCs.
   if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
       return;

   // Only fire once per PC.
   if ( GetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF)) )
       return;
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
OnClient Enter - Do something only on first enter.
« Reply #3 on: April 08, 2012, 02:02:32 am »


               New PC will not have any XP,   For any PC that has 0 xp, strip them, give them your widgets and give them one xp.    

Rolo's method will work if you never remove the Widget and tunic from the player.

Players will lose local Vars when the server resets so oOKyeOo nethod will not work.
Player characters also do not have a Tag, unless one has been added by NWNx or Other Bic edit.
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
OnClient Enter - Do something only on first enter.
« Reply #4 on: April 08, 2012, 02:16:28 am »


               

Rolo Kipp wrote...

<pondering...>

Strip them only if they don't posses the player widget and tunic...?

<...imponderables>

LOL.. I knew I was over thinking this trying to add variables to objects etc.  This is a forever level 1 world so the xp and other options wouldn't work either. Simple and perfect solution, thanks Rolo!
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
OnClient Enter - Do something only on first enter.
« Reply #5 on: April 08, 2012, 04:03:17 pm »


               We use the method suggested by Lightfoot8 on Diablo- The Dark Wanderer.  After the toon is stripped and re-equipped with the default starting equipment, the toon is given 1 experience point which acts as a signal to never initialise that toon again.

Since 1 point won't bump a toon up a level, you could use that method instead of looking for a particular item of equipment.

It's just another option, is what I'm saying.