Rune_PRC8/_module/nss/opw_tutorial.nss
Jaysyn904 d1c309ae63 Initial commit
Initial commit
2024-09-13 09:10:39 -04:00

132 lines
6.0 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
//
// Tutorial Portal
// opw_tutorial
// By Don Anderson
// dandersonru@msn.com
//
// This is the Portal to and from the Tutorial.
//
////////////////////////////////////////////////////////////////////////////////
#include "nbde_inc"
void main()
{
object oPC = GetLastUsedBy();
object oMod = GetModule();
string sItem;
//Don't go further if this is a DM
if(GetIsDM(oPC) == TRUE) return;
//Don't go further if this is not a Player
if(GetIsPC(oPC) == FALSE) return;
object oSTutor = GetObjectByTag("STARTTUTORIAL");//To the Tutorial Area
object oFTutor = GetObjectByTag("FINISHTUTORIAL");//Return from the Tutorial
effect eFX1 = EffectVisualEffect(VFX_IMP_BREACH);
effect eFX2 = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
effect eFX3 = EffectVisualEffect(VFX_IMP_RAISE_DEAD);
effect eFX4 = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_2);
effect eFX5 = EffectVisualEffect(VFX_IMP_RESTORATION_GREATER); // For Healing at Respawn Area
effect eFX6 = EffectVisualEffect(VFX_IMP_HEALING_G); //For after Raise Dead effect at Bind Stone or Home
int nTutor = NBDE_GetCampaignInt("OPW","TUTORIAL",oPC);
float fDelay = 1.5;
//Now we set the Start of the Tutorial
if(nTutor == 0 && GetIsObjectValid(oSTutor) == TRUE)
{
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX1, oPC));
DelayCommand(fDelay + 1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX2, oPC));
DelayCommand(fDelay + 2.0, AssignCommand(oPC, ActionJumpToLocation(GetLocation(oSTutor))));
DelayCommand(fDelay + 3.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, 3.0));
DelayCommand(fDelay + 4.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, eFX3, oPC));
DelayCommand(fDelay + 5.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, 5.0));
DelayCommand(fDelay + 6.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, eFX4, oPC));
DelayCommand(fDelay + 7.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPC)), oPC));
NBDE_SetCampaignInt("OPW","TUTORIAL",1,oPC);
}
//Now we set the Tutorial Information and strip the Player
if(nTutor == 1 && GetIsObjectValid(oFTutor) == TRUE)
{
//Did the Player Die in the Tutorial?
//We check for the Finish Tutorial Waypoint in Same Area as Player
object oTutorDeath = GetNearestObjectByTag("FINISHTUTORIAL",oPC);
if(oTutorDeath != OBJECT_INVALID)
{
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX1, oPC));
DelayCommand(fDelay + 1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX2, oPC));
DelayCommand(fDelay + 2.0, AssignCommand(oPC, ActionJumpToLocation(GetLocation(oSTutor))));
DelayCommand(fDelay + 3.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, 3.0));
DelayCommand(fDelay + 4.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, eFX3, oPC));
DelayCommand(fDelay + 5.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, 5.0));
DelayCommand(fDelay + 6.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, eFX4, oPC));
DelayCommand(fDelay + 7.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPC)), oPC));
return;
}
int nGiveGold = GetLocalInt(oMod,"GIVEGOLD");
//How much gold does the Player already have?
int nGold = GetGold(oPC);
//Too much Gold
if (nGold > nGiveGold)
{
AssignCommand(oPC, TakeGoldFromCreature(nGold - nGiveGold, oPC, TRUE));
}
//Not enough Gold
else if (nGold < nGiveGold)
{
GiveGoldToCreature(oPC, nGiveGold - nGold);
}
//Now we Destroy all the objects in the inventory
object oItem = GetFirstItemInInventory(oPC);
while (oItem != OBJECT_INVALID)
{
sItem = GetTag(oItem);
//Add ALL things you don't want removed going From Tutorial Here
if(sItem != "RuneStone" && sItem != "SoulRune")
{
DestroyObject(oItem);
}
oItem = GetNextItemInInventory(oPC);
}
DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARMS, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CLOAK, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_NECK, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOOTS, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_HEAD, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_RIGHTRING, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_LEFTRING, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BELT, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BOLTS, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_ARROWS, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_BULLETS, oPC), 0.0);
DestroyObject(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC), 0.0);
//Now Send the Player
DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX1, oPC));
DelayCommand(fDelay + 1.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX2, oPC));
DelayCommand(fDelay + 2.0, AssignCommand(oPC, ActionJumpToLocation(GetLocation(oFTutor))));
DelayCommand(fDelay + 3.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oPC, 3.0));
DelayCommand(fDelay + 4.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, eFX3, oPC));
DelayCommand(fDelay + 5.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDazed(), oPC, 5.0));
DelayCommand(fDelay + 6.0, ApplyEffectToObject (DURATION_TYPE_INSTANT, eFX4, oPC));
DelayCommand(fDelay + 7.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oPC)), oPC));
//Now Make the Tutorial Persistent
NBDE_SetCampaignInt("OPW","TUTORIAL",0,oPC);
}
}