Author Topic: Question regarding Shaya and the day/night cycle  (Read 457 times)

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« on: November 10, 2010, 12:40:57 am »


               Hello again everyone,
I come back yet again with another request for something i feel is rather simple but for some reason its solution eludes me. My problems is thus:

I currently use Shaya's subrace engine on my server and I have vampires in. Im 99% certain that my addition for vampires (as far as the engine is concerned) is correct, but when a vamp PC goes outside they do not take damage from sunlight, nor do they gain bonses at night time (as i set them to do so). My PW cycles through its day/night cycles with no problems as far as i can tell, however neither effect activates. Ive checked *all* my areas and set them to cycle, made sure they were exterior, and made sure the light was natural. Im not quiet certain what might be causing this issue, but if anyone might know please let me know. And also let me know if there are certain scripts that need to be seen, as well as how to post them here in the little windows I always see, because im not sure how to do that.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #1 on: November 10, 2010, 01:35:22 am »


               To post scripts you open the code with [ code ] and close it with [/ code ]. Of course you would remove the space in the blocks.
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #2 on: November 10, 2010, 01:43:15 am »


               not working.....the code blocks disappear upon posting like they should, however it doesnt stick it in a window thing.
               
               

               


                     Modifié par NightbladeCH, 10 novembre 2010 - 01:48 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #3 on: November 10, 2010, 02:11:14 am »


               This site does not have the code windows that the old site had.   the [ code] block or the  [ quote] block is as good as it gets on this site.
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #4 on: November 10, 2010, 02:20:05 am »


               

Lightfoot8 wrote...

This site does not have the code windows that the old site had.   the [ code] block or the  [ quote] block is as good as it gets on this site.


awww go figure. Ok here goes then

Sha_subraces2 (declares the vamp subrace features and the like, runs off of Sha_subr_methds)

   CreateSubrace(RACIAL_TYPE_HUMAN, "vampire", "sha_pc_vamp001", "sha_subrace_vamp", TRUE, 3, FALSE, 0, 0, TRUE, TRUE);

//Can also be Elf
   AddAdditionalBaseRaceToSubrace("vampire", RACIAL_TYPE_ELF);

//Can also be Half-Elf
   AddAdditionalBaseRaceToSubrace("vampire", RACIAL_TYPE_HALFELF);

//Skins that are equipped at certain levels...
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp002", 5);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp003", 10);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp004", 15);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp005", 20);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp006", 25);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp007", 30);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp008", 35);
   AddAdditionalSkinsToSubrace("vampire", "sha_pc_vamp", 40);

//Alignment Restriction: Can only be evil.
   CreateSubraceAlignmentRestriction("vampire", FALSE, FALSE, TRUE);

//Appearance: Change the Appearance to a Vampire using the appearance changer device.
  CreateSubraceAppearance("vampire", TIME_NONE, APPEARANCE_TYPE_VAMPIRE_MALE, APPEARANCE_TYPE_VAMPIRE_FEMALE, 1);

//Temporary Stats: Bonuses at Night time.
//Increase Strength by 6 points, Dexterity by 4 points, Consitution by 4, Charisma by 2, and AC by 5 and AB 10 during the Night.
   struct SubraceStats VampStats1 =  CreateCustomStats(SUBRACE_STAT_MODIFIER_TYPE_POINTS, 6.0, 6.0, 4.0, 0.0, 0.0, 2.0, 5.0, 10.0);
   CreateTemporaryStatModifier("vampire", VampStats1, TIME_NIGHT, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);

//Favored class: Rogue.
   AddSubraceFavoredclass("vampire", class_TYPE_ROGUE, class_TYPE_ROGUE);

//Appearance changer device
   AddSubraceItem("vampire", "sha_vamp_cont", 1);
   AddSubraceItem("vampire", "sha_subrace_vamp", 1);


Next is my onHeartbeat, in case anyone wants it.

//::Modified by FallenOnes 10/1/2005. To handle death token
//::removal after character is resurrected.
#include "x2_inc_itemprop"
#include "sha_subr_methds"
void loadBehaviors()
{
    /*
     * HP at which the player actually dies.  Cannot set below -10 due to
     * hardcoded game restrictions ... so the valid range is 0 to -10.
     * However, if it's zero, that's essentially what NWN does by default.
     */
    SetLocalInt(OBJECT_SELF, "DEATH_TARGET", -10);

    /*
     * If set to TRUE, the player will only grunt on the ground as he or
     * she dies.  If set to false, the player will also call for help
     * periodically.
     */
    SetLocalInt(OBJECT_SELF, "PLAYER_ONLY_GRUNTS_WHILE_DYING", FALSE);
}


