Aller au contenu

Client Enter: Give item from race adding to script.


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

#1
Guest_NWN Dragon-Blade_*

Guest_NWN Dragon-Blade_*
  • Guests
I am trying to add the script below to the one below that. I think my if statements are off I am trying to make it so that if the PC is elven, and does not have the amulet he is given it. Then I am trying to add it to my current on enter script. Thankyou, Dragon-Blade suckish scripter :)

The item script.
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
if ((GetRacialType(oPC)==RACIAL_TYPE_ELF))
   {
   if (GetItemPossessedBy(oPC, "Ammy_Elf")== OBJECT_INVALID)
      {
      CreateItemOnObject("elf_ammy", oPC);
      }
   }
}




Script trying to add it to
#include "gs_inc_common"
#include "gs_inc_text"
void main()
{
    object oEntering   = GetEnteringObject();
    if (GetIsDM(oEntering)) return;
    //check if cd key is banned
    object oBanishment = GetLocalObject(OBJECT_SELF, "GS_BANISHMENT");
    if (GetIsObjectValid(oBanishment))
    {
        string sCDKey = GetPCPublicCDKey(oEntering);
        if (GetIsObjectValid(GetItemPossessedBy(oBanishment, "GS_BA_" + sCDKey)))
        {
            SendMessageToAllDMs(
                gsCMReplaceString(
                    GS_T_16777425,
                    GetName(oEntering),
                    GetPCPlayerName(oEntering),
                    sCDKey));
            BootPC(oEntering);
            return;
        }
    }
    AddJournalQuestEntry("GS_DIARY_001", 1, oEntering, FALSE);
    AddJournalQuestEntry("GS_DIARY_002", 1, oEntering, FALSE);
    if (GetLocalInt(oEntering, "GS_ENABLED"))
    {
        //restore health
        int nHealth = GetLocalInt(OBJECT_SELF, "GS_HEALTH_" + ObjectToString(oEntering));
        gsCMSetHitPoints(nHealth, oEntering);
        SetLocalInt(oEntering, "GS_ENABLED", -1);
    }
    //activity
    SetLocalInt(oEntering, "GS_ACTIVE", TRUE);
    ExecuteScript("activateclimbing",OBJECT_SELF);
}

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Something kinda like so:

#include "gs_inc_common"
#include "gs_inc_text"
void main()
{
    object oEntering   = GetEnteringObject();
    if (GetIsDM(oEntering)) return;
    //check if cd key is banned
    object oBanishment = GetLocalObject(OBJECT_SELF, "GS_BANISHMENT");
    if (GetIsObjectValid(oBanishment))
    {
        string sCDKey = GetPCPublicCDKey(oEntering);
        if (GetIsObjectValid(GetItemPossessedBy(oBanishment, "GS_BA_" + sCDKey)))
        {
            SendMessageToAllDMs(
                gsCMReplaceString(
                    GS_T_16777425,
                    GetName(oEntering),
                    GetPCPlayerName(oEntering),
                    sCDKey));
            BootPC(oEntering);
            return;
        }
    }
    AddJournalQuestEntry("GS_DIARY_001", 1, oEntering, FALSE);
    AddJournalQuestEntry("GS_DIARY_002", 1, oEntering, FALSE);
    if (GetLocalInt(oEntering, "GS_ENABLED"))
    {
        //restore health
        int nHealth = GetLocalInt(OBJECT_SELF, "GS_HEALTH_" + ObjectToString(oEntering));
        gsCMSetHitPoints(nHealth, oEntering);
        SetLocalInt(oEntering, "GS_ENABLED", -1);
    }
    //activity
    SetLocalInt(oEntering, "GS_ACTIVE", TRUE);
    ExecuteScript("activateclimbing",OBJECT_SELF);

    if (GetRacialType(oPC)==RACIAL_TYPE_ELF && GetIsPC(oPC))
    {
        if (GetItemPossessedBy(oPC, "Ammy_Elf")== OBJECT_INVALID)
        {
            CreateItemOnObject("elf_ammy", oPC);
        }
    }
}

Hope it helps.

Modifié par GhostOfGod, 01 mars 2011 - 03:24 .


#3
Guest_NWN Dragon-Blade_*

Guest_NWN Dragon-Blade_*
  • Guests
Error, variable defined without type :(


#include "gs_inc_common"
#include "gs_inc_text"
void main()
{
    object oEntering   = GetEnteringObject();
    if (GetIsDM(oEntering)) return;
    //check if cd key is banned
    object oBanishment = GetLocalObject(OBJECT_SELF, "GS_BANISHMENT");
    if (GetIsObjectValid(oBanishment))
    {
        string sCDKey = GetPCPublicCDKey(oEntering);
        if (GetIsObjectValid(GetItemPossessedBy(oBanishment, "GS_BA_" + sCDKey)))
        {
            SendMessageToAllDMs(
                gsCMReplaceString(
                    GS_T_16777425,
                    GetName(oEntering),
                    GetPCPlayerName(oEntering),
                    sCDKey));
            BootPC(oEntering);
            return;
        }
    }
    AddJournalQuestEntry("GS_DIARY_001", 1, oEntering, FALSE);
    AddJournalQuestEntry("GS_DIARY_002", 1, oEntering, FALSE);
    if (GetLocalInt(oEntering, "GS_ENABLED"))
    {
        //restore health
        int nHealth = GetLocalInt(OBJECT_SELF, "GS_HEALTH_" + ObjectToString(oEntering));
        gsCMSetHitPoints(nHealth, oEntering);
        SetLocalInt(oEntering, "GS_ENABLED", -1);
    }
    //activity
    SetLocalInt(oEntering, "GS_ACTIVE", TRUE);
    ExecuteScript("activateclimbing",OBJECT_SELF);
    if (GetRacialType(oPC)==RACIAL_TYPE_ELF && GetIsPC(oPC))
    {
        if (GetItemPossessedBy(oPC, "Ammy_Elf")== OBJECT_INVALID)
        {
            CreateItemOnObject("elf_ammy", oPC);
        }
    }
}

Modifié par NWN Dragon-Blade, 01 mars 2011 - 05:25 .


#4
Baragg

Baragg
  • Members
  • 271 messages
Change oPC to oEntering.

#5
Baragg

Baragg
  • Members
  • 271 messages
The next 2 lines also will need that change.

#6
Guest_NWN Dragon-Blade_*

Guest_NWN Dragon-Blade_*
  • Guests
Thanks it worked!

#7
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
oops. sorry bout that.