Random encounter scripting?

Discuss the creation and scripting of new fan-made games and mods for the Fallout series of games.
Post Reply
User avatar
monolith_88
SDF!
SDF!
Posts: 1
Joined: Thu Jun 19, 2003 11:20 pm

Random encounter scripting?

Post by monolith_88 »

I'm trying to create a new random encounter (Featuring the 2001 Monolith, of course!) for FO2. The map is done, and it has been placed on the world map using the tutorial on the Mutants Rising site, but I am unsure of what kind of scripting I have to do to make it "random".
SeanDMan
Vault Dweller
Vault Dweller
Posts: 119
Joined: Mon May 13, 2002 1:24 pm

Post by SeanDMan »

I don't think you add it to the worldmap... I think it's script will call it...

I have no idea how what to do though, so ask someone smarter than me :D
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

random encounters are set in the worldmap.txt file in encounter tables...

it's all very complicated..

the easiest way to get your "random encounter" into the game is to name it the same as one of the existing random encounter..

just realise that the regular random encounters have baddies to attack you..

since it sounde like a special random encounter, replace one of those.... one that has no people on it.. like the guardian of forever, or the bridge keeper or something..
User avatar
Corpse
Vault Scion
Vault Scion
Posts: 188
Joined: Thu Mar 20, 2003 2:48 pm
Location: Sydney, Australia

Post by Corpse »

You can actually add more encounter types instead of replacing any; to do this you have to edit both worldmap.txt and worldmap.msg.

First to add the encounter type, look through the "Newly added random encounter types" table, the entries should look like this:
[Encounter: NAV_Enclave_Patrol]
type_00=pid:16777466, Item:395(wielded), Item:721, Item:(0-50)41, Item:(1-5)545, Script:794, If(Rand(10%)) ; Enclave Patrol male w/ Vindicator Minigun and 4.7mm
type_01=ratio:20%, pid:16777466, Item:24(wielded), Item:(0-50)41, Item:(0-1)38, Script:794 ; Enclave Patrol male w/ Plasma Pistol and Small Energy Cell
type_02=pid:16777466, Item:582(wielded)), Item:722, Item:(0-50)41, Item:(0-1)545, Script:794, If(Rand(10%)) ; Enclave Patrol male w/ H&K G11E and 4.7mm
type_03=ratio:10%, pid:16777293, Item:270(wielded), Item:389, Script:1078 ; Enclave Sentry Bot MkII w/ RPG and Avenger Minigun
type_04=ratio:20%, pid:16777466, Item:28(wielded), Item:(0-50)41, Item:(0-1)39, Script:794, If(Rand(10%)) ; Enclave Patrol female w/ Gatling Laser and Large Energy Cell
type_05=ratio:20%, pid:16777467, Item:396(wielded), Item:(0-50)41, Item:(0-1)38, Script:794 ; Enclave Patrol male w/ YK32 Pulse Pistol and Small Energy Cell
type_06=ratio:10%, pid:16777467, Item:394(wielded), Item:(0-50)41, Item:(0-1)358, Script:794 ; Enclave Patrol female w/ PPK12 Gauss Pistol and 2mm EC
type_07=ratio:10%, pid:16777466, Item:955(wielded), Item:(0-50)41, Item:(0-1)362, Script:794 ; Enclave Patrol male w/ PPK12E Gauss Pistol and 4mm EC
;position=Surrounding
;position=straight_line, spacing:1
;position=straight_line, spacing:2
position=double_line, spacing:3
;position=wedge, spacing:2
;position=cone, spacing:2
;position=huddle, spacing:3

