BGforgeNet / Fallout2_Restoration_Project

Fallout 2 Restoration Project, updated
https://forums.bgforge.net/viewforum.php?f=39
589 stars 39 forks source link

Sierra army depot : buggy terminals #70

Closed Question2 closed 3 years ago

Question2 commented 3 years ago

Describe the bug

This is with killap's 2.3.3 patch.

I noticed that activating the alarms via the security terminals on each level does not seem to do anything. There are no alarms and the security bots do not move.

For example, in the attached save, using the terminal to activate the alarm on level 1 does nothing.

Note that this is after I have talked to Skynet and he said he was resetting security on levels 1-3. I am not sure if this makes a difference.

I looked in the scripts and noticed that the terminals seem to do this :

set_map_var(MVAR_Security_Level_1,1); // Seraph's Fix. Original Code: set_global_var(MVAR_Security_Level_1,1);

But the klaxons and bots are not tied to mvar_security_level, so by itself, so it does nothing.

In order to get the klaxons and bots to activate, you need to set this :

set_global_var(GVAR_SIERRA_BASE_SECURITY,SIERRA_SECURITY_ON);

At this point, if security is activated on a specific level, the bots on that level will become active.

So to fix this, you need to make the terminals set the security to be on/off as well or nothing happens.

The klaxons are supposed to stop when the security is turned off as well, but they do not appear to do so. They are permanently active. I looked in the wsklaxon script but i cant see the problem...

SLOT04.zip

To Reproduce Steps to reproduce the behavior:

  1. Use security terminals on each level
  2. Activate the alarm
  3. Nothing appears to happen

Edit : I will be editing the terminals myself, i will upload the scripts here when its done. Still dont know whats wrong with the klaxons not turning off though.

Question2 commented 3 years ago

Doing some testing with the klaxons, im getting some strange results. It seems that the klaxons slowly turn themselves off, but only if i use the look action on the light and wait a few seconds. Not sure why it is doing this when turning the alarm on instantly makes all klaxons update to the flashing lights version.

Question2 commented 3 years ago

Did more testing, if i activate the alarm, save, load the save game, then turn the alarm off, it works correctly. All the klaxons will instantly turn themselves off with no issues.

If i activate the alarm, then turn it off, it bugs out. At this point, saving and loading the save game will cause the klaxons to dissapear and other oddities.

What is this, an engine bug?

burner1024 commented 3 years ago
  1. I can reproduce the turning on the alarm doing nothing.
  2. In my case, the klaxons just never turn off.
  3. I can't reproduce the disappearing.

The whole system is a mess. Need to understand why did they use individual MVARs for security level and GVAR_SIERRA_BASE_SECURITY and in addition to that GVAR_SIERRA_BASE_ALERT.