/*
 * Checks the pc object to determine if the hit points are zero or less.
 * If so, and the player has not actually died, this function inflicts one
 * point of damage to the PC, and makes an appropriate sound (grunt, call for
 * aid, etc).  When the hit points have reached the desired target, this
 * function sends a death event to the pc object.
 */


void bleedCheck(object pc)
{
    // make sure a valid PC object was passed in
    if (!GetIsPC(pc))
        return;

    // get desired behaviors
    int DEATH_TARGET = GetLocalInt(OBJECT_SELF, "DEATH_TARGET");
    int PLAYER_ONLY_GRUNTS_WHILE_DYING = GetLocalInt(OBJECT_SELF, "PLAYER_ONLY_GRUNTS_WHILE_DYING");

    int hp = GetCurrentHitPoints(pc);

    //This bit added to handle resurected characters
    if ((hp > 0)&& (GetItemPossessedBy(pc, "DeathToken")!= OBJECT_INVALID))
        {
               SendMessageToPC(pc, "*You live to fight another day*");
               object oItem = GetFirstItemInInventory(pc);
               while(GetIsObjectValid(oItem))
                        {
                            if (GetTag(oItem)== "DeathToken")
                            {
                                AssignCommand(pc,DestroyObject(oItem));
                            }
                            oItem = GetNextItemInInventory(pc);
                        }

        }
    // make sure pc is bleeding, and not already dead
    if ((hp  DEATH_TARGET))
    {
        // damage pc
        effect dmg = EffectDamage(1);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, dmg, pc);
        int which = d6();

        // if the DM wants only grunts, only use first 3 cases in the
        // switch statement below
        if (PLAYER_ONLY_GRUNTS_WHILE_DYING)
            which = FloatToInt(IntToFloat(which) / 2.0 + 0.5);

        switch (which)
        {
            case 1:
                PlayVoiceChat(VOICE_CHAT_PAIN1, pc);
                break;

            case 2:
                PlayVoiceChat(VOICE_CHAT_PAIN2, pc);
                break;

            case 3:
                PlayVoiceChat(VOICE_CHAT_PAIN3, pc);
                break;

            case 4:
                PlayVoiceChat(VOICE_CHAT_HEALME, pc);
                break;

            case 5:
                PlayVoiceChat(VOICE_CHAT_NEARDEATH, pc);
                break;

            case 6:
                PlayVoiceChat(VOICE_CHAT_HELP, pc);
                break;
        }

    }
    else if (hp <= DEATH_TARGET)
    {
        // pc bled to death
        effect death = EffectDeath(FALSE, FALSE);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, death, pc);
    }
}

void GlowingWeapon(object oPC,string sTag, float fDistance, string sWarning)
{

if (GetIsObjectValid(oPC) == TRUE)
{
    if(GetDistanceBetween(GetNearestCreature(CREATURE_TYPE_class,class_TYPE_DRAGON, oPC), oPC) < fDistance && GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC)) == sTag && GetIsObjectValid(GetNearestCreature(CREATURE_TYPE_class,class_TYPE_DRAGON, oPC)) == TRUE)
    {
        GetNearestCreature(CREATURE_TYPE_class,class_TYPE_DRAGON, oPC);
        AddItemProperty(DURATION_TYPE_TEMPORARY, ItemPropertyVisualEffect(ITEM_VISUAL_HOLY), oPC, 6.0);
        AssignCommand(oPC, SpeakString(sWarning));
    }

}
}
/*
 * OnHeartbeat main
 */
void PhaseEffect(object pc, string mColour, string chObject, int mAngle)
{

}