Pid: here you can specify critters, items (if its a container you can put stuff in it, if not don't), if its a critter, you can edit its inventory by adding the entry Item: followed by the PID for the item you want, if the item is their main weapon you can specify if its wielded, the last entries are Script: specify SID, and extra conditions like above there is a 10% random chance of this critter appearing.
after the critter entries you can specify the formation you want them to be placed in the encounter.
If you want to use a shortcut, just copy an existing encounter from the table that closely matches the type of encounter you want to create, copy it to the end of the randon encounter types list and give it a unique name and replace NPCs or edit their inventories to your liking.

Next look through the "Newly added Random Encounter Tables", the entries should look like this:
[Encounter Table 68]
lookup_name=Wild6_M ; Area between New Reno and NCR
maps=Mountain Encounter 1, Mountain Encounter 2, Cavern Encounter 0
enc_00=Chance:33%,Enc:(8-12) RED_Wolves AMBUSH Player
enc_01=Chance:33%,Enc:(8-12) DVMV_Mantis_Swarm AMBUSH Player
enc_02=Chance:33%,Enc:(8-12) DMRV_Scorpions AMBUSH Player
enc_04=Chance:25%,Enc:(2-5) Bounty_Hunter_Low AMBUSH Player, If(Global(1) > 1) And If(Player(Level) < 7)
enc_05=Chance:25%,Enc:(2-5) Bounty_Hunter_Low_Mid AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 6) And If(Player(Level) < 13)
enc_06=Chance:25%,Enc:(2-5) Bounty_Hunter_High_Mid AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 12) And If(Player(Level) < 19)
enc_07=Chance:25%,Enc:(2-6) Bounty_Hunter_High AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 18)
enc_08=Chance:25%,Enc:(2-4) Bounty_Hunter_Low AMBUSH Player, If(Global(0) < -500) And If(Player(Level) < 7)
enc_09=Chance:25%,Enc:(2-4) Bounty_Hunter_Low_Mid AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 6) And If(Player(Level) < 13)
enc_10=Chance:25%,Enc:(2-4) Bounty_Hunter_High_Mid AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 12) And If(Player(Level) < 19)
enc_11=Chance:25%,Enc:(2-5) Bounty_Hunter_High AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 18)
enc_11=Chance:20%,Enc:(4-7) Morton_Brother, If(Global(386) > 0) And If(Global(386) < 6)
enc_12=Chance:5%,Counter:1,Special,Map:Special Bridge Encounter,Enc:Special1, If(Player(Level) > 9) And If(Global(605) < 1)
enc_13=Chance:3%,Counter:1,Special,Map:Special Holy Encounter 2,Enc:Special1, If(Global(614) > 0) And If(Global(606) < 1)
Each table corresponds to an area in the worldmap, to add new encounters just edit the last line of the table that corresponds to the area where you want the encounter to happen, add the line with new encounter (ie: enc_14=Chance:25%,Enc:(6-10) New_Encounter_name AMBUSH Player) The first value is the encounter id, chance of finding encounter, number of critters in encounter, and encounter name. You can specify extra values like whether you want the encounter to appear when you have reached a certain level, etc.

Next you have to edit the text/english/game/Worldmap.msg, here all the encounter names are listed, just refer to the random encounter table of that corresponds to the table/s you edited and add the encounter name to the list, just make sure the number on the message index corresponds with the number you assigned to the encounter on that encounter table.

Hope this helps
SeanDMan
Vault Dweller
Vault Dweller
Posts: 119
Joined: Mon May 13, 2002 1:24 pm

Post by SeanDMan »

Corpse, thats ownage. You rule.
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

Each table corresponds to an area in the worldmap
no it doesn't...

the tables set the likelyhood of a certatn encounter occuring and not the world map area it occurs in...

that is set at the end of the list where each square is assigned a table to chose it's encounter from, and it's frequency of occurence, and terrain type which affects movement speed.
User avatar
Corpse
Vault Scion
Vault Scion
Posts: 188
Joined: Thu Mar 20, 2003 2:48 pm
Location: Sydney, Australia

Post by Corpse »

Yes, the encounter entries on the table set the chance of a random encounter, but the table itself corresponds to an area:
[Encounter Table 68] #<= Table Index
lookup_name=Wild6_M ; Area between New Reno and NCR #<= Area where the encounters happen.
maps=Mountain Encounter 1, Mountain Encounter 2, Cavern Encounter 0
enc_00=Chance:33%,Enc:(8-12) RED_Wolves AMBUSH Player
enc_01=Chance:33%,Enc:(8-12) DVMV_Mantis_Swarm AMBUSH Player #<=Encounter types

There is another table at the end (After End of Newly Added Encounters)that seems to set terrain and encounter difficulty for areas that use a msk file (Coastline, mountains); I haven't had the need to edit this table so I haven't had a good look through it.[/i]
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

:roll: i assure you that the area has nothing to do with the tables.. there is a description in some of the tables as to where the table is supposed to be used.. ( like enclave patrolls near Navarro, but not arround vault city.. ), but it does not set the area in the table..

the area and frequency that a table will be used in is set in the part at the end of the file that lists each square of every tile that the world map is made up of...

Code: Select all


