From 0ab126c7000870b6bc4f634f31e1180591378b73 Mon Sep 17 00:00:00 2001 From: Magus Date: Sat, 13 Apr 2024 01:17:02 +0700 Subject: [PATCH] Fix DEN_Slavers encounter: slaves will fight back if attacked, and PC slaver attacking slaves will provoke other slavers. Ref #105. --- .github/workflows/build.yml | 2 +- data/data/worldmap.txt | 8 +----- data/scripts/scripts.lst | 2 +- scripts_src/rndenctr/ecslave.ssl | 43 +++++++++++++++++++++++++++++--- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bcc8934bb..8976fe4d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: scripts_dir: scripts_src dialog_dir: data/text/english/dialog worldmap_path: data/data/worldmap.txt - worldmap_script_sets: 258,259 622,1129 623,1129, 493,785 + worldmap_script_sets: 258,259 622,1129 623,1129, 493,785, 508,628 - uses: devopsx/gha-ubuntu-i386-fix@master diff --git a/data/data/worldmap.txt b/data/data/worldmap.txt index 2f4451c7d..bda005a05 100644 --- a/data/data/worldmap.txt +++ b/data/data/worldmap.txt @@ -497,19 +497,13 @@ type_01=Dead, pid:16777221 position=Surrounding, Spacing:3 [Encounter: DEN_Slavers] -type_00=ratio:20%, pid:16777433, Item:18(wielded), Item:(0-10)41, Item:40, Script:508 ; Male Slaver w/ Desert Eagle and Stimpak +type_00=ratio:20%, pid:16777433, Item:18(wielded), Item:(0-10)41, Item:40, Script:508 ; Male Slaver w/ Desert Eagle and Stimpak type_01=ratio:20%, pid:16777434, Item:9(wielded), Item:(0-10)41, Item:40, Script:508 ; Female Slaver w/ Springer Rifle and Stimpak type_02=ratio:20%, pid:16777233, Script:628 ; Cute Female Slave type_03=ratio:20%, pid:16777238, Script:628 ; Strong Male Slave type_04=ratio:10%, pid:16777243, Script:628 ; Generic Female Slave type_05=ratio:10%, pid:16777244, Script:628 ; Generic Male Slave -;position=Surrounding -;position=straight_line, spacing:1 -;position=straight_line, spacing:2 -;position=double_line, spacing:1 position=wedge, spacing:2 -;position=cone, spacing:2 -;position=huddle, spacing:1 [Encounter: DEN_Slave_Run] type_00=ratio:50%, pid:16777433, Item:5(wielded), Item:(0-10)41, Script:627 ; Male Slaver w/ Club diff --git a/data/scripts/scripts.lst b/data/scripts/scripts.lst index c3c250c29..5b2d919a6 100644 --- a/data/scripts/scripts.lst +++ b/data/scripts/scripts.lst @@ -625,7 +625,7 @@ ECBandit.int ; Random Encounter Bandit # local_vars=0 ECRobber.int ; Random Encounter Robber # local_vars=0 ECHiwymn.int ; Random Encounter Highwaymen # local_vars=0 ECSlvRun.int ; Random Encounter Slavers on a Slave Run # local_vars=0 -ECSlave.int ; Random Encounter Slaves # local_vars=0 +ECSlave.int ; Random Encounter Slaves # local_vars=7 ECRavPty.int ; Random Encounter Rave Party # local_vars=10 ECMantis.int ; Random Encounter Mantis # local_vars=0 ECBrahmn.int ; Random Encounter Brahmin # local_vars=0 diff --git a/scripts_src/rndenctr/ecslave.ssl b/scripts_src/rndenctr/ecslave.ssl index fac1a6843..e6358ee10 100644 --- a/scripts_src/rndenctr/ecslave.ssl +++ b/scripts_src/rndenctr/ecslave.ssl @@ -2,8 +2,8 @@ Copyright 1998-2003 Interplay Entertainment Corp. All rights reserved. */ -/* Random Encounter scripts. These will be filled in more once they - have been designed. +/* + Random Encounter slave. Usually with slavers around. */ @@ -14,13 +14,50 @@ #include "../headers/command.h" +#define LVAR_Hostile (5) +#define LVAR_Personal_Enemy (6) + procedure start; procedure talk_p_proc; +procedure slaves_attacked; procedure start begin set_self_team(TEAM_RND_SLAVE); + set_self_ai(AI_SLAVE); end procedure talk_p_proc begin - floater(random(100,104)); + floater(random(100, 104)); +end + +procedure critter_p_proc begin + if (local_var(LVAR_Hostile) == 2) and self_can_see_dude then begin + call slaves_attacked; + set_local_var(LVAR_Hostile, 1); + attack(dude_obj); + end +end + +// slavers protect their merchandise +procedure slaves_attacked begin + variable who; + foreach who in list_as_array(LIST_CRITTERS) begin + if get_team(who) == TEAM_RND_SLAVER then set_team(who, TEAM_RND_SLAVE); + end +end + +procedure damage_p_proc begin + if source_obj == dude_obj then begin + set_local_var(LVAR_Personal_Enemy, 1); + end +end + +procedure pickup_p_proc begin + if source_obj == dude_obj then begin + set_local_var(LVAR_Hostile, 2); + end +end + +procedure destroy_p_proc begin + inc_good_critter end