burner1024 commented 3 years ago
$ grep -R GVAR_SIERRA_BASE_SECURITY scripts_src | grep -v 'set_global_var(GVAR_SIERRA_BASE_SECURITY,SIERRA_SECURITY_ON)'
scripts_src/maps/depolva.ssl:   if ( (dude_elevation == 1) and (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) and (map_var(MVAR_Free_Bots) != 0) and (map_var(MVAR_Robot_Activation) == 0) ) then begin
scripts_src/headers/global.h:#define GVAR_SIERRA_BASE_SECURITY            (154)
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_SECURITY,0);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_SECURITY,0);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_SECURITY,0);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_SECURITY,0);
scripts_src/sierra/wsterm3a.ssl:   set_global_var(GVAR_SIERRA_BASE_SECURITY,1);
scripts_src/sierra/wsterm3b.ssl:   set_global_var(GVAR_SIERRA_BASE_SECURITY,SIERRA_SECURITY_OFF);
scripts_src/sierra/wsklaxon.ssl:   if ((global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) and (local_var(LVAR_Once) == 0)) then begin
scripts_src/sierra/wsklaxon.ssl:   if (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) then begin
scripts_src/sierra/wsklaxon.ssl:   end else if (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_OFF) then begin
scripts_src/sierra/wiscrtdr.ssl:   if (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) then begin
scripts_src/sierra/wcscbot2.ssl:   if ((global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_OFF) or
scripts_src/sierra/wcscbot2.ssl:   else if (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) then begin
scripts_src/sierra/wcscbot2.ssl:   if ((global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) and (local_var(LVAR_Active) == 0)) then begin
scripts_src/sierra/wcsecbot.ssl:   if ((global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_OFF) or
scripts_src/sierra/wcsecbot.ssl:   else if (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) then begin
scripts_src/sierra/wcsecbot.ssl:   if ((global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_ON) and (local_var(LVAR_Active) == 0)) then begin

GVAR_SIERRA_BASE_SECURITY is used:

  1. for klaxons
  2. in bot scripts in combination with MVAR level checks to attack the party
  3. for activation of some horrible repair bay code that was further mutilated by killap for RP.

It is only ever turned off from Skynet terminal or assembled brainbot dialog.

burner1024 commented 3 years ago
$ grep -R GVAR_SIERRA_BASE_ALERT scripts_src
scripts_src/headers/global.h:#define GVAR_SIERRA_BASE_ALERT               (151)
scripts_src/sierra/wsemit4c.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_ALERT,0);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_ALERT,0);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_ALERT,0);
scripts_src/sierra/wcbrnbot.ssl:          set_global_var(GVAR_SIERRA_BASE_ALERT,0);
scripts_src/sierra/wsemit1a.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsterm3a.ssl:   set_global_var(GVAR_SIERRA_BASE_ALERT,1);
scripts_src/sierra/wsemit3a.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit2c.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wiretscn.ssl:   set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit1d.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit1e.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wcscbot2.ssl:           //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then begin
scripts_src/sierra/wcscbot2.ssl:               //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then
scripts_src/sierra/wcscbot2.ssl:               //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then
scripts_src/sierra/wcscbot2.ssl:               //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then begin
scripts_src/sierra/wsemit4b.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit1b.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit2d.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit2a.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wcsecbot.ssl:           //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then begin
scripts_src/sierra/wcsecbot.ssl:               //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then
scripts_src/sierra/wcsecbot.ssl:               //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then
scripts_src/sierra/wcsecbot.ssl:               //else if ((cur_map_index == MAP_SIERRA_4) and (global_var(GVAR_SIERRA_BASE_ALERT) == 1)) then begin
scripts_src/sierra/wsemit3b.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit2b.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit4a.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);
scripts_src/sierra/wsemit1c.ssl:      set_global_var(GVAR_SIERRA_BASE_ALERT,SIERRA_ALERT_ON);

GVAR_SIERRA_BASE_ALERT is only set, but never checked anywhere. It can be removed.

burner1024 commented 3 years ago

There's also GVAR_SIERRA_BASE_ENEMY, which has something to do with "Evil Skynet", and doesn't look 100% good, too.

Anyway, to summarize:

  1. Other terminals do enable GVAR_SIERRA_BASE_SECURITY in addition to MVARs, so it looks like a bug.
  2. Other terminals do no disable GVAR_SIERRA_BASE_SECURITY, so there's no evidence that klaxons not disabling is a bug.
  3. It is not clear why there are GVARs in addition to MVARs in the first place.
  4. The code is extremely confusing and frail. I wouldn't be surprised if they did actually intend for repair booth to work, they just couldn't do it.
  5. I'll let the first terminal enable the alert properly and do some cleanup, but no further changes until someone figures out how it all actually works and/or supposed to work.
Question2 commented 3 years ago

Looking at the comments, it seems that the vanilla uses gvars only while the RP wanted to use mvars to specify the alert status on each floor and have the terminals enable/disable security on their respective floors only.

However, it seems that they didnt realise that the bots and klaxons are tied to GVAR_SIERRA_BASE_SECURITY, so setting the MVAR by itself does nothing.

The easiest way to fix this is simply to have each terminal set GVAR_SIERRA_BASE_SECURITY on/off when the player chooses to turn the alarm on/off. This will correctly cause the bots to go hostile instead of nothing happening.

Another strange part is the security terminal on level 3. You can disable the forcefields on level 1 and 2 via terminals, but there is no option to do it on level 3 because using the terminal causes you to talk to skynet. Its not clear if this is a bug, but i think it would make sense for the forcefields on level 3 to be disabled if you agree to help skynet and it would also be consistent with what happens on level 1 and 2.

I will fix and upload the terminal scripts here once im done.

Question2 commented 3 years ago

As for the klaxons, they are supposed to turn off because they are tied to the security level in wsklaxon :

else if (global_var(GVAR_SIERRA_BASE_SECURITY) == SIERRA_SECURITY_OFF) then begin if (obj_pid(self_obj) == PID_NS_FLASHING_LIGHT) then begin item:=create_object_sid(PID_NS_LIGHT,tile_num(self_obj),elevation(self_obj),SCRIPT_WSKLAXON); destroy_object(self_obj); end else if (obj_pid(self_obj) == PID_EW_FLASHING_LIGHT) then begin item:=create_object_sid(PID_EW_LIGHT,tile_num(self_obj),elevation(self_obj),SCRIPT_WSKLAXON); destroy_object(self_obj); end end

