case "Send Officer to scout":
//Levis add smuggling questbook
Preprocessor_AddQuestData("location",locations[FindLocation(Pchar.quest.contraband.CurrentPlace)].name);
questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
AddQuestRecord(questbookname, 11);
Preprocessor_Remove("location");
Pchar.quest.Contraband.scout.done = true;
//In 1 day he has to return
NPChar = characterFromID(PChar.quest.Contraband.officerID);
RemovePassenger(PChar, NPChar);
NPChar.StoredFellow = True;
if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" as officer");
LAi_SetActorType(NPChar);
LAi_ActorRunToLocator(NPChar,"reload","reload1","Send Officer Gone",40);
break;
case "Send Officer Gone":
NPChar = characterFromID(PChar.quest.Contraband.officerID);
LAi_SetOfficerType(NPChar);
ChangeCharacterAddressGroup(NPChar,"","",""); //We don't have to see him anymore
if(DEBUG_SMUGGLING>2)trace("SMUGGLING removed "+NPChar.id+" from location");
PChar.quest.Contraband_Scouting.win_condition.l1 = "Timer";
PChar.quest.Contraband_Scouting.win_condition.l1.date.day = GetAddingDataDay(0, 0, 1);
PChar.quest.Contraband_Scouting.win_condition.l1.date.month = GetAddingDataMonth(0, 0, 1);
PChar.quest.Contraband_Scouting.win_condition.l1.date.year = GetAddingDataYear(0, 0, 1);
PChar.quest.Contraband_Scouting.win_condition = "Send Officer time expired";
if(DEBUG_SMUGGLING>0)trace("SMUGGLING timer set 1 day later ");
break;
case "Send Officer time expired":
if(DEBUG_SMUGGLING>0)trace("SMUGGLING time expired you should go to: "+Pchar.quest.Contraband.tavern);
PChar.quest.Contraband_Scouting2.win_condition.l1 = "location";
PChar.quest.Contraband_Scouting2.win_condition.l1.location = Pchar.quest.Contraband.tavern;
ref smugisland = GetIslandByIndex(sti(Pchar.quest.Contraband.islandindex));
//First determine if the officer get caught.
int caughtchance = getSmugglingState(smugisland)*20 + (GetDifficulty()*5);
if(DEBUG_SMUGGLING>2)trace("SMUGGLING caughtchance for officer is: "+caughtchance);
if(rand(99) < caughtchance)
{
//Officer caught
PChar.quest.Contraband_Scouting2.win_condition = "Send Officer doesnt return";
if(DEBUG_SMUGGLING>2)trace("SMUGGLING officer is caught");
}
else
{
//Based on your luck
if(rand(9)<CalcCharacterSkill(PChar,SKILL_SNEAK))
{
//Success
PChar.quest.Contraband_Scouting2.win_condition = "Send Officer has time";
if(DEBUG_SMUGGLING>2)trace("SMUGGLING officer success");
}
else
{
//Failed
PChar.quest.Contraband_Scouting2.win_condition = "Send Officer failed";
if(DEBUG_SMUGGLING>2)trace("SMUGGLING officer failed");
}
}
break;
case "Send Officer doesnt return":
if(DEBUG_SMUGGLING>0) trace("SMUGGLING officer was caught so lets reset stuff");
questbookname = "smuggle&number="+Pchar.amount_smuggleruns; //Set a questname
AddQuestRecord(questbookname, 14);
ChangeCharacterReputation(pchar, -5);
NPChar = characterFromID(PChar.quest.Contraband.officerID);
DeleteAttribute(NPChar,"StoredFellow");
DeleteAttribute(Pchar,"quest.Contraband.scout.done");
LAi_KillCharacter(NPChar);
break;
case "Send Officer failed":
if(DEBUG_SMUGGLING>0) trace("SMUGGLING officer appears in tavern");
NPChar = characterFromID(PChar.quest.Contraband.officerID);
ChangeCharacterAddressGroup(NPChar, Pchar.quest.Contraband.tavern, "reload", "reload1");
LAi_SetActorType(NPChar);
NPChar.dialog.currentnode = "Patrolschedule_failed";
LAi_ActorDialog(NPChar,Pchar,"Send Officer back in slot",10.0,1.0);
DeleteAttribute(Pchar,"quest.Contraband.scout.done");
break;
case "Send Officer has time":
if(DEBUG_SMUGGLING>0) trace("SMUGGLING officer "+PChar.quest.Contraband.officerID+" appears in tavern");
NPChar = characterFromID(PChar.quest.Contraband.officerID);
ChangeCharacterAddressGroup(NPChar, Pchar.quest.Contraband.tavern, "reload", "reload1");
LAi_SetActorType(NPChar);
NPChar.dialog.currentnode = "Patrolschedule_got";
LAi_ActorDialog(NPChar,Pchar,"Send Officer back in slot",10.0,1.0);
break;
case "Send Officer back in slot":
if(DEBUG_SMUGGLING>0) trace("SMUGGLING officer becomes passenger again");
NPChar = characterFromID(PChar.quest.Contraband.officerID);
DeleteAttribute(NPChar,"StoredFellow");
AddPassenger(PChar, NPChar, 0);
LAi_SetOfficerType(NPChar);
SetOfficersIndex(Pchar, -1, NPChar);
break;