Skip to content

Commit

Permalink
More Brahmin fixes/tweaks
Browse files Browse the repository at this point in the history
- Fixed: fallen Brahmin didn't recover on re-entering maps.
- Fixed: using alcohol on Brahmin would cripple player's legs (FIXT bug).
- Tweaks: more appropriate animation for Brahmin standing up.

Synced the script code between brahmin.ssl and cow.ssl.
  • Loading branch information
NovaRain committed Sep 4, 2024
1 parent 972d3b9 commit 93544aa
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 162 deletions.
84 changes: 42 additions & 42 deletions Fallout2/Fallout1in2/Mapper/source/scripts/GENERIC/BRAHMIN.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,25 @@

/* Standard Script Procedures */
procedure start;
procedure map_enter_p_proc;
procedure push_p_proc;
procedure critter_p_proc;
procedure description_p_proc;
procedure timed_event_p_proc;
procedure use_obj_on_p_proc;
procedure use_skill_on_p_proc;
procedure damage_p_proc;
procedure destroy_p_proc;
procedure critter_p_proc;
procedure push_p_proc;

variable critter_tile;
variable initial := 0;
variable temp_hostile := 0;
variable tmp_hostile := 0;

#define EVENT_WALK (1)
#define EVENT_FLOAT (2)
#define EVENT_POOP (3)
#define EVENT_STAND_UP (4)

#define EVENT_STAND_UP 4

#define float(x) float_msg(self_obj, mstr(x), FLOAT_COLOR_NORMAL)
#define float(x) float_msg(self_obj, mstr(x), FLOAT_COLOR_NORMAL)

procedure start begin
if not(initial) then begin
Expand All @@ -48,9 +47,15 @@ procedure map_enter_p_proc begin
invasion_kill_critter;
end

flush_add_timer_event_sec(self_obj, random(15, 90), EVENT_WALK);
flush_add_timer_event_sec(self_obj, random(5, 15), EVENT_FLOAT);
flush_add_timer_event_sec(self_obj, random(0, 300), EVENT_POOP);
if not(is_loading_game) then begin
if (critter_state(self_obj) bwand DAM_KNOCKED_DOWN) then begin
self_stand;
move_to(self_obj, self_tile, self_elevation); // avoid visual offset shifting
end
flush_add_timer_event_sec(self_obj, random(15, 90), EVENT_WALK);
flush_add_timer_event_sec(self_obj, random(5, 15), EVENT_FLOAT);
flush_add_timer_event_sec(self_obj, random(0, 300), EVENT_POOP);
end
end

procedure push_p_proc begin
Expand All @@ -64,16 +69,16 @@ procedure push_p_proc begin
reg_anim_animate(self_obj, ANIM_fall_back_sf, -1);
reg_anim_end();
critter_injure(self_obj, DAM_KNOCKED_DOWN);
add_timer_event(self_obj, game_ticks(Random(10, 30)), EVENT_STAND_UP);
add_timer_event(self_obj, game_ticks(random(10, 30)), EVENT_STAND_UP);
debug_msg("ZCBRAHMN : ahh Cow TIPPED you get + 10 Hick Experience Points.");
end
end
end
end

procedure critter_p_proc begin
if (temp_hostile) then begin
temp_hostile := 0;
if (tmp_hostile) then begin
tmp_hostile := 0;
attack(dude_obj);
end
end
Expand All @@ -83,7 +88,7 @@ procedure description_p_proc begin
end

procedure timed_event_p_proc begin
variable temp_poo;
variable temp_poo;

if (fixed_param == EVENT_WALK) then begin
if ((critter_state(self_obj) bwand DAM_KNOCKED_DOWN) == FALSE) then begin
Expand All @@ -105,38 +110,33 @@ variable temp_poo;
flush_add_timer_event_sec(self_obj, random(120, 300), EVENT_POOP);
end
else if (fixed_param == EVENT_STAND_UP) then begin
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate_reverse(self_obj, ANIM_fall_back, -1);
reg_anim_end();
critter_uninjure(self_obj, DAM_KNOCKED_DOWN);
if (critter_state(self_obj) bwand DAM_KNOCKED_DOWN) then begin
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_back_to_standing, -1);
reg_anim_end();
critter_uninjure(self_obj, DAM_KNOCKED_DOWN);
end
end
end

procedure use_obj_on_p_proc begin
variable Item := 0;
if ((obj_pid(obj_being_used_with) == PID_BEER)
or (obj_pid(obj_being_used_with) == PID_BOOZE)
or (obj_pid(obj_being_used_with) == PID_ROT_GUT)
or (obj_pid(obj_being_used_with) == PID_GAMMA_GULP_BEER)
or (obj_pid(obj_being_used_with) == PID_ROENTGEN_RUM)) then begin

