Last active
March 6, 2019 22:25
-
-
Save stupidpupil/68d5309d78d73123acb014b09b0542e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ZeteticCharacterVoice_ZetBastila extends XComCharacterVoice; | |
struct EventMap | |
{ | |
var() Name EventName; | |
var() array<Name> FallbackNames; | |
var() array<Name> SoundCueNames; | |
}; | |
var() editinline array<EventMap> Events; | |
var array<int> SoundCueIndices; | |
const ModName="ZetBastila"; | |
const DEBUG=FALSE; | |
function l(String message) | |
{ | |
if (DEBUG) | |
`log(ModName$" - "$message); | |
} | |
function PlaySoundForEvent(Name nEvent, Actor Owner) | |
{ | |
local Name cueName; | |
local SoundCue cue; | |
local bool bProfileSettingsEnabledChatter; | |
local bool bKismetDisabledChatter; | |
local bool bChatterDisabledByINI; | |
bProfileSettingsEnabledChatter = `XPROFILESETTINGS != none && `XPROFILESETTINGS.Data.m_bEnableSoldierSpeech; | |
bKismetDisabledChatter = `BATTLE != none && `BATTLE.m_kDesc.m_bDisableSoldierChatter; | |
bChatterDisabledByINI = class'X2BodyPartTemplateManager'.static.GetBodyPartTemplateManager().DisableCharacterVoices; | |
if (!bProfileSettingsEnabledChatter || bKismetDisabledChatter || bChatterDisabledByINI) | |
return; | |
if (DEBUG && `PRES != none) | |
`PRES.GetWorldMessenger().Message(string(nEvent), Owner.Location); | |
l("received event "$nEvent); | |
cueName = GetSoundCueNameForEvent(nEvent); | |
if (cueName == '') | |
return; | |
l("got cue "$cueName); | |
cue = SoundCue(DynamicLoadObject(ModName$"Pkg."$cueName$"_Cue", class'SoundCue')); | |
if (cue == None) | |
{ | |
l("couldn't find SoundCue with name "$cueName); | |
return; | |
} | |
cue.SoundClass = 'Voice'; | |
cue.VolumeMultiplier = 1.33; | |
Owner.PlaySound(cue, true); | |
} | |
// Returns a SoundCueName *without* a package identifier | |
function Name GetSoundCueNameForEvent(Name nEvent) | |
{ | |
local int i; | |
local int soundCueIndex; | |
local int minJump; | |
local int maxJump; | |
local EventMap evtMp; | |
local Name fallbackName; | |
local Name tempName; | |
l("looking for cue for event "$nEvent); | |
i = Events.Find('EventName', nEvent); | |
if (i == INDEX_NONE) | |
{ | |
l("no event found with name "$nEvent); | |
// Check if this event contains an attitude suffix like "_BY_THE_BOOK" | |
// (but don't automatically fallback for "_w" whispered lines) | |
i = InStr(nEvent, "_"); | |
if (i > 0 && !(Right(nEvent, Len(nEvent) - (i+1)) ~= "w")) | |
return GetSoundCueNameForEvent(Name(Left(nEvent, i))); | |
return ''; | |
} | |
evtMp = Events[i]; | |
soundCueIndex = SoundCueIndices[i]-1; | |
// If there are any SoundCues, pick one | |
if (evtMp.SoundCueNames.Length > 0) | |
{ | |
if(soundCueIndex == -1) | |
{ | |
l("initialising SoundCueIndex"); | |
soundCueIndex = Rand(evtMp.SoundCueNames.Length); | |
} | |
else | |
{ | |
// At this point we want to pick a different SoundCue | |
// to the one we picked last time for this event | |
minJump = 1; | |
// Unless the last choice for this Event was *another* Event | |
// keeping moving forward until we find a different SoundCue | |
if (Left(evtMp.SoundCueNames[soundCueIndex],4) != "Evt_") | |
{ | |
while (((soundCueIndex + minJump) < evtMp.SoundCueNames.Length) && | |
(evtMp.SoundCueNames[soundCueIndex] == evtMp.SoundCueNames[soundCueIndex+minJump])) | |
minJump++; | |
} | |
// Don't jump all the way back round. | |
maxJump = Min(3, evtMp.SoundCueNames.Length - 1 - minJump); | |
// If there's more than about 6 distinct SoundCues, only jump part of the way around | |
maxJump = Max(maxJump, Round(evtMp.SoundCueNames.Length/1.5) - minJump); | |
// (maxJump can end up negative - this is fine.) | |
l("jumping "$minJump$","$maxJump); | |
soundCueIndex = soundCueIndex + minJump + Rand(maxJump); | |
soundCueIndex = soundCueIndex % evtMp.SoundCueNames.Length; | |
} | |
soundCueIndices[i] = soundCueIndex + 1; | |
l("SoundCueIndex = "$(SoundCueIndices[i]-1)); | |
tempName = evtMp.SoundCueNames[soundCueIndex]; | |
if (Left(tempName,4) == "Evt_") //If it's an Event, then restart the process | |
return GetSoundCueNameForEvent(Name(Right(tempName, Len(tempName)-4))); | |
return tempName; | |
} | |
// If there are any fallbacks, work through them | |
foreach evtMp.FallbackNames(fallbackName) | |
{ | |
l("falling back"); | |
tempName = GetSoundCueNameForEvent(fallbackName); | |
if (tempName != '') | |
return tempName; | |
} | |
// Give up! | |
return ''; | |
} | |
defaultproperties | |
{ | |
Events.Add ({( | |
EventName="Moving", | |
SoundCueNames=("Evt_OrderConfirm","Evt_OrderConfirm","Evt_OrderConfirm","Evt_OrderConfirm","Evt_OrderConfirm","We_should_move_on_then","Hm"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Dashing", | |
SoundCueNames=("Evt_Moving","Quickly","We_better_get_moving","Wait_here_I_wont_be_long","Theres_much_to_be_done"), | |
FallbackNames=("Moving") | |
)}) | |
Events.Add ({( | |
EventName="Moving_w", | |
SoundCueNames=("Evt_Moving","Evt_OrderConfirm","I_shall_move_unseen","Travelling_from_one_false_lead_to_the_next","We_must_be_wary","Lets_move_on","If_only_the_right_path_was_always_clear","We_cannot_turn_away_from_the_path","",""), | |
FallbackNames=("Moving") | |
)}) | |
Events.Add ({( | |
EventName="Dashing_w", | |
SoundCueNames=("Evt_Moving_w","Evt_Dashing"), | |
FallbackNames=("Dashing") | |
)}) | |
Events.Add ({( | |
EventName="EnterSquadConcealment", | |
SoundCueNames=("Surprise_and_secrecy_will_serve_us_best","We_would_be_wise_to_keep_our_guard_up") | |
)}) | |
Events.Add ({( | |
EventName="SquadConcealmentBroken", | |
SoundCueNames=("This_must_end_with_blood","Now_you_must_pay_the_price","You_cannot_win") | |
)}) | |
Events.Add ({( | |
EventName="ConcealedSpotted", | |
FallbackNames=("SquadConcealmentBroken") | |
)}) | |
Events.Add ({( | |
EventName="TargetHeard", | |
SoundCueNames=("I_feel_their_dark_presence","I_sense_something_ominous_lurking_in_those_shadows","We_would_be_wise_to_keep_our_guard_up","We_must_be_wary") | |
)}) | |
Events.Add ({( | |
EventName="EnemyPatrolSpotted", | |
SoundCueNames=("We_must_be_wary","Did_you_see_it","","") | |
)}) | |
Events.Add ({( | |
EventName="ADVENTsighting", | |
SoundCueNames=("End_this_now_quickly","We_need_a_plan","","") | |
)}) | |
Events.Add ({( | |
EventName="Reloading", | |
SoundCueNames=("Its_done","Evt_OrderConfirm",""), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Overwatch", | |
SoundCueNames=("Evt_OrderConfirm","Evt_OrderConfirm","I_shall_keep_my_eyes_open","Just_sitting_here","Im_here","Lets_get_down_to_business","Your_lucky_I_was_here"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Overwatch_w", | |
FallbackNames=("Overwatch") | |
)}) | |
Events.Add ({( | |
EventName="HunkerDown", | |
SoundCueNames=("Evt_OrderConfirm","Evt_OrderConfirm","Just_sitting_here","Hm","Im_here"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="ThrowGrenade", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="HealingAlly", | |
SoundCueNames=("Be_still_a_moment_and_let_me_help","Let_me_help","Come_on","Evt_OrderConfirm"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="StabilizingAlly", | |
FallbackNames=("HealingAlly") | |
)}) | |
Events.Add ({( | |
EventName="LootSpotted", | |
SoundCueNames=("Did_you_see_it","","") | |
)}) | |
Events.Add ({( | |
EventName="Confused", | |
SoundCueNames=("This_is_its_strange","Strange") | |
)}) | |
Events.Add ({( | |
EventName="SoldierResistsMindControl", | |
SoundCueNames=("What_type_of_trick_is_this","There_is_no_passion_there_is_serenity","There_is_no_emotion_there_is_peace","There_is_no_emotion_there_is_peace_2","There_is_no_ignorance_there_is_knowledge","Nobody_owns_me") | |
)}) | |
Events.Add ({( | |
EventName="Burning", | |
FallbackNames=("CryOfPain") | |
)}) | |
Events.Add ({( | |
EventName="Acid", | |
FallbackNames=("Burning") | |
)}) | |
Events.Add ({( | |
EventName="Poison", | |
SoundCueNames=("Poison_I_can_feel_it","Strangled_scream","Evt_CryOfPain"), | |
FallbackNames=("Acid") | |
)}) | |
Events.Add ({( | |
EventName="TakingFire", | |
SoundCueNames=("") | |
)}) | |
Events.Add ({( | |
EventName="ArmorHit", | |
SoundCueNames=("I_suppose_I_should_be_thankful","End_this_now_quickly","Youre_wasting_your_time"), | |
FallbackNames=("TakingFire") | |
)}) | |
Events.Add ({( | |
EventName="TakingDamage", | |
SoundCueNames=("Evt_CryOfPain","Evt_CryOfPain","Evt_CryOfPain","Evt_CryOfPain","End_this_now_quickly"), | |
FallbackNames=("CryOfPain") | |
)}) | |
Events.Add ({( | |
EventName="CriticallyWounded", | |
SoundCueNames=("Evt_TakingDamage","I_am_wounded_badly"), | |
FallbackNames=("TakingDamage") | |
)}) | |
Events.Add ({( | |
EventName="DeathScream", | |
SoundCueNames=("Strangled_scream") | |
)}) | |
Events.Add ({( | |
EventName="TargetMissed", | |
SoundCueNames=("I_am_trying_my_best","I_think_I_may_have_made_a_very_big_mistake","Youre_not_making_this_easy_for_me","There_is_no_emotion_there_is_peace","There_is_no_emotion_there_is_peace_2","There_is_no_passion_there_is_serenity","Why_cant_I_defeat_you","No_this_is_not_possible","I_dont_believe_this") | |
)}) | |
Events.Add ({( | |
EventName="SwordMiss", | |
FallbackNames=("TargetMissed") | |
)}) | |
Events.Add ({( | |
EventName="TargetArmorHit", | |
SoundCueNames=("Im_doing_no_damage","I_think_I_may_have_made_a_very_big_mistake","How_can_you_still_stand_against_me") | |
)}) | |
Events.Add ({( | |
EventName="TargetWinged", | |
SoundCueNames=("I_am_trying_my_best","I_think_I_may_have_made_a_very_big_mistake","Youre_not_making_this_easy_for_me","There_is_no_emotion_there_is_peace","There_is_no_emotion_there_is_peace_2","There_is_no_passion_there_is_serenity","Why_cant_I_defeat_you"), | |
FallbackNames=("TargetMissed") | |
)}) | |
Events.Add ({( | |
EventName="TargetKilled", | |
SoundCueNames=("You_shall_fall","The_fool_is_dead","That_ones_out_of_the_way","Hah","Finally_some_good_news","Its_done","There_take_that") | |
)}) | |
Events.Add ({( | |
EventName="MultipleTargetsKilled", | |
FallbackNames=("TargetKilled") | |
)}) | |
Events.Add ({( | |
EventName="AlienNotStunned", | |
FallbackNames=("TargetMissed") | |
)}) | |
Events.Add ({( | |
EventName="AttemptingHack", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="GenericHackSuccess", | |
SoundCueNames=("Excellent","Its_done","Finally_some_good_news","") | |
)}) | |
Events.Add ({( | |
EventName="HackDoorSuccess", | |
FallbackNames=("GenericHackSuccess") | |
)}) | |
Events.Add ({( | |
EventName="HackTurret", | |
FallbackNames=("HackUnit") | |
)}) | |
Events.Add ({( | |
EventName="HackTurretFailed", | |
FallbackNames=("HackUnitFailed") | |
)}) | |
Events.Add ({( | |
EventName="HackUnit", | |
SoundCueNames=("Evt_GenericHackSuccess") | |
)}) | |
Events.Add ({( | |
EventName="HackUnitFailed", | |
SoundCueNames=("I_think_I_may_have_made_a_very_big_mistake","Is_something_wrong","I_cant","I_am_trying_my_best","No_this_is_not_possible","Nothing_seems_to_be_happening") | |
)}) | |
Events.Add ({( | |
EventName="HackWorkstation", | |
SoundCueNames=("Evt_OrderConfirm","There_is_no_ignorance_there_is_knowledge"), | |
FallbackNames=("GenericHackSuccess") | |
)}) | |
Events.Add ({( | |
EventName="HaywireProtocol", | |
SoundCueNames=("Evt_OrderConfirm","What_greater_weapon_is_there"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="ObjectiveSighted_w", | |
FallbackNames=("ObjectiveSighted") | |
)}) | |
Events.Add ({( | |
EventName="ObjectiveSighted", | |
SoundCueNames=("Did_you_see_it","So_we_have_found_it","Lets_just_remember_where_this_is","We_cant_afford_any_distractions") | |
)}) | |
Events.Add ({( | |
EventName="VIPsighted", | |
FallbackNames=("ObjectiveSighted") | |
)}) | |
Events.Add ({( | |
EventName="VIPsighted_w", | |
FallbackNames=("VIPsighted") | |
)}) | |
Events.Add ({( | |
EventName="EngineerScienceVIP", | |
FallbackNames=("VIPsighted") | |
)}) | |
Events.Add ({( | |
EventName="HostileVIP", | |
SoundCueNames=("What_sort_of_person","") | |
)}) | |
Events.Add ({( | |
EventName="PickingUpBody", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="SquadMemberDead", | |
SoundCueNames=("Is_there_no_end_to_the_killing") | |
)}) | |
Events.Add ({( | |
EventName="TrippedBurrow", | |
FallbackNames=("ADVENTsighting") | |
)}) | |
Events.Add ({( | |
EventName="ThrowFlashbang", | |
FallbackNames=("ThrowGrenade") | |
)}) | |
Events.Add ({( | |
EventName="SmokeGrenade", | |
FallbackNames=("ThrowGrenade") | |
)}) | |
Events.Add ({( | |
EventName="GrapplingHook", | |
FallbackNames=("Moving") | |
)}) | |
Events.Add ({( | |
EventName="EVAC", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="EVACrequest", | |
SoundCueNames=("We_should_go_at_once","We_better_get_moving","We_need_to_regroup","We_have_to_get_out_of_here") | |
)}) | |
Events.Add ({( | |
EventName="RocketLauncher", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Flamethrower", | |
FallbackNames=("RocketLauncher") | |
)}) | |
Events.Add ({( | |
EventName="ShredderGun", | |
FallbackNames=("RocketLauncher") | |
)}) | |
Events.Add ({( | |
EventName="PlasmaBlaster", | |
FallbackNames=("RocketLauncher") | |
)}) | |
Events.Add ({( | |
EventName="ShredStormCannon", | |
FallbackNames=("ShredderGun") | |
)}) | |
Events.Add ({( | |
EventName="RunAndGun", | |
SoundCueNames=("Evt_OrderConfirm","Theres_much_to_be_done","We_cant_just_keep_running"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Reaper", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="ActivateConcealment", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Suppressing", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="BulletShred", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="SaturationFire", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="InTheZone", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="KillZone", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="FanFire", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="CapacitorDischarge", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="MedicalProtocol", | |
FallbackNames=("HealingAlly") | |
)}) | |
Events.Add ({( | |
EventName="RestorativeMist", | |
FallbackNames=("HealingAlly") | |
)}) | |
Events.Add ({( | |
EventName="Domination", | |
SoundCueNames=("Evt_OrderConfirm","What_greater_weapon_is_there"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="SoldierFailsControl", | |
FallbackNames=("TargetMissed") | |
)}) | |
Events.Add ({( | |
EventName="Insanity", | |
SoundCueNames=("Evt_AttackConfirm","You_are_growing_weary_I_can_sense_it"), | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="MindBlast", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="NullLance", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="VoidRift", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="NullShield", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Inspire", | |
SoundCueNames=("There_is_no_chaos_there_is_harmony","Evt_OrderConfirm"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Rend", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Volt", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Amplify", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Pillar", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Invert", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Exchange", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Ghost", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="IonicStorm", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="VoidConduit", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="StunStrike", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Shadow", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="HomingMine", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="RemoteStart", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Banish", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Sting", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="FullThrottle", | |
SoundCueNames=("Evt_OrderConfirm","Theres_much_to_be_done"), | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="CombatPresence", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Justice", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="ManualOverride", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Whiplash", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Judgement", | |
FallbackNames=("AttackConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Interrupt", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="Battlelord", | |
FallbackNames=("OrderConfirm") | |
)}) | |
Events.Add ({( | |
EventName="AlienExperimentSighted", | |
SoundCueNames=("There_are_secrets_here_best_left_uncovered","This_is_its_strange"), | |
FallbackNames=("GenericSighting") | |
)}) | |
Events.Add ({( | |
EventName="AlienFacilitySighted", | |
FallbackNames=("AlienExperimentSighted") | |
)}) | |
Events.Add ({( | |
EventName="AlienFloraSighted", | |
FallbackNames=("GenericSighting") | |
)}) | |
Events.Add ({( | |
EventName="CheckpointSighted", | |
FallbackNames=("GenericSighting") | |
)}) | |
Events.Add ({( | |
EventName="GenericSighting", | |
SoundCueNames=("Did_you_see_it","","") | |
)}) | |
Events.Add ({( | |
EventName="GraffitiSighted", | |
FallbackNames=("GenericSighting") | |
)}) | |
Events.Add ({( | |
EventName="MeatFactorySighted", | |
FallbackNames=("AlienExperimentSighted") | |
)}) | |
Events.Add ({( | |
EventName="OrderConfirm", | |
SoundCueNames=("Alright","As_you_wish_2","As_you_wish","Alright","As_you_wish_2","As_you_wish","Fair_enough","I_shall_do_my_best","Let_me_try","Of_course","Of_course","Of_course_2","Of_course_2","Thats_a_good_idea","Yes","Yes","Yes","Yes","I_was_thinking_that_too","A_wise_decision") | |
)}) | |
Events.Add ({( | |
EventName="AttackConfirm", | |
SoundCueNames=("Evt_OrderConfirm","Evt_OrderConfirm","Evt_OrderConfirm","Evt_OrderConfirm","Lets_make_this_quick","So_be_it") | |
)}) | |
Events.Add ({( | |
EventName="CryOfPain", | |
SoundCueNames=("Pained_cry","Pained_cry2") | |
)}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment