mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-27 16:56:48 -04:00
155 lines
3.8 KiB
Plaintext
155 lines
3.8 KiB
Plaintext
include library.ai_lib;
|
|
include library.chat;
|
|
include library.combat;
|
|
include library.utils;
|
|
include library.pclib;
|
|
include library.pet_lib;
|
|
|
|
const string EMOTE_DATATABLE = "datatables/npc/stormtrooper_attitude/emote.iff";
|
|
const string STF_FILE = "event/gcw_raids";
|
|
|
|
trigger OnSawEmote(obj_id emoteSayer, string emotein)
|
|
{
|
|
obj_id emotetarget = getLookAtTarget(emoteSayer);
|
|
int type = getIntObjVar(self, "event.gcwraids.type");
|
|
dictionary params = new dictionary();
|
|
|
|
// Luke always turns the other cheek.
|
|
if(type == 1)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
if(!isIdValid(emotetarget) || ai_lib.isInCombat(self) || ai_lib.isInCombat(emoteSayer) || isIncapacitated(self) || isDead(self) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if(emotetarget == self)
|
|
{
|
|
int belligerence = getEmoteBeligerence(emotein);
|
|
|
|
// You mess with Vader in the least you die
|
|
if(type == 0 && belligerence > 0)
|
|
{
|
|
params.put("emoteSayer", emoteSayer);
|
|
messageTo(self, "forceChokeThisGuy", params, 1, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler forceChokeThisGuy()
|
|
{
|
|
obj_id emoteSayer = params.getObjId("emoteSayer");
|
|
faceTo(self, emoteSayer);
|
|
|
|
doAnimationAction(self, "force_choke" );
|
|
doAnimationAction(emoteSayer, "heavy_cough_vomit");
|
|
|
|
int type = getIntObjVar(self, "event.gcwraids.type");
|
|
int randomLine = rand(0, 9);
|
|
string_id myLine = new string_id(STF_FILE, "thwap_" + type + "_" + randomLine);
|
|
chat.chat(self, chat.CHAT_SAY, chat.MOOD_NONE, myLine);
|
|
|
|
params.put("emoteSayer", emoteSayer);
|
|
messageTo(self, "finishHim", params, 6, false);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler finishHim()
|
|
{
|
|
obj_id emoteSayer = params.getObjId("emoteSayer");
|
|
faceTo(self, emoteSayer);
|
|
|
|
|
|
playKnockdown(emoteSayer, self);
|
|
setAttrib(emoteSayer, HEALTH, (rand(30, 90) * -1));
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int getEmoteBeligerence(string emote)
|
|
{
|
|
int emote_row = dataTableSearchColumnForString(emote, 0, EMOTE_DATATABLE);
|
|
int st_emote_type = dataTableGetInt(EMOTE_DATATABLE, emote_row, 1);
|
|
|
|
if(st_emote_type == 3)
|
|
{
|
|
return 3;
|
|
}
|
|
else if (st_emote_type == 2)
|
|
{
|
|
return 2;
|
|
}
|
|
else if (st_emote_type == 1)
|
|
{
|
|
return 1;
|
|
}
|
|
else if (st_emote_type == 0)
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
void playKnockdown(obj_id victim, obj_id attacker)
|
|
{
|
|
if ( !isIdValid(victim) || !isIdValid(attacker) )
|
|
return;
|
|
|
|
string strPlaybackScript = "";
|
|
obj_id objWeapon = getCurrentWeapon(attacker);
|
|
int intWeaponType = getWeaponType(objWeapon);
|
|
int intWeaponCategory = combat.getWeaponCategory(intWeaponType);
|
|
|
|
if(intWeaponCategory==combat.RANGED_WEAPON)
|
|
{
|
|
strPlaybackScript = "ranged_melee_light";
|
|
}
|
|
else
|
|
{
|
|
strPlaybackScript = "attack_high_center_light_0";
|
|
}
|
|
|
|
//lets get all the people trying to exploit the dismount code
|
|
if(pet_lib.isMounted(victim))
|
|
pet_lib.doDismountNow(victim, false);
|
|
|
|
attacker_results cbtAttackerResults = new attacker_results();
|
|
defender_results[] cbtDefenderResults = new defender_results[1];
|
|
cbtDefenderResults[0] = new defender_results();
|
|
|
|
cbtAttackerResults.id = attacker;
|
|
cbtAttackerResults.endPosture = getPosture(attacker);
|
|
cbtAttackerResults.weapon = objWeapon;
|
|
|
|
cbtDefenderResults[0].endPosture = POSTURE_INCAPACITATED;
|
|
cbtDefenderResults[0].result = COMBAT_RESULT_HIT;
|
|
cbtDefenderResults[0].id = victim;
|
|
doCombatResults(strPlaybackScript, cbtAttackerResults, cbtDefenderResults);
|
|
|
|
}
|
|
/**************
|
|
trigger OnHearSpeech(obj_id objSpeaker, string strText) // Added for testing
|
|
{
|
|
|
|
if(isGod(objSpeaker))
|
|
{
|
|
if(toLower(strText).startsWith("saber") )
|
|
{
|
|
obj_id vadersStuff = utils.getInventoryContainer(self);
|
|
obj_id vaderSaber = createObject("object/weapon/melee/2h_sword/crafted_saber/sword_lightsaber_two_handed_gen1.iff", vadersStuff, "");
|
|
obj_id test = createObject("object/tangible/deed/player_house_deed/corellia_house_large_deed.iff", vadersStuff, "");
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
***************/ |