variable item := 0;
if (is_alcohol(obj_being_used_with)) then begin
script_overrides;
Item := obj_being_used_with;
item := obj_being_used_with;
rm_obj_from_inven(source_obj, obj_being_used_with);
destroy_object(Item);
play_sfx("MABROMAQ");

reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_hit_from_front, -1);
reg_anim_animate(self_obj, ANIM_fall_back, 5);
reg_anim_animate(self_obj, ANIM_fall_back_sf, -1);
reg_anim_end();

critter_injure(self_obj, DAM_KNOCKED_DOWN);
critter_injure(dude_obj, DAM_CRIP_LEG_LEFT);
critter_injure(dude_obj, DAM_CRIP_LEG_RIGHT);
destroy_object(item);
//play_sfx("MABROMAQ");
if ((critter_state(self_obj) bwand DAM_KNOCKED_DOWN) == FALSE) then begin
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_hit_from_front, -1);
reg_anim_animate(self_obj, ANIM_fall_back, 5);
reg_anim_animate(self_obj, ANIM_fall_back_sf, -1);
reg_anim_end();
critter_injure(self_obj, DAM_KNOCKED_DOWN);
end
end
end

Expand All @@ -148,7 +148,7 @@ procedure use_skill_on_p_proc begin
end

procedure damage_p_proc begin
if obj_in_party(source_obj) then begin
if source_is_dude then begin
if CUR_AREA_HUB or CUR_MAP_HUBMIS0 then
set_global_var(GVAR_ENEMY_HUB, 1);
else if CUR_AREA_JUNKTOWN then
Expand All @@ -158,7 +158,7 @@ procedure damage_p_proc begin

party_remove(self_obj);
set_self_team(TEAM_BRAHMIN);
temp_hostile := 1;
tmp_hostile := 1;
end
end

Expand Down
156 changes: 75 additions & 81 deletions Fallout2/Fallout1in2/Mapper/source/scripts/GENERIC/COW.ssl
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,48 @@

*/

/* Include Files */
#include "define.h"

#define NAME SCRIPT_COW

#include "command.h"

/* Standard Script Procedures */
procedure start;
procedure map_enter_p_proc;
procedure push_p_proc;
procedure critter_p_proc;
procedure description_p_proc;
procedure timed_event_p_proc;
procedure talk_p_proc;
procedure use_obj_on_p_proc;
procedure use_skill_on_p_proc;
procedure description_p_proc;
procedure destroy_p_proc;
procedure damage_p_proc;
procedure critter_p_proc;
procedure destroy_p_proc;

variable initial := 0;
variable moo_counter;
variable critter_tile;
variable tmp_hostile := 0;
variable hit_counter := 0;
variable moo_counter;

#define TIMER_STAND_UP 4
#define EVENT_STAND_UP (4)

procedure start begin
if not(initial) then begin
initial := 1;

set_self_ai(AI_COW);
set_self_team(TEAM_BRAHMIN);

flush_add_timer_event(self_obj, game_ticks(random(1, 5)), 1);
flush_add_timer_event_sec(self_obj, random(1, 5), 1);
end
end

procedure map_enter_p_proc begin
if not(is_loading_game) then begin
if (critter_state(self_obj) bwand DAM_KNOCKED_DOWN) then begin
self_stand;
move_to(self_obj, self_tile, self_elevation); // avoid visual offset shifting
end
end
end

Expand All @@ -51,7 +60,7 @@ procedure push_p_proc begin
reg_anim_animate(self_obj, ANIM_fall_back_sf, -1);
reg_anim_end();
critter_injure(self_obj, DAM_KNOCKED_DOWN);
add_timer_event(self_obj, game_ticks(Random(10, 30)), TIMER_STAND_UP);
add_timer_event(self_obj, game_ticks(random(10, 30)), EVENT_STAND_UP);
debug_msg("ZCBRAHMN : ahh Cow TIPPED you get + 10 Hick Experience Points.");
end
end
Expand All @@ -65,9 +74,43 @@ procedure critter_p_proc begin
end
end

procedure description_p_proc begin
script_overrides;
if (CUR_MAP_TALKCOW) then
display_msg(message_str(SCRIPT_BRAHMIN, 106));
else
display_msg(message_str(SCRIPT_BRAHMIN, 100));
end

procedure timed_event_p_proc begin
if (((is_critter_prone(self_obj)) == 0) and not(combat_is_initialized) and (anim_busy(self_obj) == 0)) then begin
self_walk_to_tile(tile_num_in_direction(self_tile, random(0, 5), 3));
end
else if (fixed_param == EVENT_STAND_UP) then begin
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_back_to_standing, -1);
reg_anim_end();
critter_uninjure(self_obj, DAM_KNOCKED_DOWN);
end
//flush_add_timer_event_sec(self_obj, random(6, 10), 1);

if (((is_critter_prone(self_obj)) == 0) and not(combat_is_initialized)) then begin
self_walk_to_tile(tile_num_in_direction(self_tile, random(0, 5), 3));
end

