Fixing Brahmin (1.02d) : plus extras

Muttie

Still Mildly Glowing
Modder
This is for ZcBrahmn, but may also be applied (in part) to EcBrahmn, EcCrtBra and so on...
ACBrahmn.int ; Brahmin for pen in Arroyo # local_vars=5
ZCBrahmn.int ; Generic Brahmin # local_vars=0
mcBrahmn.int ; Modoc brahmin # local_vars=2
Kcbrahmn.int ; Script for Klamath brahmin on graze map # local_vars=5
ncAngBra.int ; New Reno Angry Brahmin # local_vars=1
ECCrtBra.int ; Random Encounter Brahmin for carts # local_vars=4
ECBraHrd.int ; Random Encounter Brahmin Herd # local_vars=3 # DoesNotExist
ECLedBra.int ; Random Encounter Lead Brahmin # local_vars=3 # DNE
SCBrahmn.int ; NCR Map 4 Brahmin yeah. # local_vars=0
BCBrahmn.int ; Brahmn in Vault 15 Entrance # local_vars=0
mcKilBra.int ; Modoc Slaughterhouse brahmin # local_vars=5
mcBess.int ; Modoc Bess the Brahmin # local_vars=8
ECBrahmn.int ; Random Encounter Brahmin # local_vars=0
ECBesCow.int ; One of the Brahmin in Bess's herd # local_vars=0
ECCowBmb.int ; The cows that blow... # local_vars=0
ECGCwBmb.int ; Generic Cow bomb the bridge dude uses # local_vars=0

-OPTIONAL : Talk proc: may utilize the existing talk lines (103 & 104) in the msg.
Example,
Code:
procedure talk_p_proc begin
   if (random(1,10) == 10) then begin
      display_msg(mstr(104));
   end
   else begin
      display_msg(mstr(103));
   end
end
So it would normally use 103 with a small (10%) easter egg chance to trigger 104.

-Map enter: if running off map, the Stand Up timer gets wiped and not set again, brahmin never recovers... needs to set one in map_enter.
Code:
      if (critter_state(self_obj) == DAM_KNOCKED_DOWN) then begin
         add_timer_event(self_obj, game_ticks(Random(10, 30)), TIMER_STAND_UP); //added, in case a map exit wipes the timer
      end

-Timed event: the poo "move_to"needs "self_elevation" else it may appear on the wrong level (RP fix)

-Timed event: needs a check if the brahmin is down before making it stand up:
Code:
if (critter_state(self_obj) == DAM_KNOCKED_DOWN) then begin //added, this makes sure the animation only plays when the brahmin needs to get up
[cases are: push it (tip over), then push again to make it stand up. Or, push it (tip over), then start combat to make it stand up. In both cases the Stand Up Timer is set and would trigger a stand up animation on a standing brahmin (which would result in a small glitch).]

-Timed event: the recovery looks odd (like frozen), seems animate_reverse is the wrong call and it's better to just animate with 36 or 37. Tested and 37 (back_to_standing) looks better (36 is more getting up from a kneeing position).
Code:
reg_anim_animate(self_obj, ANIM_back_to_standing, -1); //this is more fluid (back into idle animation), the original (reverse) froze the brahmin

-OPTIONAL : Push proc: Disallow push when knocked down
Code:
procedure push_p_proc begin
   //if ((critter_state(self_obj) bwand DAM_KNOCKED_DOWN) == FALSE) then begin  //add, if you don't want "push" to force the brahmin back on its feet, mind that this may contradict the need for "push"
      if (obj_in_party(source_obj)) then begin
         if (stat_success(source_obj, STAT_st, -3)) then begin  //changed from (0) to (-3), gives it (a bit) more variation
            if ((critter_state(self_obj) bwand DAM_KNOCKED_DOWN) == FALSE) then begin  //comment out if the above is commented in, or don't - doesn't really matter
               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);
               add_timer_event(self_obj, game_ticks(Random(10, 30)), TIMER_STAND_UP);
               debug_msg("ZCBRAHMN: ahh Cow TIPPED you get +10 Hick Experience Points.");
            end
         end
         /* else : standard push */
         floater(random(201, 205)); //added, bc why not... companions make sounds when pushed...
      end
   //end
   //else begin
      //script_overrides; //adding this blocks the "push" (see above) and has the brahmin moo in protest ; player has to wait till brahmin gets up
      //floater(random(201, 205));
   //end
end
[note: I changed the ST modifier to -3, creates a bit more variation.]
Disabling push is maybe not the best idea (it's more realistic, but not a good mechanic). Still, adding floats can be a nice touch.

-Use obj on: expand the alcoholic beverages to cover all Fo2 ones.
Code:
   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

-Use obj on: the use obj on option needs to set a Stand Up timer (see push proc), else it never recovers. May be higher, like 100, 300 : or set only one in map_enter(so no recovery until the next map enter)
Code:
reg_anim_animate(self_obj, ANIM_back_to_standing, -1); //this is more fluid (back into idle animation), the original (reverse) froze the brahmin

That's it. Not that difficult of a script. Still... bugs here and there. And brahmin is a somewhat iconic script with all its several features (cow tipping, get it drunk on booze, crapping all over the place) and so on.


Car Fixes
-Found a blocker bug. When entering the default random encounter map (desert1), it creates the blockers correctly. But when I leave with car (or via exit grid) and then enter the same map again (i.e. same spot on worldmap), there are(two, I think) blocker missing and I can walk inside the car. This does not seem to trigger on the regular maps (Den etc.). [This happens in RP Mod 2.3.3 (sfall 3.3.1) and 1.02d (sfall 4.4.3).] FIX:Move the two blockers created in "Create_Trunk"to "Create_Car".That fixes it.

-Found another blocker bug: When I get the car, enter west den, then east den, then west den, then east den(all via car but doing it by foot may work too) and then leave w/ the car to Klamath (to leave it there) and return to the den map the car was last at (in the example east den), then there are two hex blockers that shouldn't be there [may be hard to find, but on east den you can walk along the pavement where the car was, it's on that line). These are probably created by the (invisible) trunk. [Same should be possible in NR, btw.] FIX: Same as above; move the two blockers created in "Create_Trunk"to "Create_Car".