void MoonEphem(object pc)
{
    SetLocalInt(GetModule(), "RED_MOON_ANGLE", GetLocalInt(GetModule(), "RED_MOON_ANGLE")+5);
    SetLocalInt(GetModule(), "WHITE_MOON_ANGLE", GetLocalInt(GetModule(), "WHITE_MOON_ANGLE")+2);
    SetLocalInt(GetModule(), "BLACK_MOON_ANGLE", GetLocalInt(GetModule(), "BLACK_MOON_ANGLE")+10);
       effect eEffect;
       object oItem;
       effect RedMoonInc1;
       int mPhase = GetLocalInt(GetModule(), "RED_MOON_ANGLE");
       switch (mPhase)
            {
                case 5400:
                 AssignCommand (pc,SpeakString("Red Moon Waxing",TALKVOLUME_SHOUT));
                 if (GetItemPossessedBy(pc, "neutralmagetoken")!= OBJECT_INVALID)
                    {
                        SendMessageToPC(pc, "*Your energy returns*");
                         object mageSkin;
                         mageSkin = CreateItemOnObject("redmage", pc,1);
                         AssignCommand(pc,ActionEquipItem(mageSkin,INVENTORY_SLOT_CARMOUR));

                    }


                 break;
                case 10:
                 AssignCommand (pc,SpeakString("Red Moon in High Sanction",TALKVOLUME_SHOUT));
                 oItem = GetItemPossessedBy(pc, "redmage");
                 if (oItem != OBJECT_INVALID)
                    {
                        SendMessageToPC(pc, "*Your soul is filled with power*");
                        //eEffect = EffectAbilityIncrease(ABILITY_INTELLIGENCE, 3);
                        //ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, pc);
                        eEffect =  EffectSavingThrowIncrease(SAVING_THROW_ALL,1);
                        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, pc);
                        itemproperty ipAdd = ItemPropertyBonusLevelSpell(IP_CONST_class_WIZARD, 1);
                        object oItem = GetItemInSlot(INVENTORY_SLOT_CARMOUR, pc);

                        if (!GetIsObjectValid(oItem)) return;

                            IPSafeAddItemProperty(oItem, ipAdd);




                    }

                 break;
                case 15:
                 AssignCommand (pc,SpeakString("Red Moon Waning",TALKVOLUME_SHOUT));
                 oItem = GetItemPossessedBy(pc, "redmage");
                 if (oItem != OBJECT_INVALID)
                    {
                        SendMessageToPC(pc, "*Your energy diminishes*");
                        effect reEff = GetFirstEffect(pc);
                        while (GetEffectType(reEff) !=  EFFECT_TYPE_INVALIDEFFECT)
                        {
                               // if (GetEffectType(reEff) == EFFECT_TYPE_ABILITY_INCREASE)
                                //{
                                //    RemoveEffect(pc, reEff);
                                //}
                                if (GetEffectType(reEff) == EFFECT_TYPE_SAVING_THROW_INCREASE)
                                {
                                    RemoveEffect(pc, reEff);
                                }


                                reEff = GetNextEffect(pc);
                        }

                        IPRemoveAllItemProperties(oItem,DURATION_TYPE_PERMANENT);

                 }

                 break;
                case 20:
                 AssignCommand (pc,SpeakString("Red Moon is in Low Sanction",TALKVOLUME_SHOUT));
                 SetLocalInt(GetModule(), "RED_MOON_ANGLE", 0);
                 if (GetItemPossessedBy(pc, "neutralmagetoken")!= OBJECT_INVALID)
                    {
                        SendMessageToPC(pc, "*Your energy is sapped*");
                        oItem = GetItemPossessedBy(pc, "neutralmagetoken");

                    }
                 break;
                default :
                 break;
             }

}
void main()
{

// Sha Clock for day/night
  int iTime = SHA_GetCurrentTime();
   int iLastTime = GetLocalInt(OBJECT_SELF, "STORED_TIME");
   SetLocalInt(OBJECT_SELF, "STORED_TIME", iTime);


   if(iTime != iLastTime)
   {
       if(GetLocalInt(GetModule(), "SHUTDOWN_SSE"))
       { return; }
       //There has been a day/night transition! Signal Event!
       object oPC = GetFirstPC();
       while(GetIsObjectValid(oPC) && !GetIsDM(oPC) && !GetLocalInt(GetArea(oPC), "DISABLE_SUBRACE_ENGINE"))
       {
            string subrace = GetLocalString(oPC, SUBRACE_TAG);
            if(subrace != "")
            {
                string SubraceTag = SUBRACE_TAG + "_" + subrace;
                ApplyTemporarySubraceAppearance(SubraceTag, oPC, iTime);
                ApplySubraceEffect(oPC, SubraceTag, iTime);
                CheckIfCanUseEquipedWeapon(oPC);
                DelayCommand(6.0, CheckIfCanUseEquippedArmor(oPC));
                DelayCommand(8.0, EquipTemporarySubraceSkin(SubraceTag, oPC, iTime));
                DelayCommand(11.0, EquipTemporarySubraceClaw(SubraceTag, oPC, iTime));
            }
            oPC = GetNextPC();
       }
   }
   //Sha end clock


    // load up desired behaviors for all OnHeartbeat scripts
    loadBehaviors();
    // enumerate all PCs, calling bleedCheck on each
    // if you want to add more / other scripts that act on all players
    // every heartbeat, this is the place to do it ... just put a call
    // to them after (or before) bleedCheck, within the while loop.
    object pc = GetFirstPC();
    //MoonEphem(pc);
    //AssignCommand (pc,SpeakString("RED_MOON_ANGLE = " + IntToString(GetLocalInt(GetModule(), "RED_MOON_ANGLE")),TALKVOLUME_SHOUT));
    while (GetIsObjectValid(pc))
    {
        bleedCheck(pc);
        GlowingWeapon(pc,"blah",20.0,"The blade buzzes loudly");
        pc = GetNextPC();
    }
}


