WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
90 stars 20 forks source link

Script actions GivePartyGoldGlobal() and AddexperiencePartyGlobal() are incorrectly compiled for IWD1 and PST #240

Closed Argent77 closed 2 months ago

Argent77 commented 7 months ago

The parameters of the following script actions are incorrectly encoded in IWD1 and PST script style.

141 GivePartyGoldGlobal(S:Name*,S:Area*)
165 AddexperiencePartyGlobal(S:Name*,S:Area*)

Unlike Name/Area parameters in SetGlobal() and similar actions these are not combined into a single string but instead always encoded as two separate strings.

Example script:

GivePartyGoldGlobal("GoldAmount","GLOBAL")
AddexperiencePartyGlobal("XpAmount","GLOBAL")

Current (incorrect) code:

AC
141OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
0 0 0 0 0"GLOBALGoldAmount" "" AC
AC
165OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
0 0 0 0 0"GLOBALXpAmount" "" AC

Expected code:

AC
141OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
0 0 0 0 0"GoldAmount" "GLOBAL" AC
AC
165OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] ""OB
0 0 0 0 0"XpAmount" "GLOBAL" AC
FredrikLindgren commented 6 months ago

I'll see what I can do.

Argent77 commented 6 months ago

It's probably just a matter of removing these entries: https://github.com/WeiDUorg/weidu/blob/d2441fb71f6e08b22e747684c3c53c0a3fcb123b/src/bcs.ml#L659-L660 and https://github.com/WeiDUorg/weidu/blob/d2441fb71f6e08b22e747684c3c53c0a3fcb123b/src/bcs.ml#L666-L667

FredrikLindgren commented 2 months ago

That seems to be the case, yes. Thank you. Fixed in 23f9507cfef5869c1cadd6fc8030aeeb02a82ac9.