Code: Select all
void ShoutWarning(object oNPC, int iNumber, object oTerrorist){
string Warning = "";
switch(iNumber){
case 1 :
switch(d6()){
case 1 : Warning = "Hey, what the hell are you doing ? Quit that immediately.";
break;
case 2 : Warning = "Please refrain from doing that.";
break;
case 3 : Warning = "Hey. Stop that !";
break;
case 4 : Warning = "Quit that you lunatic !";
break;
case 5 : Warning = "Hey. What do you think you're doing ?";
break;
case 6 : Warning = "What the... Stop immediately !";
break;
}
AssignCommand(oNPC, ActionSpeakString(Warning));
break;
case 2 :
switch(d3()){
case 1 : Warning = "Last warning. Quit NOW.";
break;
case 2 : Warning = "I won't warn you again. Stop that.";
break;
case 3 : Warning = "Keep it up and I'll smack you in the face. Quit that !";
break;
}
AssignCommand(oNPC, ActionSpeakString(Warning));
break;
case 3 :
AssignCommand(oNPC, ActionSpeakString("Now you're in for it !"));
AssignCommand(oNPC, PlayVoiceChat(d3()));
SetLocalInt(oNPC, GetName(oTerrorist), 2);
SetIsTemporaryEnemy(oTerrorist, oNPC, TRUE, 90.0);
AssignCommand(oNPC, ActionAttack(oTerrorist));
break;
}
}
void Warn(object oNPC, object oTerrorist){
ShoutWarning(oNPC, GetLocalInt(oNPC, GetName(oTerrorist)), oTerrorist);
SetLocalInt(oNPC, GetName(oTerrorist), GetLocalInt(oNPC, GetName(oTerrorist)) + 1);
}
int GetIsHumanoid(object oObject){
if(GetIsPC(oObject) || GetObjectType(oObject) != OBJECT_TYPE_CREATURE) return 0;
if( GetRacialType(oObject) == RACIAL_TYPE_DWARF ||
GetRacialType(oObject) == RACIAL_TYPE_ELF ||
GetRacialType(oObject) == RACIAL_TYPE_GNOME ||
GetRacialType(oObject) == RACIAL_TYPE_HALFELF ||
GetRacialType(oObject) == RACIAL_TYPE_HALFLING ||
GetRacialType(oObject) == RACIAL_TYPE_HALFORC ||
GetRacialType(oObject) == RACIAL_TYPE_HUMAN)
return 1;
return 0;
}
void main(){
object oTerrorist = GetLastDamager();
object oNPC = GetFirstObjectInArea();
while(GetIsObjectValid(oNPC)){
if(GetIsHumanoid(oNPC) && GetDistanceBetween(oNPC, oTerrorist) <= 25.0){
if(GetLocalInt(oNPC, GetName(oTerrorist)) < 1)
AssignCommand(oNPC, ActionMoveToObject(oTerrorist, FALSE, 3.0));
Warn(oNPC, oTerrorist);
}
oNPC = GetNextObjectInArea();
}
}