I can also add the Sha_subr_methds if anyone wants, its rather long however so i left it out for the moment. In an attempt to fix my problem, i added the "Sha_clock" bit to the heartbeat, and thus was not orignally asked to be placed here. Also please note i have no problems with anything else regarding Shaya, as afar as i can currently tell, it all works as its supposed too.
               
               

               


                     Modifié par NightbladeCH, 10 novembre 2010 - 02:23 .
                     
                  


            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #5 on: November 10, 2010, 02:05:44 pm »


               *bump* anyone?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #6 on: November 11, 2010, 06:29:26 pm »


               Sorry to see you haven't gotten any help yet. The thing is, you are probably going to have to wait for someone who has a lot of experience with Shayan's. I've never used it so I can only take wild stabs in the dark.

I suspect that since most everything works accept for applying the effects at the correct time, that either the clock functions are being used incorrectly or that the application of the effects are not being done correctly.
I was looking at this part in particular for applying the effects. Particularly the part I highlighted:

string subrace = GetLocalString(oPC, SUBRACE_TAG);
            if(subrace != "")
            {
                string SubraceTag = SUBRACE_TAG + "_" + subrace;
                ApplyTemporarySubraceAppearance(SubraceTag, oPC, iTime);
                ApplySubraceEffect(oPC, SubraceTag, iTime);
                CheckIfCanUseEquipedWeapon(oPC);
                DelayCommand(6.0, CheckIfCanUseEquippedArmor(oPC));
                DelayCommand(8.0, EquipTemporarySubraceSkin(SubraceTag, oPC, iTime));
                DelayCommand(11.0, EquipTemporarySubraceClaw(SubraceTag, oPC, iTime));
            }


I was just wondering why, where you need to add the subrace parameter, do you need to add another string CONSTANT to it? Is this required by Shayan's system? It just seems like it should be something more like so:

string subrace = GetLocalString(oPC, SUBRACE_TAG);
            if(subrace != "")
            {
                //string SubraceTag = SUBRACE_TAG + "_" + subrace;
                ApplyTemporarySubraceAppearance(subrace, oPC, iTime);
                ApplySubraceEffect(oPC, subrace, iTime);
                CheckIfCanUseEquipedWeapon(oPC);
                DelayCommand(6.0, CheckIfCanUseEquippedArmor(oPC));
                DelayCommand(8.0, EquipTemporarySubraceSkin(SubraceTag, oPC, iTime));
                DelayCommand(11.0, EquipTemporarySubraceClaw(SubraceTag, oPC, iTime));
            }

But like I said. I'm just making wild stabs in the dark.

P.S. I saw on your other post you wrote...

it seems to be some problem with the GetIsDay command thingy, or possibly with reading if the server is in day/night entirely

But I don't see a check for day or night in any of the script you posted. Unless it is done in the function below.
What does this function return?:

SHA_GetCurrentTime();

Is it just a single integer? The current game hour?

