Author Topic: On enter recieve item.  (Read 577 times)

Legacy_-SilentSoul-

  • Newbie
  • *
  • Posts: 26
  • Karma: +0/-0
On enter recieve item.
« on: January 25, 2011, 12:42:44 am »


               Hey folks, i am curious how do i make it so the pc's entering my module recieve certain items i make when they enter the server? Please be in-depth about the process, i am new to this sort of scripting. Detailed per-say. Thank you much!
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
On enter recieve item.
« Reply #1 on: January 25, 2011, 01:14:37 am »


               You may want to give them some items, but do you only want to give them the items once. I would assume so. One way would be to just add a 2 lines for ever item, and then seiing if they have it or not to your onclient enter module script:

object oObjectToGive = GetItemPossessedBy(oPC, "TagOfObjectToGive");

if (!GetIsObjectValid(oObjectToGive))
{
// Now create the object on the PC if they don't have one
CreateItemOnObject("resrefofobjecttogive", oPC, 1);
}
So you would have to follow that method for every item you want to give them.
An alternative method would be to give the items you want to any PC who had less than 1 experience pt. and then have the script return, otherwise. Then after the items have been given to the PC also give them 1xp pt before the script exits.
Something like this:

//::///////////////////////////////////////////////
//:: FileName: onenterexample
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 2/9/2008 9:48:30 PM
//:://////////////////////////////////////////////
void main()
{
object oPC = GetEnteringObject();
if (GetXP(oPC)<1)
    {
    // Give the speaker the items
    CreateItemOnObject("resrefofitem", oPC, 1);
    CreateItemOnObject("resrefofitem", oPC, 1);
    CreateItemOnObject("resrefofitem", oPC, 1);
    CreateItemOnObject("resrefofitem", oPC, 1);
    CreateItemOnObject("resrefofitem", oPC, 1);
    CreateItemOnObject("resrefofitem", oPC, 1);
    CreateItemOnObject("resrefofitem", oPC, 1);
     // Give the PC 1 XP
    GiveXPToCreature(oPC, 1);
     }
}
               
               

               


                     Modifié par ffbj, 25 janvier 2011 - 01:25 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
On enter recieve item.
« Reply #2 on: January 25, 2011, 01:22:00 am »


               This should help.



http://nwvault.ign.c....Detail&id=2676
               
               

               
            

Legacy_-SilentSoul-

  • Newbie
  • *
  • Posts: 26
  • Karma: +0/-0
On enter recieve item.
« Reply #3 on: January 25, 2011, 05:31:29 am »


               Thanks you two! So much '<img'>