-Found another blocker bug: When alternating (i.e. going alternately by car and foot) between the two maps (Den West & East, for example, but is also possible in NR)it eventually fails to destroy the "car" blockers. For example: enter Den East (w/ car) then Den West (by foot), back to East (btw, it doesn't matter if via worldmap or green exit grid),then Den West by car and the blockers of the car (in this case on East Den) aren't destroyed. [This happens in RP Mod 2.3.3 (sfall 3.3.1) and 1.02d (sfall 4.4.3).] FIX: It needs a correct self_destroy (in the map enter of "ZSDRVCAR").
Like:
Code:
procedure map_enter_p_proc begin
   if (global_var(GVAR_CAR_PLACED_TILE) != self_tile) then begin
      //destroy_object(self_obj);  //replaced by the (more complete) following : WARNING : this must be identical to the "Dest_Car" macro! just in a different order and with some tweaks
      Scenery_Creation_Ptr := tile_contains_pid_obj(self_tile,self_elevation,PID_DRIVABLE_CAR);
      if (Scenery_Creation_Ptr != 0) then begin
         Scenery_Creation_Hex:=self_tile;
         Dest_Block_Cycle(1,2,self_elevation)
         Dest_Block_Cycle(2,2,self_elevation)
         Dest_Block_Cycle(3,2,self_elevation)
         Dest_Block_Cycle(4,2,self_elevation)
         Dest_Block_Cycle(5,1,self_elevation)
         Dest_Block_Cycle(4,1,self_elevation)
         Dest_Block_Cycle(5,1,self_elevation)
         Dest_Block_Cycle(4,1,self_elevation)
         Dest_Block_Cycle(5,3,self_elevation)
         Dest_Block_Cycle(0,2,self_elevation)
         Dest_Block_Cycle(1,1,self_elevation)
         Dest_Block_Cycle(2,1,self_elevation)
         Dest_Block_Cycle(1,1,self_elevation)
         Dest_Block_Cycle(2,1,self_elevation)
         destroy_object(self_obj);
      end
   end
end
 
Car Fixes
-Found another blocker bug: When alternating (i.e. going alternately by car and foot) between the two maps (Den West & East, for example, but is also possible in NR)it eventually fails to destroy the "car" blockers. For example: enter Den East (w/ car) then Den West (by foot), back to East (btw, it doesn't matter if via worldmap or green exit grid),then Den West by car and the blockers of the car (in this case on East Den) aren't destroyed. [This happens in RP Mod 2.3.3 (sfall 3.3.1) and 1.02d (sfall 4.4.3).] FIX: It needs a correct self_destroy (in the map enter of "ZSDRVCAR").
Like:
Code:
procedure map_enter_p_proc begin
   if (global_var(GVAR_CAR_PLACED_TILE) != self_tile) then begin
      //destroy_object(self_obj);  //replaced by the (more complete) following : WARNING : this must be identical to the "Dest_Car" macro! just in a different order and with some tweaks
      Scenery_Creation_Ptr := tile_contains_pid_obj(self_tile,self_elevation,PID_DRIVABLE_CAR);
      if (Scenery_Creation_Ptr != 0) then begin
         Scenery_Creation_Hex:=self_tile;
         Dest_Block_Cycle(1,2,self_elevation)
         Dest_Block_Cycle(2,2,self_elevation)
         Dest_Block_Cycle(3,2,self_elevation)
         Dest_Block_Cycle(4,2,self_elevation)
         Dest_Block_Cycle(5,1,self_elevation)
         Dest_Block_Cycle(4,1,self_elevation)
         Dest_Block_Cycle(5,1,self_elevation)
         Dest_Block_Cycle(4,1,self_elevation)
         Dest_Block_Cycle(5,3,self_elevation)
         Dest_Block_Cycle(0,2,self_elevation)
         Dest_Block_Cycle(1,1,self_elevation)
         Dest_Block_Cycle(2,1,self_elevation)
         Dest_Block_Cycle(1,1,self_elevation)
         Dest_Block_Cycle(2,1,self_elevation)
         destroy_object(self_obj);
      end
   end
end
It occurred to me that this may have been misleading. The "Dest_Block_Cycle" above is my version, as I felt the original created a superfluous blocker, so I changed it. I did add the warning that the sequence must be identical to the macro in your header, but maybe that could have been clearer.
[Note: The"tweaks" only referred to adjusting "self_tile, self_elevation & self_object", while the change in order referred to destroying the car last (instead first), else it doesn't clean the blockers.]
Sorry, if this caused any inconvenience.

Alternatively, you may use the above to fix your hex blocker sequence in "Dest_Car" and "Create_Car", too, (to the above). But either way, I should have mentioned that I fixed it, wasn't thinking. Sorry.

Here are pics:

Car_Blockers1.jpg

The left is the original (1.02d) the right is my version

And again
Car_Blockers2.jpg


Anyway, you can use either, but whichever you use the block cycle in the car script and header macro must be identical.
 
Back
Top