P.S.S. Also if you could post the prototypes or functions for these so we can look at what parameters are required:

ApplyTemporarySubraceAppearance(SubraceTag, oPC, iTime);
ApplySubraceEffect(oPC, SubraceTag, iTime);
               
               

               


                     Modifié par GhostOfGod, 11 novembre 2010 - 07:02 .
                     
                  


            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #7 on: November 11, 2010, 07:02:54 pm »


               Its not your fault, i just got so frustrated with this darn thing it might have led to an impatience on my part. Which in such state led to another post, sorry about that guys. But here is the Shaya_clock script that sets the GetCurrentTime function you referred too. And as to your above question, ive no clue. As far as i can tell the engine over the subraces themselves is fine, and isnt the problem. I have copy of my friends server that i worked on as well, and it works there correctly. I copied all those scripts over to mine and retried it to no avail. I also tried a seperate script that calls for damage on vamp pc's during the sunlight and that didnt work either. Im not sure if its how its calling for the time or if its something wrong with my mod's clock, but the day and night does cycle.

//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//:::::::::::::::::::::::: Shayan's Subrace Engine :::::::::::::::::::::::::::::
//::::::::::::::::::::::: File Name: sha_clock :::::::::::::::::::::::::::::::::
//:::::::::::::::::::::::::: Heartbeat Script ::::::::::::::::::::::::::::::::::
//:: Written by: Shayan
//:: Contact: mail_shayan@yhaoo.com                                         :://
//:: Forums: http://p2.forumforfree.com/shayan.html                         :://

//:: This script should be placed on one random inanimate object in the module
//:: This is absolutely cruical bit (and new to version 2.7). Without it things won't function.

#include "sha_subr_methds"
void main()
{
  int iTime = SHA_GetCurrentTime();
  int iLastTime = GetLocalInt(OBJECT_SELF, "STORED_TIME");
  SetLocalInt(OBJECT_SELF, "STORED_TIME", iTime);


  if(iTime != iLastTime)
  {
      if(GetLocalInt(GetModule(), "SHUTDOWN_SSE"))
      { return; }
      //There has been a day/night transition! Signal Event!
      object oPC = GetFirstPC();
      while(GetIsObjectValid(oPC) && !GetIsDM(oPC) && !GetLocalInt(GetArea(oPC), "DISABLE_SUBRACE_ENGINE"))
      {
           string subrace = GetLocalString(oPC, SUBRACE_TAG);
           if(subrace != "")
           {
               string SubraceTag = SUBRACE_TAG + "_" + subrace;
               ApplyTemporarySubraceAppearance(SubraceTag, oPC, iTime);
               ApplySubraceEffect(oPC, SubraceTag, iTime);
               CheckIfCanUseEquipedWeapon(oPC);
               DelayCommand(6.0, CheckIfCanUseEquippedArmor(oPC));
               DelayCommand(8.0, EquipTemporarySubraceSkin(SubraceTag, oPC, iTime));
               DelayCommand(11.0, EquipTemporarySubraceClaw(SubraceTag, oPC, iTime));
           }
           oPC = GetNextPC();
      }
  }
}



Here are the others you requested.

void ApplySubraceEffect(object oPC, string SubraceTag, int TimeOfDay)
{
   int EffectCount = GetLocalInt(oStorer, SubraceTag + "_" + SUBRACE_EFFECT_COUNT);
   if(EffectCount == 0)
   {
       return;
   }

   ClearSubraceEffects(oPC);
   int i = 0;
   while(i != EffectCount)
   {
     i++;
     string SubraceTag1 = SubraceTag + IntToString(i);
     int EffectID =  GetLocalGroupFlagValue(oStorer, SubraceTag1 + "_" + SUBRACE_EFFECT,SUBRACE_EFFECT_FLAGSET);
     //SendMessageToPC(oPC, "Effect Num: " + IntToString(EffectID));
     //SendMessageToPC(oPC, "Time of Day: " + IntToString(TimeOfDay));
     int EffectTimeOfDay = GetLocalGroupFlagValue(oStorer, SubraceTag1 + "_" + SUBRACE_EFFECT,SUBRACE_EFFECT_TIME_FLAGSET);
     //SendMessageToPC(oPC, "Effect time: " + IntToString(EffectTimeOfDay));
     if(EffectTimeOfDay == TIME_BOTH || EffectTimeOfDay == TimeOfDay)
     {
        ApplyUniqueSubraceEffect(oPC, SubraceTag1, EffectID);
     }
  }
  SHA_SendSubraceMessageToPC(oPC, MESSAGE_SUBRACE_EFFECTS_APPLIED, FALSE);
}


