force a random encounter

killap

Bear Dude
Moderator
Modder
I am attempting to add in some additional random encounters to the game and I was wondering if there is a way to have these encounters be forced upon the player (meaning no choice is given). Pretty much this would be like the foreshadowing encounter with Frank Horrigan, but I am unable to find information relating to that. (I was unable to find anything about the horrigan event in the encounter table)

Thanks!
 
I dont try it yet but obviously i known how do that. You must add somehow script to that encounter and best way to do that is add script to critter which start because critter see you.

In Worldmap.txt from Fallout2/data/data/

[Encounter: Playscene]
type_00=Ratio:100%, pid:16777326
position=Surrounding

Pid is proto of that critter. When you not sure about number of new add critter- see file critrpid.h from headers folder. Newly critter should got number 16777700

When create critter add him script, so he always will have that script. I made that way outdoorsmans. He must appear near you and put code to procedure critter_p_proc; (Every heartbeat that the critter gets, this procedure will be called. Anything from Movement to attacking the player on sight can be placed in here.)

Something like:

Code:
procedure critter_p_proc begin
if ((Current_Distance_From_Dude < 8) or (self_can_see_dude)) then begin

It will run automaticaly bacause you appear near critter- he see you so run next code. You can change where critter will appear changing line position like: straight_line, double_line, wedge, cone, huddle, surrounding


Now disable and enable interface using:
game_ui_disable Disables game user-interface input from the player (to ‘lock-out’ the player). You *MUST* make sure to re-enable the UI at some point afterwords.

game_ui_enable Re-enables game user-interface input from the player. This *MUST* be called relatively soon after disabling the UI or the player will be stuck, unable to do anything.

game_ui_is_disable Returns True if the game UI is currently disabled (the player is currently ‘locked-out’), and False otherwise.

And when disable starts- put here anims with time event codes, critter will play some scene. This part is most dificulty because you must program every part will be played: someone talk, move arms, shoot, walk, talk again, turn (and else) You can find this in Animcomd.h in headres folder from Fallout 2 mapper.

Do for example:

Code:
reg_anim_clear(self_obj);
reg_anim_begin();
reg_anim_animate(self_obj,ANIM_fall_back,5);
reg_anim_end();

Critter should fall back when see you. Also he can say something like "You are stink!" heh This encounter may appear when some Gvars is increased by some situations from game, for example when you have some new karma.

enc_00=Chance:15%,Enc:(1-1) Playscene, If(Global(650) > 0)
 
But Lich this will not force this encounter to happened.
There can be no encounter at all or another encounter from table can be rolled.

I think that it can be possible to force an encounter.
At start of worldmap.txt we have
Code:
; Encounter frequency percentages: 
Forced=100%        ; This shouldn't change 
Frequent=85%       ; Was 9/3d6 
Common=75%         ; Was 8/3d6 
Uncommon=65%       ; Was 6/3d6 
Rare=55%            ; Was 5/3d6 
None=0%            ; This shouldn't change
There is forced=100% option that can be used in tile tables at the end of worldmap.txt.


Code:
... 
2_0=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Arro_M 
2_1=Ocean,No_Fill,Uncommon,Uncommon,Uncommon,Arro_O 
2_2=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Arro_M 
2_3=Mountain,No_Fill,Rare,Rare,Rare,Arro_M 
2_4=Desert,No_Fill,Uncommon,Uncommon,Uncommon,Arro_D 
2_5=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Arro_M 
3_0=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Arro_M 
3_1=Mountain,No_Fill,Rare,Rare,Rare,Arro_M 
3_2=Mountain,No_Fill,Rare,Rare,Rare,Arro_M 
3_3=Mountain,No_Fill,Forced,Forced,Forced,Arro_M
A you see the last tile in this table is set to forced.
I belive this way we force player to make an encounter after entering that tile.
One thing is it was never used by developers i suspect that if used it can made a infinite loop of encounters but you may try :)
 
That just might work. What would I have to edit to the encounter I added to the tables?

I am still uncertain about how encounters fully work, (I am able to successfully add a new one to the table and actually encounter it) so examples would be appreciated.
 
There is an unused condition that can actually be used in worlmap.txt:
If(days_played < ...)

I'm not quite sure, but I think the engine recalculates probabilities which is set in the worldmap.txt. I've tried to force encounter by setting 100% probability, but sometimes it is not worked. I believe it happens because of engine recalculations. Don't forget, that luck also adds to roll then engine is calculating probability of the special encounters. It may be that engine does all the calculations and then fix all probabilities so overall summ of all probabilities in one encounter table equal 100%.

PS Sorry for my broken english ;).
 
I'm not quite sure, but I think the engine recalculates probabilities which is set in the worldmap.txt.
Yes i think that to.
Well i looked some more at the code and did a bit of testing and here is what i found:

There are two(2) rolls for encounters.

1)First roll is made every step on worldmap.
Game checks time between last encounter and current game time so we don't have one encounter just after another one.
Values from tile table are read
Code:
; Encounter frequency percentages:   
Forced=100%        ; This shouldn't change   
Frequent=85%       ; Was 9/3d6   
Common=75%         ; Was 8/3d6   
Uncommon=65%       ; Was 6/3d6   
Rare=55%            ; Was 5/3d6   
None=0%            ; This shouldn't change
In addition also game difficulty is taken in to this roll.
If chosen None for that tile there will be no encounters at all.
If chosen Forced we don't have 100% chance(but a very high one)
If this roll is positive then we go to second roll.

2)Second roll decides with encounter from encounter table will be chosen.
If we have:
Code:
[Encounter Table 9]   
lookup_name=Arrok_D                                              ; Arroyo Klamath Trade Route   
maps=Desert Encounter 1, Desert Encounter 2, Desert Encounter 3, Desert Encounter 8, Desert Encounter 10   
enc_00=Chance:100%,Enc:(2-4) KLA_Farmers   
enc_01=Chance:50%,Enc:(3-5) ARRO_Nomads
Here is the roll in semicode:

Code:
summary = 100 + 50 = 150   
result = random(0,150)   
if  result <= 100 then encounter 0 is chosen   
if result > 100  then ecounter 1 is chosen
So this roll is proportional, you can use values bigger than 100%.
This
Code:
enc_00=Chance:100%,Enc:(2-4) KLA_Farmers   
enc_01=Chance:1%,Enc:(3-5) ARRO_Nomads
is same as this:
Code:
enc_00=Chance:1000%,Enc:(2-4) KLA_Farmers   
enc_01=Chance:10%,Enc:(3-5) ARRO_Nomads
 
Back
Top