Merged redundant hak files. Moved hak scripts into module. Updated gitignore. Full Compile. Added release folder & archive.
163 lines
6.6 KiB
Plaintext
163 lines
6.6 KiB
Plaintext
///////////////////////////////////////////////////////////////////////////////////
|
|
// REAL TIME STRATEGY ADVENTURE - Kit
|
|
// FILE: rtsa_wrap4
|
|
// NAME: OnConversation Dynamic script wrapper
|
|
// SCRIPTED BY: Deva Bryson Winblood
|
|
// DATE: 3/27/2003
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
#include "NW_I0_GENERIC"
|
|
#include "rtsa_headerp" // parser
|
|
|
|
void main()
|
|
{
|
|
object oMe=OBJECT_SELF;
|
|
string sNum="4";
|
|
string sRes=GetResRef(oMe);
|
|
object oH=GetObjectByTag(sRes+"_CSCRIPT"+sNum);
|
|
int nMatch = GetListenPatternNumber();
|
|
object oShouter = GetLastSpeaker();
|
|
object oIntruder;
|
|
object oMod=GetModule();
|
|
string sID=GetLocalString(oMe,"sTeamID");
|
|
object oLead=GetLocalObject(oMod,"oTeamLead"+sID);
|
|
string sCommand;
|
|
string sUnit="n"+GetResRef(oMe)+"COM";
|
|
//SendMessageToPC(GetFirstPC(),"["+GetName(oMe)+"] Heard something.");
|
|
if (oH!=OBJECT_INVALID)
|
|
ExecuteScript(GetName(oH),oMe);
|
|
sRes=GetLocalString(oMe,"sCRSP"+sNum);
|
|
if (GetStringLength(sRes)>1)
|
|
{ // run custom script
|
|
ExecuteScript(sRes,oMe);
|
|
} // run custom script
|
|
else
|
|
{ // normal operation--------------------------------------------------
|
|
|
|
if (nMatch == -1 && GetCommandable(OBJECT_SELF))
|
|
{
|
|
ClearAllActions();
|
|
BeginConversation();
|
|
}
|
|
else
|
|
if(nMatch != -1 && GetIsObjectValid(oShouter) && !GetIsPC(oShouter) && GetIsFriend(oShouter))
|
|
{
|
|
if(nMatch == 4)
|
|
{
|
|
oIntruder = GetLocalObject(oShouter, "NW_BLOCKER_INTRUDER");
|
|
}
|
|
else if (nMatch == 5)
|
|
{
|
|
oIntruder = GetLastHostileActor(oShouter);
|
|
if(!GetIsObjectValid(oIntruder))
|
|
{
|
|
oIntruder = GetAttemptedAttackTarget();
|
|
if(!GetIsObjectValid(oIntruder))
|
|
{
|
|
oIntruder = GetAttemptedSpellTarget();
|
|
if(!GetIsObjectValid(oIntruder))
|
|
{
|
|
oIntruder = OBJECT_INVALID;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
RespondToShout(oShouter, nMatch, oIntruder);
|
|
}
|
|
if (nMatch==112670&&oShouter==oLead)
|
|
{ // leader issued a command
|
|
sCommand=GetMatchedSubstring(1);
|
|
//SendMessageToPC(GetFirstPC()," HEARD:"+GetMatchedSubstring(0)+" '"+sCommand+"'");
|
|
if (sCommand=="run")
|
|
{ // set me to run
|
|
SetLocalInt(oMe,"nRun",TRUE);
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will run."));
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to run
|
|
else if (sCommand=="walk")
|
|
{ // set me to peaceful
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will walk."));
|
|
SetLocalInt(oMe,"nRun",FALSE);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to peaceful
|
|
else if (sCommand=="follow"&&GetLocalInt(oMod,sUnit+"1")!=0)
|
|
{ // set me to follow leader
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will follow you."));
|
|
SetLocalObject(oMe,"oDest",oLead);
|
|
SetLocalInt(oMe,"nMState",1);
|
|
SetLocalInt(oMe,"nSState",0);
|
|
SetLocalInt(oMe,"nParm",2);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to follow leader
|
|
else if (sCommand=="stand"&&GetLocalInt(oMod,sUnit+"22")!=0)
|
|
{ // set me to stand
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will stand here."));
|
|
SetLocalInt(oMe,"nMState",22);
|
|
SetLocalInt(oMe,"nSState",0);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to stand
|
|
else if (sCommand=="peace")
|
|
{ // set me to peaceful
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will be peaceful."));
|
|
SetLocalInt(oMe,"nAggression",1);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to peaceful
|
|
else if (sCommand=="fight")
|
|
{ // set me to aggressive
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will be aggressive."));
|
|
SetLocalInt(oMe,"nAggression",0);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to aggressive
|
|
else if (sCommand=="recon"&&GetLocalInt(oMod,sUnit+"11")!=0)
|
|
{ // set me to recon
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will recon ahead."));
|
|
SetLocalInt(oMe,"nMState",11);
|
|
SetLocalInt(oMe,"nSState",0);
|
|
SetLocalInt(oMe,"nParm",2);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to recon
|
|
else if (sCommand=="seek"&&GetLocalInt(oMod,sUnit+"6")!=0)
|
|
{ // set me to seek and destroy
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will seek and destroy."));
|
|
SetLocalInt(oMe,"nMState",6);
|
|
SetLocalInt(oMe,"nSState",0);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to seek and destroy
|
|
else if (sCommand=="retreat"&&GetLocalInt(oMod,sUnit+"28")!=0)
|
|
{ // set me to retreat
|
|
if (GetAbilityScore(oMe,ABILITY_INTELLIGENCE)>7)
|
|
AssignCommand(oMe,SpeakString("I will retreat."));
|
|
SetLocalInt(oMe,"nMState",28);
|
|
SetLocalInt(oMe,"nSState",0);
|
|
if (d6()==1) AssignCommand(oMe,PlayVoiceChat(VOICE_CHAT_YES));
|
|
} // set me to retreat
|
|
else if (sCommand=="commands"||sCommand=="?")
|
|
{ // list commands
|
|
AssignCommand(oMe,SpeakString("I will respond to run, walk, follow, stand, peace, fight, recon, seek, or retreat."));
|
|
} // list commands
|
|
else if ((fnParse(sCommand," ")=="group")&&GetLocalObject(oShouter,"oLastSpokeTo")==oMe)
|
|
{ // group command ?
|
|
SetLocalString(oMe,"sCommand",sCommand);
|
|
ExecuteScript("rtsa_list_group",oMe);
|
|
} // group command ?
|
|
} // leader issued a command
|
|
else if (nMatch=91474&&oShouter==oLead)
|
|
{ // leader issued trade commands
|
|
sCommand=GetMatchedSubstring(1);
|
|
SetLocalString(oMe,"sCommand",sCommand);
|
|
ExecuteScript("rtsa_list_trade",oMe); // execute trade listen command
|
|
} // leader issued trade commands
|
|
if(GetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT))
|
|
{
|
|
SignalEvent(OBJECT_SELF, EventUserDefined(1004));
|
|
}
|
|
} // normal operation--------------------------------------------------
|
|
}
|