Jump to content


Photo

Weidu and strings


  • Please log in to reply
43 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 09 August 2016 - 02:53 AM

I've been given a brief introduction to Weidu and know how to use it to fill out names and descriptions of items and spells without changing dialog.tlk by hand. I use the COPY function, Weidu adds the strings and, I presume, deletes them when I uninstall the mod. But what about strings that only appear when called on, like state descriptions or just something I want said through the Display String action or effect? How do I get them in without touching dialog.tlk?



#2 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 09 August 2016 - 03:12 AM

I've been given a brief introduction to Weidu and know how to use it to fill out names and descriptions of items and spells without changing dialog.tlk by hand. I use the COPY function, Weidu adds the strings and, I presume, deletes them when I uninstall the mod. But what about strings that only appear when called on, like state descriptions or just something I want said through the Display String action or effect? How do I get them in without touching dialog.tlk?

Strings are not removed by uninstall. Just when you install, uninstall and re-install, it is checked whether the string already exists - if yes, the reference is used again if no, a new one is created.

For the other question - this must be answered on an individual basis, for scripts, spells etc.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#3 temnix

temnix
  • Member
  • 983 posts

Posted 09 August 2016 - 04:13 AM

All right then. Spells. When a spell can be cast once per timer run and the player tries it again too early, I want the caster to get the "You cannot cast this spell yet" message.



#4 Roxanne

Roxanne

    Modder

  • Member
  • 3564 posts

Posted 09 August 2016 - 05:04 AM

All right then. Spells. When a spell can be cast once per timer run and the player tries it again too early, I want the caster to get the "You cannot cast this spell yet" message.

Do you have the rest of that function coded already? The adding of the message is trivial once you have coded the rest (i.e.setting a timer and a global when the specific spell is cast, checking for the timer to be expired/not expired and either allowing another casting or display the message, re-setting the globals accordingly etc) You can find examples for this in the AI scripts of higher level enemies.


The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*

 


#5 temnix

temnix
  • Member
  • 983 posts

Posted 09 August 2016 - 08:20 AM

No, that was just an example. That spell is only planned. But right now I could use a simple status message on the portraits, like Sleep, Berserk and so on - only my own words, of course.



#6 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 09 August 2016 - 08:59 AM

No, that was just an example. That spell is only planned. But right now I could use a simple status message on the portraits, like Sleep, Berserk and so on - only my own words, of course.

Well, the spells use the opcode 142 to show their icon. And string with 139, one way to do this in weidu is just copy the spell and LAUNCH PATCH FUNCTION aka... LPF ...