When I tested it, it was doing this inconsistently. If I activated the security, all the klaxons will start flashing. BUT if i tried to turn it off, nothing would happen. At this point, if i saved and loaded the game, all the flashing klaxons would be deleted from the map.

On the other hand, if i activated the security, saved, loaded THEN turned the alarm off, all of them would instantly turn off as expected.

I will try testing it again to be sure.

Question2 commented 3 years ago

OK tested the klaxons again.

image

Here, i had just turned the alarm on, then turned it off. The secret walls have closed because GVAR_SIERRA_BASE_SECURITY is correctly set to off, but the klaxons are still flashing.

To be more specific, this is what I did :

1.Used the terminal and turned the alarm on. 2.Exited dialog (otherwise the klaxons dont update into the flashing state) 3.Used the terminal and turned the alarm off 4.Save and loaded the game

image

At this point, all the klaxons had vanished from the walls.

SLOT04.zip SLOT03.zip

Slot 03 is before activating the alarm, slot 04 is after turning the alarm off.

Also, the bots probably shouldnt be saying their intruder alert text when the alarm has been turned off.

Question2 commented 3 years ago

Okay ive fixed the following terminals:

Level 1 security terminal Level 2 security terminal

Turning the alarm on/off will now set the GVAR for security level which will turn the bots/klaxons on and off.

WSTERM1B.zip

For the level 3 terminals, i have also made a small change : Agreeing to help skynet will disable the forcefields on level 3, similar to what you can do with the level 1 and 2 terminals.

Question2 commented 3 years ago

WISCRTDR.zip

Ive also made the secret doors in skynet's room activate if the security is activated on level 3, as otherwise the bots inside the room remain trapped in it forever and just run around inside the secret room.

burner1024 commented 3 years ago
  1. I am not convinced. Need a second opinion. @NovaRain, what do you think?
  2. I think klaxons are supposed to work the same way in both UP and RP, especially considering that RP changelog doesn't mention anything about them.
  3. Whether this get accepted or not, it'd be better if you make a fork and a pull, to review changes more easily.
NovaRain commented 3 years ago

I agree the terminals on level 1 and 2 should really activate/disable the alarm (lights and bots). I'd vote no for extra changes on level 3.

Question2 commented 3 years ago

Not sure what you mean by klaxons working the same way in both UP and RP...did you try replicating what I did to make the klaxons dissapear?

How do you make a fork and pull?

Question2 commented 3 years ago

I agree the terminals on level 1 and 2 should really activate/disable the alarm (lights and bots). I'd vote no for extra changes on level 3.

Main issue with level 3 is that the bots remain trapped in the secret room and are stuck inside, even though they are hostile to the player. They just run around inside. If im not wrong, they also prevent the player from resting on level 3 forever once they go hostile.

This is a bug that killap added by the way, because killap made the secret doors open on level 3 only if you make skynet an enemy. In vanilla, the secret doors open if the security is activated (for any reason).

Theres no reason to keep the bots locked up in the secret room once the player has triggered the security.

burner1024 commented 3 years ago

How do you make a fork and pull?

1, 2.

Not sure what you mean by klaxons working the same way in both UP and RP...did you try replicating what I did to make the klaxons dissapear?

I couldn't reproduce it in RPU. I'm referring to this

it seems that the vanilla uses gvars only while the RP wanted to use mvars to specify the alert status on each floor and have the terminals enable/disable security on their respective floors only.

burner1024 commented 3 years ago

This is a bug that killap added by the way, because killap made the secret doors open on level 3 only if you make skynet an enemy. In vanilla, the secret doors open if the security is activated (for any reason).

I think this change should be reverted, yes. Basically, the only things mentioned in RP changelog about Sierra are repair booth and trip wire. Otherwise, the location should work the same and scripts synced between UP and RP where possible.

burner1024 commented 3 years ago
  1. Many actors and actions can enable GVAR_SIERRA_BASE_SECURITY, but only Skynet can disable it. It makes sense and always been like that.
  2. The purpose of klaxons is to indicate GVAR_SIERRA_BASE_SECURITY state to the player. Not the MVAR state. MVAR is pretty visible from robots shooting you in the face.
  3. Therefore, terminals will turn on both. They will turn off MVAR, but not GVAR.
  4. Secbots should no longer display floats when not active.
  5. Level 3 secret door should release the bots when level security MVAR is set.
  6. Anything else will have to be handled in separate issues, with savegames and steps to reproduce.