Skip to content

Commit

Permalink
Encounters
Browse files Browse the repository at this point in the history
- Fixed: Merchant caravan cars in encounters could randomly overlap. Added a minimum spawn distance from each other.
  • Loading branch information
Lexx2k committed Jan 8, 2025
1 parent cd12963 commit 54b34a3
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions Fallout2/Fallout1in2/Mapper/source/scripts/encounter/RNDDESRT.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ procedure Raider2 begin
end

procedure Raider3 begin // Same as Raider1 in RNDMTN
variable LVar0 := 0;
variable Lvar0 := 0;
display_msg(message_str(SCRIPT_RNDDESRT, 173));
Inner_ring := (dude_enc_perception / 2) + 4;
Outer_ring := (dude_enc_perception / 2) + 6;
Expand All @@ -1262,8 +1262,8 @@ procedure Raider3 begin // Same as Raider1 in RNDMTN
random_seed_2 := 0;
random_seed_3 := 0;

LVar0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Red_Caravan(LVar0, 0)
Lvar0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Red_Caravan(Lvar0, 0)

if night then begin
Critter := create_object(PID_BURNING_BARREL, 0, 0);
Expand Down Expand Up @@ -1737,19 +1737,24 @@ procedure Junk4 begin
end

procedure Junk5 begin
variable LVar0 := 0;
variable spawn_tile0 := 0;
variable spawn_tile1 := 0;

display_msg(message_str(SCRIPT_RNDDESRT, 225));
Tot_Critter_A := random(1, 2);
Tot_Critter_B := random(2, 6);// was 2, 12
Outer_ring := (dude_enc_perception / 2) + 6;
Inner_ring := (dude_enc_perception / 2) + 2;
group_angle := random(0, 5);

LVar0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Red_Caravan(LVar0, 0)
spawn_tile0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Red_Caravan(spawn_tile0, 0)

LVar0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Grey_Caravan(LVar0, 0)
spawn_tile1 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
while(tile_distance(spawn_tile0, spawn_tile1) < 5) do begin // To prevent the caravan cars from clipping into each other
spawn_tile1 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
end
Create_EW_Grey_Caravan(spawn_tile1, 0)

Critter_type := PID_PEASANT_ROBE;
Critter_script := SCRIPT_GENMERCA;
Expand Down Expand Up @@ -2714,17 +2719,21 @@ procedure Steel4 begin
end

procedure Steel5 begin
variable LVar0 := 0;
variable spawn_tile0 := 0;
variable spawn_tile1 := 0;

display_msg(message_str(SCRIPT_RNDDESRT, 251));
Outer_ring := (dude_enc_perception / 2) + 6;
Inner_ring := (dude_enc_perception / 2) + 3;

LVar0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Red_Caravan(LVar0, 0)
spawn_tile0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Red_Caravan(spawn_tile0, 0)

LVar0 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
Create_EW_Grey_Caravan(LVar0, 0)
spawn_tile1 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
while(tile_distance(spawn_tile0, spawn_tile1) < 5) do begin // To prevent the caravan cars from clipping into each other
spawn_tile1 := tile_num_in_direction(Critter_spawn_hex + random(0, 8) - 4, random(0, 5), random(7, 12));
end
Create_EW_Grey_Caravan(spawn_tile1, 0)

if night then begin
Critter := create_object(PID_BURNING_BARREL, 0, 0);
Expand Down

0 comments on commit 54b34a3

Please sign in to comment.