Jump to content


Photo

Increasing existing affects in characters


  • Please log in to reply
143 replies to this topic

#101 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 10 November 2011 - 04:30 PM

Edit: duh, INNER_PATCH_SAVE

How can i force evaluation of vars inside ~Mystring with vars~ before i concat it to the old string?




Edit 2:
Any reason the ^ concat would make this code fail? (uncommenting them makes it not compile)

I never used that... but I think that instead of
SET backstab_res = (~GT#BKS~ ^ ~%backstab%~)
you should try
SPRINT bacstab_res ~GT#BKS~ ^ ~%backstab%~
Tho in your specific use doing
SPRINT bacstab_res ~GT#BKS%backstab%~
should have the same effect and is more commonly used.


First error appears to be:
SET levelup_string = ""
"ERROR: cannot convert or %% to an integer"

How are we supposed to declare string vars?

SET is used for integers while SPRINT is used for strings.
example on presetting null variables using each
SET xyz = 0
SPRINT abc ~~

bump for the question above (and the one about the TOKENS too).

what question about TOKENS?

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#102 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 10 November 2011 - 04:41 PM

First error appears to be:
SET levelup_string = ""
"ERROR: cannot convert or %% to an integer"

How are we supposed to declare string vars?

When you deal with string variables you use SPRINT. SET is for values. The concatenation operator is also a bit redundant, since we have interpolation.
E.g., for your first attempt we could use
SPRINT backstab_res "GT#BKS%backstab%"
You also do not need to declare variables.

What are you trying to do with the INNER_PATCH_SAVE? (Currently it does not work and it does not make sense.)
There are also some problems with your dialogue string. Notably, there is no AND in this scripting language (AND is implicit for more than one trigger).


(and the one about the TOKENS too).

Link?

#103 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 05:28 PM

Trying to make a dynamic string that will be used as a variable on a fileoutput.

So, build a string one line at a time, replacing the variables i need, then insert the whole thing into the file compile, replacing the whole string as a variable.

(this for other strings too)

I think SPRINTF is what i needed there too.

The TOKEN question:

If a token is connected to a global variable with
SetTokenGlobal("gt#bks", "GLOBAL", "BKS")

Then the global changes;

SetGlobal("gt#bks", "GLOBAL", 124)

will the <TOKEN> in strings display the old or the new value?


Just to know if i have to change them a lot of times or just once.

Now i'm getting
"ERROR: [backstab.2da] -> [override] Patching Failed (COPY) (Not_found)"

from this i guess
COPY_EXISTING backstab.2da ~override~

But may that be because i'm using wine to test the mod install? The file DOES exist in the override (i extracted it with DLTCED)



Also, i just realized that Bards and rangers thief skill tables (pickpocket for bards, hideinshadows/movesilently, backstab for rangers) is filled.

This probably means that it is reset on each level up, and that these classes can't have these stats changed without the level up process changing them again?


This seems unfair (although the backstab bonus should be regained if they "level up" after the real level up because that stat is naturally not cumulative in thieves too - unlike the others that are in thieves and not in bards and rangers).

Edited by i30817, 10 November 2011 - 06:04 PM.


#104 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 10 November 2011 - 06:01 PM

Now i'm getting
"ERROR: [backstab.2da] -> [override] Patching Failed (COPY) (Not_found)"

from this i guess
COPY_EXISTING backstab.2da ~override~

But may that be because i'm using wine to test the mod install? The file DOES exist in the override (i extracted it with DLTCED)

shouldn't be due to that. backstab.2da is an existing file within the BG2 game and as such should be found when using COPY_EXISTING you don't need to place a copy into the override folder "override" in this case is the output location for the copy command (note that without using BUT_ONLY or BUT_ONLY_IF_IT_CHANGES the file will copy into the override even if no changes made)

However, that would be the line that causes the error...

Try
COPY_EXISTING GLOB ~backstab.2da~ ~override~
maybe you've some how gotten the backstab.2da removed from the key file too. GLOB lets you access mod added files that aren't associated with the keyfile

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#105 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 10 November 2011 - 06:06 PM

You also do not need to declare variables.

this can be misleading as there are many cases where you would need to preset or declare variables. I've had to do it quite often. granted not for a typical simple patch but there are times where declaring variables as either null or at a default value is needed.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#106 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 06:31 PM

Also, a rather technical question about the tables.

Anyone knows what happens if one sets -1 to parts of a class thieving table stat like this one:
skillrng

Would it then not change the value on level up or continue on trying to set -1 to a unsigned value?

If this works, I was thinking of allowing bards and rangers grow in ability until their limit on these abilities, and only then start using the thief table (for backstabs) or the point buy system. This should allow those classes to play normally if people don't want to use the mod (i aim to have it as a item you can find more or less by accident, with no change to original gameplay if you're not interested)