void ApplyTemporarySubraceAppearance(string SubraceTag, object oPC, int iCurrentTime)
{
   int Level = GetPlayerLevel(oPC);
   while(Level)
   {
       string SubraceTag1 = SubraceTag + "_" + IntToString(Level);
       int iTime = GetLocalGroupFlagValue(oStorer, SubraceTag1 + "_" + APPEARANCE_CHANGE, TIME_FLAGS);
       if(iTime && iTime != TIME_NONE)
       {
           if(iTime == TIME_BOTH)
           {  }
           else if(iTime == iCurrentTime)
           {
                ChangePCAppearance(oPC, SubraceTag1);
           }
           else if(iTime != iCurrentTime)
           {
                ChangeToPCDefaultAppearance(oPC);
           }
           return;
       }
       Level--;
   }
}


PS Please note that the Sha_clock is placed on the heartbeat of a placeable within the module
               
               

               


                     Modifié par NightbladeCH, 11 novembre 2010 - 07:21 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #8 on: November 11, 2010, 07:40:40 pm »


               And you did make sure that the placeable is set to plot or not being destroyed in any way? Like if the area that the item is in has a clean up script running it could destroy the object..even if it is set to plot(depending on the script).

To rule out you clock or day/night cycle....try putting this in an area HB and test it through a change in day and night:


void main()
{
    object oPC = GetFirstPC();
    while (GetIsObjectValid(oPC))
    {
        if ((GetIsDawn() || GetIsDay()) && GetSubRace(oPC) == "Vampire")
        {
            effect eDamage = EffectDamage(10, DAMAGE_TYPE_FIRE);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
        }

        if ((GetIsNight() || GetIsDusk()) && GetSubRace(oPC) == "Vampire")
        {
            SendMessageToPC(oPC, "It's Night time. You're ok.");
        }
        oPC = GetNextPC();
    }
}

Just make sure the subrace(Vampire) is correct. I'm pretty sure it is case sensetive...but don't quote me on that.
               
               

               


                     Modifié par GhostOfGod, 11 novembre 2010 - 07:43 .
                     
                  


            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #9 on: November 11, 2010, 07:57:05 pm »


               Ok, i tested the script you sent me by placing it on the HB of an area, and it works correctly. Only effects vamps. So i guess its NOT what i thought *frowns* that only means ive got no clue what the issue is lol. To answer your previous question it is a plot item, and there is no cleanup script.
               
               

               


                     Modifié par NightbladeCH, 11 novembre 2010 - 08:00 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #10 on: November 11, 2010, 09:03:11 pm »


               This is probably not what you want to hear, but unless you're able to contact Shayan on his forums for the subrace scripts...it's time to put in debug code. Have you done that before? It generally involves inserting lines to have GetFirstPC() (as you're typically the only pc on the server when testing) sent messages at various points throughout the code. This allows you to diagnose what is firing when, and what isn't acting as you expect. It will greatly demystify the debugging process.

If you like, you can put this function in at the top of the core include or includes and simply drop in a call to it at every point in the code you want to check something.

void Debug(string sDebugLine) {
    object oPC = GetFirstPC();
    AssignCommand(oPC, SpeakString("DEBUG: " + sDebugLine));
}

One it's at the top of the include/s, you can apply it liberally to figure out what the heck is going on. Suppose there's an if statement you're not sure is firing. Inside it, you would put:

Debug("If statement number 1 fired.");

Suppose there's an int variable you want to check the value of during execution:
int nSomeInt = SOMEOTHERINT*5;
Debug("Int named nSomeInt value: " + IntToString(nSomeInt));

And so on.

Good luck.
Funky
               
               

               
            

Legacy_NightbladeCH

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Question regarding Shaya and the day/night cycle
« Reply #11 on: November 11, 2010, 09:18:25 pm »


               Ok thanks funky, ill give it a whirl. Thanks for your help as well God, i appriciate it
               
               

               


                     Modifié par NightbladeCH, 11 novembre 2010 - 09:18 .