&#91;Tile 10&#93;
art_idx=349
encounter_difficulty=-40
; x_offset_yoffset=terrain,morning_chance,afternoon_chance,night_chance,type
0_0=Mountain,No_Fill,Rare,Rare,Rare,Red_M
0_1=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Red_M
0_2=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_M
0_3=Desert,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_D
0_4=Mountain,No_Fill,Frequent,Frequent,Frequent,EPA_M
0_5=Desert,No_Fill,Frequent,Frequent,Frequent,EPA_D
1_0=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Red_M
1_1=Mountain,No_Fill,Common,Common,Common,Red_M
1_2=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_M
1_3=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_M
1_4=Mountain,No_Fill,Frequent,Frequent,Frequent,EPA_M
1_5=Mountain,No_Fill,Frequent,Frequent,Frequent,EPA_M

and so on..
it sets for each square ( listed in x_y co-ordinates ) the terain type, the fill type ( for filling a tile with water.. ? ), the frequency of random encounters during morning, noon, and night, and the table to get the random encounter form...

so as you can see, you can, if you like, set it so you run into enclave patrolls outside of Vault City
The area comments in the encounter tables itself are just guidelines and do not have anything to do with where you use the table...
User avatar
Red
Hero of the Glowing Lands
Hero of the Glowing Lands
Posts: 2085
Joined: Wed May 15, 2002 11:58 am
Location: Nowhere (important anyway)
Contact:

Post by Red »

Indeed the fill type is to specify that when you enter this tile, the map should "highlight" automagically all tiles left of this one as it's actually just water.

Thanks to Temaperacl for this enlightenment.
...
User avatar
Corpse
Vault Scion
Vault Scion
Posts: 188
Joined: Thu Mar 20, 2003 2:48 pm
Location: Sydney, Australia

Post by Corpse »

ColJack wrote::roll: i assure you that the area has nothing to do with the tables.. there is a description in some of the tables as to where the table is supposed to be used.. ( like enclave patrolls near Navarro, but not arround vault city.. ), but it does not set the area in the table..

the area and frequency that a table will be used in is set in the part at the end of the file that lists each square of every tile that the world map is made up of...

Code: Select all


&#91;Tile 10&#93;
art_idx=349
encounter_difficulty=-40
; x_offset_yoffset=terrain,morning_chance,afternoon_chance,night_chance,type
0_0=Mountain,No_Fill,Rare,Rare,Rare,Red_M
0_1=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Red_M
0_2=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_M
0_3=Desert,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_D
0_4=Mountain,No_Fill,Frequent,Frequent,Frequent,EPA_M
0_5=Desert,No_Fill,Frequent,Frequent,Frequent,EPA_D
1_0=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,Red_M
1_1=Mountain,No_Fill,Common,Common,Common,Red_M
1_2=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_M
1_3=Mountain,No_Fill,Uncommon,Uncommon,Uncommon,SRNRRN_M
1_4=Mountain,No_Fill,Frequent,Frequent,Frequent,EPA_M
1_5=Mountain,No_Fill,Frequent,Frequent,Frequent,EPA_M

and so on..
it sets for each square ( listed in x_y co-ordinates ) the terain type, the fill type ( for filling a tile with water.. ? ), the frequency of random encounters during morning, noon, and night, and the table to get the random encounter form...

so as you can see, you can, if you like, set it so you run into enclave patrolls outside of Vault City
The area comments in the encounter tables itself are just guidelines and do not have anything to do with where you use the table...
It looks to me like the type is a table header:
1_5=Mountain,NoFill,Frequent,Frequent,Frequent,EPA_M
(ie.EPA_M corresponds to table 46)

You are right in that point, it looks like the second table header is linked to a sector in the last table but if you want to add a new encounter in a specific sector you need to place it in the second list of tables; if you edit the last table to make an encounter available, it will use all the encounters in that table and not just the one you want to specify; ie: say you wanted Yakuza around San Fran.
[Tile 17]
art_idx=356
encounter_difficulty=-50
walk_mask_name=wrldmp17
; x_offset_yoffset=terrain,morning_chance,afternoon_chance,night_chance,type
6_6=Desert,No_Fill,Rare,Rare,Rare,New_D
If you add it here like I did above, you are going to get all the encounters specified in table 53 (New_D) and not just the Yakuza like you intended.

