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 .