if (CUR_MAP_TALKCOW) then begin
if (random(0, 1)) then begin
call talk_p_proc;
end
end

flush_add_timer_event_sec(self_obj, random(3, 5), 1);
end

procedure talk_p_proc begin
if CUR_MAP_TALKCOW then begin
moo_counter := moo_counter + 1;
if (CUR_MAP_TALKCOW) then begin
moo_counter += 1;
if (moo_counter > 2) then begin
moo_counter := 0;
end
Expand All @@ -81,96 +124,47 @@ procedure talk_p_proc begin
end

procedure use_obj_on_p_proc begin
variable Item := 0;
if ((obj_pid(obj_being_used_with) == PID_BEER)
or (obj_pid(obj_being_used_with) == PID_BOOZE)
or (obj_pid(obj_being_used_with) == PID_ROT_GUT)
or (obj_pid(obj_being_used_with) == PID_GAMMA_GULP_BEER)
or (obj_pid(obj_being_used_with) == PID_ROENTGEN_RUM)) then begin

variable item := 0;
if (is_alcohol(obj_being_used_with)) then begin
script_overrides;
Item := obj_being_used_with;
item := obj_being_used_with;
rm_obj_from_inven(source_obj, obj_being_used_with);
destroy_object(Item);
play_sfx("MABROMAQ");

reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_hit_from_front, -1);
reg_anim_animate(self_obj, ANIM_fall_back, 5);
reg_anim_animate(self_obj, ANIM_fall_back_sf, -1);
reg_anim_end();

critter_injure(self_obj, DAM_KNOCKED_DOWN);
critter_injure(dude_obj, DAM_CRIP_LEG_LEFT);
critter_injure(dude_obj, DAM_CRIP_LEG_RIGHT);
destroy_object(item);
//play_sfx("MABROMAQ");
if ((critter_state(self_obj) bwand DAM_KNOCKED_DOWN) == FALSE) then begin
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj, ANIM_hit_from_front, -1);
reg_anim_animate(self_obj, ANIM_fall_back, 5);
reg_anim_animate(self_obj, ANIM_fall_back_sf, -1);
reg_anim_end();
critter_injure(self_obj, DAM_KNOCKED_DOWN);
end
end
end

procedure use_skill_on_p_proc begin
if (action_being_used == SKILL_SCIENCE) then begin
script_overrides;
if (CUR_MAP_TALKCOW) then begin
if (dude_skill_success(action_being_used, 0)) then begin
display_msg(message_str(SCRIPT_BRAHMIN, 108));
end
else begin
display_msg(message_str(SCRIPT_BRAHMIN, 107));
end
display_msg(message_str(SCRIPT_BRAHMIN, 107 + dude_skill_success(action_being_used, 0)));
end
else begin
display_msg(message_str(SCRIPT_BRAHMIN, 101));
end
end
end

procedure timed_event_p_proc begin
if (((is_critter_prone(self_obj)) == 0) and not(combat_is_initialized) and (anim_busy(self_obj) == 0)) then begin
self_walk_to_tile(tile_num_in_direction(self_tile, random(0, 5), 3));
end
else if (fixed_param == TIMER_STAND_UP) then begin
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate_reverse(self_obj, ANIM_fall_back, -1);
reg_anim_end();
critter_uninjure(self_obj, DAM_KNOCKED_DOWN);
end
//add_timer_event(self_obj, game_ticks(random(6, 10)), 1);

if (((is_critter_prone(self_obj)) == 0) and not(combat_is_initialized)) then begin
self_walk_to_tile(tile_num_in_direction(self_tile, random(0, 5), 3));
end

if (CUR_MAP_TALKCOW) then begin
if (random(0, 1)) then begin
call talk_p_proc;
end
end

add_timer_event(self_obj, game_ticks(random(3, 5)), 1);
end

procedure description_p_proc begin
script_overrides;
if (CUR_MAP_TALKCOW) then
display_msg(message_str(SCRIPT_BRAHMIN, 106));
else
display_msg(message_str(SCRIPT_BRAHMIN, 100));
procedure damage_p_proc begin
end

procedure destroy_p_proc begin
if obj_in_party(source_obj) then begin
if CUR_AREA_HUB then begin
if source_is_dude then begin
if CUR_AREA_HUB or CUR_MAP_HUBMIS0 then
set_global_var(GVAR_ENEMY_HUB, 1);
end
else if CUR_AREA_JUNKTOWN then begin
else if CUR_AREA_JUNKTOWN then
set_global_var(GVAR_ENEMY_JUNKTOWN, 1);
end
else if CUR_AREA_SHADY_SANDS then begin
else if CUR_AREA_SHADY_SANDS then
set_global_var(GVAR_ENEMY_SHADY_SANDS, 1);
end
end
end

procedure damage_p_proc begin
end
Loading

0 comments on commit 93544aa

Please sign in to comment.