//On map entry
var npc = [];
for (i = 1; i < 999; i++) {
if ($dataMap.events[i] == null) {
break;
}
else if ($dataMap.events[i].name.includes("NPC") && !this.getSelfSwitchValue(this._mapId, i, 18)) {
npc.push(i);
}
}
$gameVariables.setValue(65, npc)
$gameVariables.setValue(64, npc.length)
//Parallel common event
var npc = $gameVariables.value(65);
var nearby = [];
for (i = 0; i < npc.length; i++) {
if (Galv.DETECT.event(npc[i],$gameVariables.value(11),true) && $dataMap.events[npc[i]].name.includes("Policeman") && !this.getSelfSwitchValue(this._mapId, npc[i], 18)) {
nearby.push(npc[i]);
}
}
if (nearby.length > 0) {$gameVariables.setValue(83, nearby)}
for (i = 0; i < npc.length; i++) {
if (Galv.DETECT.event(npc[i],$gameVariables.value(11),true) && $dataMap.events[npc[i]].name.includes("FBI") && !this.getSelfSwitchValue(this._mapId, npc[i], 18)) {
nearby.push(npc[i]);
}
}
if (nearby.length > 0) {$gameVariables.setValue(84, nearby)}
var victimfamilies = $gameVariables.value(85);
for (i = 0; i < npc.length; i++) {
for (j = 0; j < victimfamilies.length; j++) {
if (Galv.DETECT.event(npc[i], $gameVariables.value(11), true) && $dataMap.events[npc[i]].name.includes(victimfamilies[j]) && this.getSelfSwitchValue(this._mapId, npc[i], 18) == false) {
nearby.push(npc[i]);
}
}}
if (nearby.length > 0) {$gameVariables.setValue(86, nearby)}
this.countevent("NPC", 64, 65, "!this.getSelfSwitchValue(this._mapId, id, 18)");
this.counteventarray("Policeman", 0, 83, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");
this.counteventarray("FBI", 0, 84, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");
var victimfamilies = $gameVariables.value(85);
this.counteventarray(victimfamilies, 0, 86, 65, "Galv.DETECT.event(sourcearray[id],$gameVariables.value(11),true) && !this.getSelfSwitchValue(this._mapId, sourcearray[id], 18)");