Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.17k stars 85 forks source link

Improve guild attitudes script functions #618

Closed thokkat closed 6 months ago

thokkat commented 6 months ago

In wld_getguildattitude the order of guilds is wrong. Attitude from second guild to first is returned instead of first to second.

In wld_setguildattitude two attitudes are set but in vanilla it's only the first.

I fixed the above, expanded bounds checking and unified names. In wld_exchangeguildattitude every attitude is now only set once instead twice.

Try commented 6 months ago

Hi, @thokkat and thanks for PR!

Can you provide a test case or maybe a *.sav file?

thokkat commented 6 months ago

When entering house behind Zuris while sneaking in vanilla the militia guard is alerted. If AssessEnterRoom was disabled guard wouldn't react. In OG guard was not reacting even if perc was sent. Turned out check Wld_GetGuildAttitude(slf.guild, portalguild) == ATT_FRIENDLY) in C_NpcIsBotheredByPlayerRoomGuild fails. Instead of MIL to VLK (friendly), VLK to MIL (neutral) is checked.

Was testing percs and looked for a case where not sending AssessEnterRoom while sneaking makes a difference, see https://github.com/Try/OpenGothic/issues/604#issuecomment-2096599054.

For Wld_SetGuildAttitude I just compared output of Wld_GetGuildAttitude before and after assigning new attitude by inserting print commands to script.

Try commented 6 months ago

Merged, thanks!