Or i can just disallow them increasing those stats (which would be silly considering it's their "specialization").

Or, if thieves are out left in the cold completely (they are, except for the hotkey script - it's just too easy to overflow) i could do the same for rangers and bards too.

Edited by i30817, 10 November 2011 - 06:44 PM.


#107 i30817

i30817
  • Member
  • 611 posts

Posted 10 November 2011 - 07:55 PM

However, that would be the line that causes the error...

Try
COPY_EXISTING GLOB ~backstab.2da~ ~override~
maybe you've some how gotten the backstab.2da removed from the key file too. GLOB lets you access mod added files that aren't associated with the keyfile



Strangely, i just tried it on a clean install (unzip more like) and it didn't. It does "work" if i comment the
READ_2DA_ENTRY_FORMER line in the FOR

Spoiler

Edited by i30817, 10 November 2011 - 08:21 PM.


#108 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 10 November 2011 - 09:58 PM

took some trial and error but i got it working on a BG1 install should work on a BG2 install too

COPY_EXISTING ~backstab.2da~ ~override~
COUNT_2DA_COLS max_level
SET real_cols = (%max_level%-1)
 READ_2DA_ENTRIES_NOW ~gt#_#backstab~ %real_cols%
SPRINT levelup_string ~~
FOR (j = %real_cols%; j > 0x0; j -= 0x1) BEGIN
 READ_2DA_ENTRY_FORMER ~gt#_#backstab~ 1 %j% stab
// READ_2DA_ENTRY  1 %j% %real_cols% stab
 PATCH_PRINT ~Backstab amount: %stab%~
 SPRINT backstab_res "GT#BKS%stab%"
 SPRINT level_string ~~~~~ blah ~~~~~
 SPRINT levelup_string ~%levelup_string%%level_string%~
END
BUT_ONLY
it is hard to explain why this works and the other didn't it just does. test it first tho before you commit to using it.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#109 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 10 November 2011 - 10:43 PM

one thing of interesting note:
when using READ_2DA_ENTRY_FORMER in a FOR loop that starts at the end of file rather than the beginning of file it causes some issues. Not all valid rows are read and will cause weidu to 'crap out'.

for example this reads the data and outputs both rows level & modifier as expected:
Spoiler


whereas this which starts the for loop at the high end rather than 0 errors out
Spoiler


made a report at PPG in the weidu thread
EDIT: tweaked it a bit and got it to work going high to low the problem was that first that j could not = %real_cols% had to equal (%real_cols%-1) then it got stuck in an endless loop. found out that j-=1 wasn't doing it's job changed it to j=%j%-1 and boom it worked

good code for high to low
Spoiler
obviously put in your sprints and stuff, but now you can check the level entry as well if you need to for some reason

Edited by Sasha Al'Therin, 10 November 2011 - 10:56 PM.

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#110 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 11 November 2011 - 03:00 AM

You also do not need to declare variables.

this can be misleading as there are many cases where you would need to preset or declare variables. I've had to do it quite often. granted not for a typical simple patch but there are times where declaring variables as either null or at a default value is needed.

You do not need to declare variables. Sometimes you may need to initialise a variable to a dummy value or whatever, but that is simply about assigning a value to the variable before you can dereference it; it is a different issue.

Edited by Wisp, 11 November 2011 - 03:01 AM.


#111 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 11 November 2011 - 06:03 AM


You also do not need to declare variables.

this can be misleading as there are many cases where you would need to preset or declare variables. I've had to do it quite often. granted not for a typical simple patch but there are times where declaring variables as either null or at a default value is needed.

You do not need to declare variables. Sometimes you may need to initialise a variable to a dummy value or whatever, but that is simply about assigning a value to the variable before you can dereference it; it is a different issue.

how do you know that THAT isn't what he was doing? He did not include all the code so you cannot jump to conclusions about what was being done. He merely showed what was causing weidu to error out. But enough said...

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#112 i30817

i30817
  • Member
  • 611 posts

Posted 11 November 2011 - 07:08 AM

Mmm. Found the problem in my original code:
READ_2DA_ENTRIES_NOW ~gt#_#backstab~ 1
READ_2DA_ENTRY_FORMER ~gt#_#backstab~ 2 %j% stab

What i didn't realize is that the backstab table is organized on a strange way:

2DA V1.0
1
......................0..LEVEL
THIEF............1..BACKSTABS


So by reading everything, i had to use row 3 instead of row 2 (that has nothing on those indexes, so it fails and raises the spurious warning that the file does not exist.

Edited by i30817, 11 November 2011 - 07:10 AM.


#113 Wisp

Wisp
  • Modder
  • 1353 posts

Posted 11 November 2011 - 07:23 AM

so it fails and raises the spurious warning that the file does not exist.

Not_found never refers to missing files. When a file is missing WeiDU plainly says so. Not_found refers to (I presume) variables, of the uninitialised kind.

#114 i30817

i30817
  • Member
  • 611 posts

Posted 11 November 2011 - 11:22 AM

Found a weidu bug!

Edited by i30817, 11 November 2011 - 11:22 AM.


#115 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 11 November 2011 - 11:43 AM

Found a weidu bug!

see my response at that thread

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#116 i30817

i30817
  • Member
  • 611 posts

Posted 11 November 2011 - 02:38 PM

Thanks for that info. Pity i didn't post here before posting there and making a fool of myself.

Here is something crazy, a binary search generator in weidu ... that doesn't seem to work with lower numbers of min_division_length (leaf size) due to a stackoverflow...



Edit: code is fixed now, left here in case someone else needs to find the exact value from a stat
Spoiler

Edited by i30817, 12 November 2011 - 11:10 AM.


#117 Sasha Al'Therin

Sasha Al'Therin
  • Modder
  • 615 posts

Posted 11 November 2011 - 04:00 PM

not sure what you are trying to accomplish with that. good luck in getting it to work tho

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm


#118 i30817

i30817
  • Member
  • 611 posts

Posted 11 November 2011 - 04:26 PM

Wow, never mind, i had a dirty bug with the pivot declaration.

It generates this basically (run with small range so its understandable)

Returns a string and a "last state" (that you use if you need to) that can be compiled into a dialog to find out stats real values by putting them into a global (since there is no way to tell).


Spoiler

Edited by i30817, 11 November 2011 - 04:40 PM.


#119 i30817

i30817
  • Member
  • 611 posts

Posted 12 November 2011 - 07:25 AM

Hi again.

[tb#_compile_eval_buffer/general_thieving/gt#buff.baf] PARSE ERROR at line 35 column 1-39
Near Text: )
	[StateCheck] argument [STATE_NOT_VISIBLE] not found in [State.IDS]

I didn't have this problem before because i wasn't using a clean installation, NOT_VISIBLE seems to be a mod added bitfield combination.

Now, i can probably add it myself by looking at the solaufein scripts, but does adding two rows with the same name-value pairs cause problems in IDS files?

#120 10th

10th
  • Member
  • 621 posts

Posted 12 November 2011 - 07:48 AM

Now, i can probably add it myself by looking at the solaufein scripts, but does adding two rows with the same name-value pairs cause problems in IDS files?

There should be a bit of info over at G3, as there some post preview in google state.ids duplicate entry, but that's from 2007.

See BPv180.tp2 or TDD.tp2:

APPEND ~STATE.IDS~ ~0x00400010 STATE_NOT_VISIBLE~ UNLESS ~STATE_NOT_VISIBLE~
or
APPEND ~STATE.IDS~ ~0x00400010 STATE_NOT_VISIBLE~ UNLESS ~0x00400010~

Interestingly enough

RR, atweaks and SCS/SCS II add the same value - 0x00400010 - as STATE_NOT_TARGETABLE without checking if 0x00400010 is already present in STATE.IDS.

10th

Edited by 10th, 12 November 2011 - 08:05 AM.

Avast! You cannot defeat our titan-mounted submarine staffed by cannibal vikings! - Nodwick

"I grab his deceased spirit and piledrive it back into his body, duplicating raise dead." - Psyren Oots board