procedure map_enter_p_proc begin
if (map_first_run) then begin
set_global_var(GVAR_MARK_HUB_ENTRANCE, 1);
display_msg(g_mstr(1700));
end
if (not(is_loading_game)) then begin
// check if both Keri and Demeter are dead
// if true their caravans no longer run
if (global_var(GVAR_CRIMSON_CARAVANS_STATUS) == 4) then begin
if (map_var(MVAR_CC_CARAVAN_STATUS) != 1) then begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 1);
call CCCarts;
end
end
else begin
call CCInit;
end
end
override_map_start(107, 39, 0, 2);
end
procedure CCInit begin
if (map_var(MVAR_CC_CARAVAN_STATUS) == 2) then begin
if (get_day == 3) or (get_day == 17) then begin
if (map_var(MVAR_CC_CARTS_STATUS) == 0) then begin
call CCCarts;
set_map_var(MVAR_CC_CARTS_STATUS, 1);
end
end
else begin
if (get_day > 3) and (get_day < 9) or (get_day > 17) and (get_day < 23) then begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 1);
end
else begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 0);
set_map_var(MVAR_CC_CARTS_STATUS, 0);
set_map_var(MVAR_CC_CARAVANERS_STATUS, 0);
end
end
end
if (map_var(MVAR_CC_CARAVAN_STATUS) != 2) then begin
call CCCaravan;
end
end
procedure CCCaravan begin
// READY TO LEAVE
if (get_day == 3) or (get_day == 17) then begin
if (map_var(MVAR_CC_CARAVAN_STATUS) == 1) then begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 0);
call CCCarts;
end
if (map_var(MVAR_CC_CARAVANERS_STATUS) == 0) then begin
Critter := create_object_sid(PID_GUARD_HMMETL, 0, 0, SCRIPT_CCLEADER);
critter_attempt_placement(Critter, 9307, 0);
anim(Critter, 1000, 5);
Critter := create_object_sid(PID_LARGE_BRAHMIN, 0, 0, SCRIPT_CBRAHMIN);
critter_attempt_placement(Critter, 10711, 0);
CritterTile := 10711;
call CCDrivers;
Critter := create_object_sid(PID_LARGE_BRAHMIN, 0, 0, SCRIPT_CBRAHMIN);
critter_attempt_placement(Critter, 12114, 0);
CritterTile := 12114;
call CCDrivers;
set_map_var(MVAR_CC_CARAVANERS_STATUS, 1);
end
end
else begin
// ON ROUTE
if (get_day > 3) and (get_day < 9) or (get_day > 17) and (get_day < 23) then begin
if (map_var(MVAR_CC_CARAVAN_STATUS) == 0) then begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 1);
set_map_var(MVAR_CC_CARAVANERS_STATUS, 0);
call CCCarts;
end
end
else begin
// JUST ARRIVED
if (get_day == 9) or (get_day == 24) then begin
if (map_var(MVAR_CC_CARAVAN_STATUS) == 1) then begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 0);
call CCCarts;
end
if (map_var(MVAR_CC_CARAVANERS_STATUS) == 0) then begin
set_map_var(MVAR_CC_CARAVANERS_STATUS, 2);
end
end
else begin
// IN DOWNTOWN
if (map_var(MVAR_CC_CARAVAN_STATUS) == 1) then begin
set_map_var(MVAR_CC_CARAVAN_STATUS, 0);
call CCCarts;
end
end
end
end
end
procedure CCCarts begin
if (map_var(MVAR_CC_CARAVAN_STATUS) == 0) then begin
create_scenery(PID_WAGON_2, 10514, 0);
create_scenery(PID_WAGON_1, 12317, 0);
end
else begin
remove_scenery(PID_WAGON_2, 10514, 0);
remove_scenery(PID_WAGON_1, 12317, 0);
end
end
procedure CCDrivers begin
variable CurrentTile;
CurrentTile := CritterTile;
CritterDirection := 0;
CritterNum := 3;
CritterScript := SCRIPT_CCDRIVER;
while (CritterNum) do begin
CritterType := 0;
WeaponType := 0;
RndX := random(1, 6);
if (RndX == 1) and (not(Critter1)) then begin
CritterType := PID_GUARD_NFMAXX;
Critter1 := 1;
RndY := random(0, 1);
if (RndY == 0) then begin
WeaponType := PID_SPEAR;
end
if (RndY == 1) then begin
WeaponType := PID_10MM_SMG;
end
end
if (RndX == 2) and (not(Critter2)) then begin
CritterType := PID_MERCENARY_NMLTHR;
Critter2 := 1;
RndY := random(0, 1);
if (RndY == 0) then begin
WeaponType := PID_SPEAR;
end
if (RndY == 1) then begin
WeaponType := PID_SHOTGUN;
end
end
if (RndX == 3) and (not(Critter3)) then begin
CritterType := PID_GUARD_NMMAXX;
Critter3 := 1;
RndY := random(0, 1);
if (RndY == 0) then begin
WeaponType := PID_10MM_PISTOL;
end
if (RndY == 1) then begin
WeaponType := PID_10MM_SMG;
end
end
if (RndX == 4) and (not(Critter4)) then begin
CritterType := PID_GUARD_HMBMET;
Critter4 := 1;
RndY := random(0, 1);
if (RndY == 0) then begin
WeaponType := PID_10MM_PISTOL;
end
if (RndY == 1) then begin
WeaponType := PID_SLEDGEHAMMER;
end
end
if (RndX == 5) and (not(Critter5)) then begin
CritterType := PID_GUARD_NFMETL;
Critter5 := 1;
RndY := random(0, 1);
if (RndY == 0) then begin
WeaponType := PID_SPEAR;
end
if (RndY == 1) then begin
WeaponType := PID_COMBAT_KNIFE;
end
end
if (RndX == 6) and (not(Critter6)) then begin
CritterType := PID_GUARD_HFLTHR;
Critter6 := 1;
RndY := random(0, 1);
if (RndY == 0) then begin
WeaponType := PID_SPEAR;
end
if (RndY == 1) then begin
WeaponType := PID_10MM_PISTOL;
end
end
if (CritterType) then begin
Critter := create_object_sid(CritterType, 0, 0, CritterScript);
Item := create_object(WeaponType, 0, 0);
add_obj_to_inven(Critter, Item);
wield_obj_critter(Critter, Item);
Item := create_object(PID_STIMPAK, 0, 0);
add_mult_objs_to_inven(Critter, Item, random(1, 3));
Item := item_caps_adjust(Critter, random(25, 50));
CritterTile := tile_num_in_direction(CurrentTile, CritterDirection, random(2, 3));
critter_attempt_placement(Critter, CritterTile, 0);
CritterDirection := CritterDirection + 2;
CritterNum := CritterNum -1;
end
end
end