Battledale_PRC8/_module/nss/jhr_i0_pipe.nss
Jaysyn904 e5b3f6ad61 Finished PRC8 integration
Finished PRC8 integration.  Moved creature abilities to top hak.  Setup tooling.  Created release archive
2024-03-12 21:27:23 -04:00

132 lines
3.8 KiB
Plaintext

#include "prc_inc_racial"
location GetLocationAboveAndInFrontOf(object oPC, float fDist, float fHeight)
{
float fDistance = -fDist;
object oTarget = (oPC);
object oArea = GetArea(oTarget);
vector vPosition = GetPosition(oTarget);
vPosition.z += fHeight;
float fOrientation = GetFacing(oTarget);
vector vNewPos = AngleToVector(fOrientation);
float vZ = vPosition.z;
float vX = vPosition.x - fDistance * vNewPos.x;
float vY = vPosition.y - fDistance * vNewPos.y;
fOrientation = GetFacing(oTarget);
vX = vPosition.x - fDistance * vNewPos.x;
vY = vPosition.y - fDistance * vNewPos.y;
vNewPos = AngleToVector(fOrientation);
vZ = vPosition.z;
vNewPos = Vector(vX, vY, vZ);
return Location(oArea, vNewPos, fOrientation);
}
void SmokePipe(object oActivator)
{
string sEmote1 = "*puffs on a pipe*";
string sEmote2 = "*inhales from a pipe*";
string sEmote3 = "*pulls a mouthful of smoke from a pipe*";
float fHeight = 1.7;
float fDistance = 0.1;
// Set height based on race and gender
if (GetGender(oActivator) == GENDER_MALE)
{
switch (MyPRCGetRacialType(oActivator))
{
case RACIAL_TYPE_HUMAN:
case RACIAL_TYPE_HALFELF:
fHeight = 1.7;
fDistance = 0.12;
break;
case RACIAL_TYPE_ELF:
fHeight = 1.55;
fDistance = 0.08;
break;
case RACIAL_TYPE_GNOME:
case RACIAL_TYPE_HALFLING:
fHeight = 1.15;
fDistance = 0.12;
break;
case RACIAL_TYPE_DWARF:
fHeight = 1.2;
fDistance = 0.12;
break;
case RACIAL_TYPE_HALFORC:
fHeight = 1.9;
fDistance = 0.2;
break;
}
}
else
{
// FEMALES
switch (MyPRCGetRacialType(oActivator))
{
case RACIAL_TYPE_HUMAN:
case RACIAL_TYPE_HALFELF:
fHeight = 1.6;
fDistance = 0.12;
break;
case RACIAL_TYPE_ELF:
fHeight = 1.45;
fDistance = 0.12;
break;
case RACIAL_TYPE_GNOME:
case RACIAL_TYPE_HALFLING:
fHeight = 1.1;
fDistance = 0.075;
break;
case RACIAL_TYPE_DWARF:
fHeight = 1.2;
fDistance = 0.1;
break;
case RACIAL_TYPE_HALFORC:
fHeight = 1.8;
fDistance = 0.13;
break;
}
}
location lAboveHead = GetLocationAboveAndInFrontOf(oActivator, fDistance, fHeight);
// emotes
switch (d3())
{
case 1:
AssignCommand(oActivator, ActionSpeakString(sEmote1));
break;
case 2:
AssignCommand(oActivator, ActionSpeakString(sEmote2));
break;
case 3:
AssignCommand(oActivator, ActionSpeakString(sEmote3));
break;
}
// glow red
AssignCommand(oActivator, ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_LIGHT_RED_5), oActivator, 0.15)));
// wait a moment
AssignCommand(oActivator, ActionWait(3.0));
// puff of smoke above and in front of head
AssignCommand(oActivator, ActionDoCommand(ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SMOKE_PUFF), lAboveHead)));
// if female, turn head to left
if ((GetGender(oActivator) == GENDER_FEMALE) && (MyPRCGetRacialType(oActivator) != RACIAL_TYPE_DWARF))
AssignCommand(oActivator, ActionPlayAnimation(ANIMATION_FIREFORGET_HEAD_TURN_LEFT, 1.0, 5.0));
// funky effect
//ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectParalyze(), oActivator);
}