I added new encounters around San Fran, to do this I had to edit tables 58-63; as far as I am concerned that is all I had to do to make the encounter active in the area and it works fine; here is an example:
[Encounter Table 60]
lookup_name=Fran_C ; Areas around San Francisco
maps=City Encounter 1, City Encounter 2, City Encounter 3, City Encounter 4, City Encounter 5, City Encounter 6, City Encounter 7, City Encounter 8
enc_00=Chance:35%,Enc:(4-9) FRAN_Mercenaries AMBUSH Player
enc_01=Chance:45%,Enc:(7-10) FRAN_Press_Gang AMBUSH Player
enc_02=Chance:17%,Enc:(4-7) EPA_Deathclaws AMBUSH Player
enc_03=Chance:17%,Enc:(6-10) EPA_Tough_Fire_Geckos AMBUSH Player
enc_04=Chance:25%,Enc:(2-5) Bounty_Hunter_Low AMBUSH Player, If(Global(1) > 1) And If(Player(Level) < 7)
enc_05=Chance:25%,Enc:(2-5) Bounty_Hunter_Low_Mid AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 6) And If(Player(Level) < 13)
enc_06=Chance:25%,Enc:(2-5) Bounty_Hunter_High_Mid AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 12) And If(Player(Level) < 19)
enc_07=Chance:25%,Enc:(2-6) Bounty_Hunter_High AMBUSH Player, If(Global(1) > 1) And If(Player(Level) > 18)
enc_08=Chance:25%,Enc:(2-4) Bounty_Hunter_Low AMBUSH Player, If(Global(0) < -500) And If(Player(Level) < 7)
enc_09=Chance:25%,Enc:(2-4) Bounty_Hunter_Low_Mid AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 6) And If(Player(Level) < 13)
enc_10=Chance:25%,Enc:(2-4) Bounty_Hunter_High_Mid AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 12) And If(Player(Level) < 19)
enc_11=Chance:25%,Enc:(2-5) Bounty_Hunter_High AMBUSH Player, If(Global(0) < -500) And If(Player(Level) > 18)
enc_12=Chance:20%,Enc:(4-7) Morton_Brother, If(Global(386) > 0) And If(Global(386) < 6)
enc_13=Chance:17%,Enc:(10-12) EPA_Tough_Alien AMBUSH Player
enc_14=Chance:20%,Enc:(5-8) FRAN_Elronologists FIGHTING (3-6) FRAN_Mercenaries
enc_15=Chance:20%,Enc:(5-8) FRAN_Elronologists FIGHTING (3-6) FRAN_Press_Gang
enc_16=Chance:30%,Enc:(4-8) FRAN_Elronologists
enc_17=Chance:40%,Enc:(4-9) FRAN_Triads AMBUSH Player <=New Enc
enc_18=Chance:23%,Enc:(4-8) FRAN_Elronologists FIGHTING (4-9) FRAN_Triads <=New Enc
enc_19=Chance:23%,Enc:(6-8) FRAN_Elronologists FIGHTING (4-9) FRAN_Triads <=New Enc
So as you can see if you want to make an specific encounter available in a sector you add it to the second list and not the last one.

The only time I would justify editing that last table is if you want to change the frequency or terrain of an encounter, or if you added a brand new sector to the worldmap and you want to link encounters to it.
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

I agree that you add your encounter to these tables, after first of course defining the encounter itself. ( not needed for special encounters.. see below.. )

I wasn't disputing that, i was disputing the part where you said a table corresponds to an area..

they don't, they are simply a table for the game to choose the encounter type from..

and yes specific tables are used in specific areas, but they needn't be.. you can use the san fran tables arround broken hills if you waned to..

if you happened to be making a new map, or even moving and adding towns to the existing map, and wanted to change the surrounding general encounter types, then you would make your own encounter tables to suit the area ( ie mobsters round a small casino town.. tribals round a tribal villiage etc.. ) and change the type in the tile tables to suit..


but all of this is getting away from the original post..
he wants to add a special random encounter..

to do this, he would have to add the map to the city.txt file, the maps.txt file, and then add a line to every encounter table in the worldmap.txt file..
there is no need to define an encounter for your new special, they are all lumped under the special encounter type, and just have the map to be used named in the tables..

which is why i told him the easiest way.. replace one of the existing special random encounters with his own.. such as the holy hand grenade one..
User avatar
ColJack
Vault Scion
Vault Scion
Posts: 175
Joined: Sat Apr 19, 2003 8:01 pm
Contact:

Post by ColJack »

Red wrote:Indeed the fill type is to specify that when you enter this tile, the map should "highlight" automagically all tiles left of this one as it's actually just water.

ALL HAIL RED!!...

once again he slips in a little piece of very usefull information while he thinks no-one is looking....

thanks Red, I didn't know that..
Our Host!
Post Reply