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

129 lines
5.9 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
//
// Talus Menu on Rest
// tal_emote_univ
// OPW Integration and Clean Up By Don Anderson
// dandersonru@msn.com
//
// Used in Rest Menu Conversation
//
////////////////////////////////////////////////////////////////////////////////
#include "x2_inc_toollib"
void SmokePipe(object oActivator);
void main()
{
float emspeed=GetLocalFloat(OBJECT_SELF,"emspeed");
AssignCommand(OBJECT_SELF,ClearAllActions());
switch( GetLocalInt(OBJECT_SELF,"emote"))
{
case 1: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_WORSHIP,emspeed,3600.00)); break;
case 2: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,emspeed,3600.00)); break;
case 3: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_SPASM,emspeed,3600.00)); break;
case 4: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,emspeed,3600.00)); break;
case 5: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,emspeed,3600.00)); break;
case 6: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_TALK_FORCEFUL,emspeed,3600.00)); break;
case 7: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS,emspeed,3600.00)); break;
case 8: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_MEDITATE,emspeed,3600.00)); break;
case 9: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT,emspeed,3600.00)); break;
case 10: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK,emspeed,3600.00)); break;
case 11: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_DRUNK,emspeed,3600.00)); break;
case 12: SmokePipe(OBJECT_SELF); break;
case 13: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_CONJURE1,emspeed,3600.00)); break;
case 14: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_CONJURE2,emspeed,3600.00)); break;
case 15: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_GREETING,emspeed,3600.00)); break;
case 16: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_SALUTE,emspeed,3600.00)); break;
case 17: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_BOW,emspeed,3600.00)); break;
case 18: AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_LOOPING_LOOK_FAR,emspeed,3600.00)); break;
case 19:
switch(d3())
{
case 1:AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY1,emspeed,3600.00));break;
case 2:AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2,emspeed,3600.00));break;
case 3:AssignCommand(OBJECT_SELF,ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY3,emspeed,3600.00));break;
}
break;
}
}
//Smoking Function by Jason Robinson
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);
}
//Smoking Function by Jason Robinson
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 (GetRacialType(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 (GetRacialType(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) && (GetRacialType(oActivator) != RACIAL_TYPE_DWARF))
{
AssignCommand(oActivator, ActionPlayAnimation(ANIMATION_FIREFORGET_HEAD_TURN_LEFT, 1.0, 5.0));
}
}