COPY ~modfolder and filename.spl~ ~override/*spellfilename*.spl~
    PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
      LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 1 timing = 1 duration = x resist_dispel = 2 probability1 = 100 STR_VAR resource = ~whateveryouwishthethingtoread~ END
END //hopefully this is enough END s, might not be... 

x being how ever long the thing lasts in seconds. This is why you do not usually go with non second divisible numbers in spell effects.

Read here a bit more of the variables you can set on that LPF... it's not very easy probably to read that for the first time, so you probably will want to use a good mod you know that does this as a reference.


Edited by The Imp, 09 August 2016 - 09:09 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#7 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 09 August 2016 - 05:06 PM

No, that was just an example. That spell is only planned. But right now I could use a simple status message on the portraits, like Sleep, Berserk and so on - only my own words, of course.

Well, the spells use the opcode 142 to show their icon. And string with 139, one way to do this in weidu is just copy the spell and LAUNCH PATCH FUNCTION aka... LPF ...

COPY ~modfolder and filename.spl~ ~override/*spellfilename*.spl~
    PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
      LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 1 timing = 1 duration = x resist_dispel = 2 probability1 = 100 STR_VAR resource = ~whateveryouwishthethingtoread~ END
END //hopefully this is enough END s, might not be... 

x being how ever long the thing lasts in seconds. This is why you do not usually go with non second divisible numbers in spell effects.

Read here a bit more of the variables you can set on that LPF... it's not very easy probably to read that for the first time, so you probably will want to use a good mod you know that does this as a reference.

 

For opcode 139, the string is specified by strref (not directly embeded in the effect) and that strref is stored in param1, not the resource parameter.

 

You can add a string to dialog.tlk and get its strref using RESOLVE_STR_REF (~Text to be added to the game~).  If you were using ADD_SPELL_EFFECT, you would set parameter1 = RESOLVE_STR_REF (~Text to be added to the game~).



#8 temnix

temnix
  • Member
  • 983 posts

Posted 10 August 2016 - 05:42 AM

This is all very complicated for me at this point...The Imp's suggestion sounds the best - I don't want to add strings to dialog.tlk manually, otherwise there are bound to be compatibility problems.



#9 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 10 August 2016 - 06:33 AM

This is all very complicated for me at this point...The Imp's suggestion sounds the best - I don't want to add strings to dialog.tlk manually, otherwise there are bound to be compatibility problems.

No, that's not what Mike meant, he says that my method will fail because it's done wrong, and because he knows better than me, he is most likely right.

So instead of the above code, you'll just have to make an adjustment for it, so it becomes this:

COPY ~modfolder and filename.spl~ ~override/*spellfilename*.spl~
    PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
      LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = 139 target = 1 timing = 1 parameter1 = RESOLVE_STR_REF (~whateveryouwishthethingtoread~) duration = x resist_dispel = 2 probability1 = 100 END
END

And yes, the RESOL... will add the text to the dialog.tlk and returns the added dialog string to parameter1.

 

Thanks Mike.


Edited by The Imp, 10 August 2016 - 06:54 AM.

Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#10 temnix

temnix
  • Member
  • 983 posts

Posted 12 August 2016 - 11:58 AM

So should I just use this bit of code? Or do I have to do RESOLVE_STR_REF first, and then the code? The code itself I put in the .tp2 file has created the effect all right, but the string is empty.



#11 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 12 August 2016 - 12:06 PM

So should I just use this bit of code?

Yep.

The functions description is a little bit off... it does create the string to the dialog.tlk on it's own, and then it links it to the parameter1. So there's no need for you to do it before you use the RESOLVE_STR_REF, as there is really no way to do that.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#12 temnix

temnix
  • Member
  • 983 posts

Posted 13 August 2016 - 03:01 AM

Emm, but the code just created a Display effect for an empty string.



#13 temnix

temnix
  • Member
  • 983 posts

Posted 13 August 2016 - 11:06 AM

Also the string is not a portrait string. I filled it out manually with a random dialog.tlk reference, and it only shows on the bottom of the screen. I need the string to be a status string - instead there is Berzerk from the icon I'm using. I'd like to use that icon separately, with my own status. I'm not using any kind of berserking effect, only an imitation that makes NPC attack the caster. But when I turned the table to see how the spell would work on the party, if cast by an enemy, I see that the affected characters are in the Berzerk state, at least with that message - apparently from calling on the icon alone. Also this brings up another topic. If anyone has managed to manipulate player characters to attack particular targets, do share.



#14 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 13 August 2016 - 03:35 PM

Each state has a unique description (statdesc.2da).  You can't associate the berserk icon with a different string without affecting everything else that uses that state or introducing a new state with a new description (which is not easily done).


Edited by Mike1072, 14 August 2016 - 02:31 AM.


#15 temnix

temnix
  • Member
  • 983 posts

Posted 14 August 2016 - 01:20 AM

Couldn't I just add a new icon to that icons file without creating a new state, or with an empty state? For now I'm simplifying the spells to do without the portrait strings, but a few could really use an icon and a string.



#16 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 14 August 2016 - 03:07 AM

All of the state icons are stored in one file (states.bam), so to insert a new one requires patching it in manually or overwriting the file completely, making it incompatible with other things that want to add new states.  I wrote some code to do manual patching for the map icons file and it wasn't pretty.  There's also a limited number of states available and I believe one of the popular mods replaces the file, filling up almost all of the unused states.

 

In EE they introduced a new BAM file format which is easier to patch and able to support more cycles in the file (which would basically eliminate the state limit), but creating a BAMv2 version of states.bam doesn't work.


Edited by Mike1072, 14 August 2016 - 03:11 AM.


#17 temnix

temnix
  • Member
  • 983 posts

Posted 14 August 2016 - 04:49 AM

You know, having tried all sorts of crazy things with effects at this point, I've come to the very wise conclusion that it just doesn't pay to try to push this engine beyond its limits. Even when it can be done, it just isn't worth the time and effort. Go simpler, that's going to be my rule of thumb.



#18 Mike1072

Mike1072
  • Modder
  • 539 posts

Posted 14 August 2016 - 05:14 AM

Good idea.  Starting with what can be done and designing what you want to do with those limitations is easier than deciding what you want to do and then wrestling with the tools to accomplish that.

 

By the way, I'm not sure why the text you added with the function turned out to be blank.  If you open up the spell using Near Infinity and view the added effect, what value appears in parameter 1 (relative offset 0x04)?



#19 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 14 August 2016 - 05:29 AM

By the way, I'm not sure why the text you added with the function turned out to be blank.  If you open up the spell using Near Infinity and view the added effect, what value appears in parameter 1 (relative offset 0x04)?

It might be the not installing the modmerger to the SoD game, if it's a SoD'ed BG1EE game, as the dialog.tlk that the game uses is the one in that .zip archive.

But that's a quite leap in assumption.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#20 temnix

temnix
  • Member
  • 983 posts

Posted 15 August 2016 - 01:48 PM

It's not an SoD-ed game. I don't like SoD. But about the toolset's limitations, it's actually worse than that. I start from what I want to do, naturally, then wrestle so heroically, THEN I discover it's not even possible because the engine was made to do what it already does - and no more! And after that I look into the pen-and-paper books, at the items and spells there, and I'm goggle-eyed at how easy it is to *imagine* things into existence, and how damn hard it is to squeeze them through the technological needle's eye. It's a kind of double hardness, actually, because we are doing this on computers. I mean, it'd be a modest challenge to stage a Chromatic Orb for a movie with, I don't know, colored rags and an orange. But freaking code is like a completely hostile planet. Instead of starting from freedom and abundance, we start from denial and poverty of options. An then, after a lot of effort, we feel very satisfied if we've pulled a little something past that technology censor that says no no no.

 

Ahh. I just had to get that off my chest. Thanks to everyone for the advice. Imp, my friend, would you please do something else related to Torment? Can you look at the SPL file for Chromatic Orb there and see if it uses any special flags to make it fly up out of sight, then crash down on the target's head like it does? I wanted to make this sell a little more interesting for BGEE. And while I WILL at least provide differently colored BAMs for all of the levels, to spite the censor, it doesn't seem like there is a way to make the caster lob that thing at the enemies as I wanted. I tried out the Extended flags that I can set. "Comet" is not bad, but it doesn't descend from the caster. "Falling path" just delivers the missile instantly, "Curved path" doesn't do anything, and neither, for the Orb, does "Pillar." Who can say, what are "Draw behind target", "Lined up AOE" and "Travel door"?