REO-EE/_module/nss/qx_on_chat.nss
Jaysyn904 f82740bbbd Initial commit
Initial commit
2024-02-22 13:22:03 -05:00

187 lines
6.5 KiB
Plaintext

#include "cbt_atk_inc"
#include "cbt_common"
void Test1(object oPC);
void main()
{
object oPC = GetPCChatSpeaker();
string sChat = GetPCChatMessage();
int iShots;
object oTarget;
effect eFreeze;
SendMessageToPC(oPC, "PC Chat Message = [" + sChat + "]");
if (sChat == "debug_mode")
{
SetDebugMode();
}
else if (GetSubString(sChat, 0, 4) == "shot")
{
iShots = StringToInt(GetSubString(sChat,4,GetStringLength(sChat)-4));
SetNumberShotsToFire(oPC, iShots);
SetPCChatMessage();
}
else if (sChat == "fixmodel")
{
int iPheno = GetPhenoType(oPC);
SetPhenoType(PHENOTYPE_BIG, oPC);
DelayCommand(2.0,SetPhenoType(iPheno,oPC));
}
else if (sChat == "jump")
{
AssignCommand(oPC,ClearAllActions(TRUE ));
AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM5,3.0));
}
else if (sChat == "chainsaw")
{
AssignCommand(oPC,ClearAllActions(TRUE ));
AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM10,3.0,5.0));
// move to include file
}
else if (sChat == "setsilencer") // move to include file and make weapon specific
{
if (!GetLocalInt(oPC,CBT_OVR_SVAR_ATTACK_SILENCED))
{
SendMessageToPC(oPC,"Silencer On");
SetLocalInt(oPC,CBT_OVR_SVAR_ATTACK_SILENCED,TRUE);
}
else
{
SendMessageToPC(oPC,"Silencer Off");
SetLocalInt(oPC,CBT_OVR_SVAR_ATTACK_SILENCED,FALSE);
}
}
else if (sChat == "grenade")
{
AssignCommand(oPC,ClearAllActions(TRUE ));
AssignCommand(oPC, PlayAnimation(CBT_OVR_ANIMATION_THROW_OBJECT));
oTarget = GetTarget(oPC);
effect eExplosion = EffectVisualEffect(VFX_FNF_FIREBALL);
DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_INSTANT,eExplosion,oTarget));
}
else if (sChat == "setpistol")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_PISTOL);
}
else if (sChat == "setrifle")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_RIFLE);
}
else if (sChat == "setdualpistol")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_PISTOL_DUAL);
}
else if (sChat == "setsmg")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_SMG);
}
else if (sChat == "setdualsmg")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_SMG_DUAL);
}
else if (sChat == "setshotgun")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_SHOTGUN);
}
else if (sChat == "setnone")
{
SetLocalInt(oPC, CBT_OVR_SVAR_ATTACK_ANIMATION,CBT_OVR_ANIMATION_NONE);
}
else if (sChat == "!attack")
{
oTarget = GetTarget(oPC);
if (GetIsObjectValid(oTarget))
{
SetAttackAllowed(oPC,TRUE);
AssignCommand(oPC,ActionAttack(oTarget));
}
SetPCChatMessage();
}
else if (sChat == "!cancelattack")
{
SetAttackAllowed(oPC,FALSE);
AssignCommand(oPC,ClearAllActions(TRUE));
}
else if (sChat == "!reload")
{
//ReloadWeapons(oPC);
}
else if (sChat == "!dualreload")
{
//ReloadWeapons(oPC,TRUE);
}
else if (sChat == "!duck")
{
ClearAllActions(TRUE);
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_DODGE_DUCK));
eFreeze = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
DelayCommand(0.75, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eFreeze, oPC));
AssignCommand(oPC, SetCommandable(FALSE, oPC));
}
else if (sChat == "!unduck")
{
ClearAllActions(TRUE);
eFreeze = GetFirstEffect(oPC);
while (GetIsEffectValid(eFreeze))
{
if (GetEffectType(eFreeze) == EFFECT_TYPE_VISUALEFFECT && GetEffectDurationType(eFreeze) == DURATION_TYPE_PERMANENT)
{
RemoveEffect(oPC, eFreeze);
SetCommandable(TRUE, oPC);
return;
}
else
{
eFreeze = GetNextEffect(oPC);
}
}
}
else if (sChat == "!dodge")
{
ClearAllActions(TRUE);
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_FIREFORGET_DODGE_SIDE));
AssignCommand(oPC, SetCommandable(FALSE, oPC));
DelayCommand(1.0, SetCommandable(TRUE, oPC));
//eFreeze = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
//DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFreeze, oPC, 2.0));
}
else if (GetSubString(sChat, 0, 6) == "timing")
{
float timing = StringToFloat(GetSubString(sChat,6,GetStringLength(sChat)-6));
SetLocalFloat(oPC, "TIMING_TEST", timing);
SetPCChatMessage();
}
else if (GetSubString(sChat, 0, 5) == "delay")
{
float delay = StringToFloat(GetSubString(sChat,5,GetStringLength(sChat)-5));
SetLocalFloat(oPC, "DELAY_TEST", delay);
SetPCChatMessage();
}
else if (sChat == "!test1")
{
DelayCommand(GetLocalFloat(oPC, "DELAY_TEST"), Test1(oPC));
DelayCommand(GetLocalFloat(oPC, "DELAY_TEST")*2, Test1(oPC));
DelayCommand(GetLocalFloat(oPC, "DELAY_TEST")*3, Test1(oPC));
//DelayCommand(0.45, AssignCommand(oPC, ClearAllActions(TRUE)));
//DelayCommand(GetLocalFloat(oPC, "TIMING_TEST"), AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM20,1.0,GetLocalFloat(oPC, "TIMING_TEST"))));
//DelayCommand(GetLocalFloat(oPC, "TIMING_TEST")*2, AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM20,1.0,GetLocalFloat(oPC, "TIMING_TEST"))));
//DelayCommand(GetLocalFloat(oPC, "TIMING_TEST")*3, AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM20,1.0,GetLocalFloat(oPC, "TIMING_TEST"))));
//DelayCommand(0.95, AssignCommand(oPC, ClearAllActions(TRUE)));
//DelayCommand(1.0, AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM20,1.0,0.1)));
//AssignCommand(oPC, SetCommandable(FALSE, oPC));
//DelayCommand(1.0, SetCommandable(TRUE, oPC));
//eFreeze = EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION);
//DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eFreeze, oPC, 2.0));
}
}
void Test1(object oPC)
{
ClearAllActions(TRUE);
SendMessageToPC(oPC, "Entering Test1");
AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_CUSTOM20,8.0,GetLocalFloat(oPC, "TIMING_TEST")));
}