Skip to content

-HOW TO DO STUFF IN WEIDU-

1356789

Comments

  • RaduzielRaduziel Member Posts: 4,714
    I want to make opcode 139 show a string made by me. How can I do it, doc?
  • GwendolyneGwendolyne Member Posts: 461
    COPY ~mymod/myspell.spl~ ~override/myspell.spl~	SAY NAME1 @1	SAY UNIDENTIFIED_DESC @2
    	LPF ALTER_EFFECT INT_VAR match_opcode = 139 parameter1 = RESOLVE_STR_REF (@3) END
    BUT_ONLY
    
    You can do the same with items, with all the @ stringref located in a tra file (for translation purpose)...

  • OlvynChuruOlvynChuru Member Posts: 3,075
    While I can't say that this is how everyone does it, this is how I do it. Say I want a certain spell to produce the string "Protected by Greater Globe of Invulnerability". I make an eff file that will produce that string. The idea of using an eff file is that the parameter 1 (where you put the string number) is always in the same place in the file, namely, at offset 0x1c.

    My WeiDU code would be like this:

    COPY ~mymod/ooglebla.eff~ ~override~
    SAY 0x1c ~Protected by Greater Globe of Invulnerability~

    Then, on the spell I want to produce the string, I put a use eff file effect that uses ooglebla.eff and then it produces the string just fine.
  • The user and all related content has been deleted.
  • GrammarsaladGrammarsalad Member Posts: 2,582
    edited July 2017

    While I can't say that this is how everyone does it, this is how I do it. Say I want a certain spell to produce the string "Protected by Greater Globe of Invulnerability". I make an eff file that will produce that string. The idea of using an eff file is that the parameter 1 (where you put the string number) is always in the same place in the file, namely, at offset 0x1c.

    My WeiDU code would be like this:

    COPY ~mymod/ooglebla.eff~ ~override~
    SAY 0x1c ~Protected by Greater Globe of Invulnerability~

    Then, on the spell I want to produce the string, I put a use eff file effect that uses ooglebla.eff and then it produces the string just fine.

    Just to complete this process, your code would look like this:
    COPY ~path/myeff.eff~ ~override~   //notification eff
      SAY 0x1c ~notification text~    //Notification text
    Another thing to remember is that it's important to update spells that would protect against your spell to also protect against the text of your newly added spell (regardless of the method you use to add the text notification). Say you make a charm spell with a unique notification (e.g. 'seduced') and it is cast against someone protected by mind blank. Without protection against the string you might still see the notification (e.g. 'protected character: seduced') even though they are not, in fact, seduced (or whatever).

    So, for any such spell, you want to do something like this:
    COPY_EXISTING ~spellres.spl~ ~override~
           LPF CLONE_EFFECT INT_VAR multi_match = 1 match_opcode = 267 parameter1 = RESOLVE_STR_REF (~notification text~) END
    Just be sure that the target spell has at least one 267 effect ( likely as it will presumably protect vs. other text notifications)

    If, for whatever reason, the target spell does not have a 267 effect, find another effect with a 0 timer (duration) and do this:
    COPY_EXISTING ~spellres.spl~ ~override~
           LPF CLONE_EFFECT INT_VAR multi_match = 1 match_opcode = (old opcode #) opcode = 267 parameter1 = RESOLVE_STR_REF (~notification text~) END
    Note: I've never used RESOLVE_STR_REF so i haven't tested this. That Will change after today. I'm going on earlier posts, but I think this should work...I'm not sure about the parentheses... tested. This works.
    Post edited by Grammarsalad on
  • OlvynChuruOlvynChuru Member Posts: 3,075
    How do I rename a file with WeiDU?
  • [Deleted User][Deleted User] Posts: 0
    edited July 2017
    The user and all related content has been deleted.
  • GwendolyneGwendolyne Member Posts: 461
    edited July 2017
    Not sure about it (never tested), but did you try MOVE ~sourceFile~ ~destinationFile~?
  • NicolBluetoothNicolBluetooth Member Posts: 48
    Can someone please tell me how to modify Sale Triggers in STOs and Response Triggers in DLGs?
  • semiticgoddesssemiticgoddess Member Posts: 14,903
    How do I get WeiDu to patch all items of a given type to change their price value? I want to make it possible to sell bodies to a custom store.
  • [Deleted User][Deleted User] Posts: 0
    edited July 2017
    The user and all related content has been deleted.
  • GwendolyneGwendolyne Member Posts: 461
    And don't forget to check the unsellable flag:
    WRITE_LONG 0x18 THIS | BIT0		// add Unsellable flag
    WRITE_LONG 0x18 (THIS BAND BNOT BIT0)	// remove Unsellable flag
  • OlvynChuruOlvynChuru Member Posts: 3,075
    What is the easiest and most compatible way to edit a kit's ability 2DA file?
  • The user and all related content has been deleted.
  • OlvynChuruOlvynChuru Member Posts: 3,075
    How do I move all the files from my mod folder to the override folder? There doesn't seem to be a COPY_REGEXP command in WeiDU, so I'm not sure how to do it. Do I copy the folder that contains the files to the override?
  • The user and all related content has been deleted.
  • PaulaMigratePaulaMigrate Member Posts: 1,201

    Can someone please tell me how to modify Sale Triggers in STOs and Response Triggers in DLGs?

    Maybe you never got an answer to your questions because nobody understands them?

    What are sales triggers in STOs? Do you want to offer special items under specific conditions or something like that?
    Response triggers in DLGs? Do you want to add new responses that only trigger under some conditions or change the triggers for existing responses or something completely different?
  • NicolBluetoothNicolBluetooth Member Posts: 48

    Can someone please tell me how to modify Sale Triggers in STOs and Response Triggers in DLGs?

    Maybe you never got an answer to your questions because nobody understands them?

    What are sales triggers in STOs? Do you want to offer special items under specific conditions or something like that?
    Response triggers in DLGs? Do you want to add new responses that only trigger under some conditions or change the triggers for existing responses or something completely different?
    I'm sorry I made my questions so hard to understand; I did not mean to be vague.
    Sales triggers are the conditions for which certain items become available in stores, like when a tattoo is unavailable until its corresponding quest is completed. I want to edit the conditions for triggering a few preexisting sale items, not add new conditions for offering new items, so that those preexisting items can be unlocked under slightly broader sets of restrictions.
    A response trigger is what's used to make certain dialog options and responses unavailable unless certain criteria are met. An example would be if you can request training from an NPC, who responds by giving you 12000 XP if you're a mage, but if you aren't a mage, your request triggers a different response from the NPC which nets you less XP. I want to change the triggers for existing responses to make them slightly easier to trigger.
    The few STO and DLG files I want to edit include or point to said triggers, which are boolean functions that of course result in true or false. I want to tack on an || (OR) statement to the ends of those functions so they would also trigger if a second boolean function call I've prepared results in true. I just don't know how. What WeiDU functions are capable of modifying such triggers?
  • PaulaMigratePaulaMigrate Member Posts: 1,201
    edited August 2017
    Shops
    I am not aware of any such thing as sales triggers. The way it works (e.g. Ribalds shop that has new items in later chapters) is that you have more than one STO file, one with extra items, another without the extra items. In the dialogue file of the shopkeeper you set the triggers that open one or the other.

    Triggers
    You are probably looking for something like this http://www.weidu.org/~thebigg/README-WeiDU.html#REPLACE_TRIGGER_TEXT although Replace Trigger needs to be used with great care. There may be better options, we need to have an example case for this.
  • argent77argent77 Member Posts: 3,433
    edited August 2017
    Sales triggers require STO V1.1 structures, which are currently only supported by PST and PST:EE. They are defined directly in the "Item for Sale" entries of the store. You can see how it works in FELL.STO. It's usually just a matter of checking one or more globals.

    The trigger itself is a simple strref however, so something like this should work:
    COPY_EXISTING ~store.sto~ ~override~ // calculate trigger offset... SAY offset ~Global("MyGlobal", "GLOBAL", 1)~
  • PaulaMigratePaulaMigrate Member Posts: 1,201
    argent77 said:

    Sales triggers require STO V1.1 structures, which are currently only supported by PST and PST:EE. They are defined directly in the "Item for Sale" entries of the store. You can see how it works in FELL.STO. It's usually just a matter of checking one or more globals.

    The trigger itself is a simple strref however, so something like this should work:
    COPY_EXISTING ~store.sto~ ~override~ // calculate trigger offset... SAY offset ~Global("MyGlobal", "GLOBAL", 1)~

    Ah, it was not clear that these questions were about PST.
    Sorry, forget all I said.
  • NicolBluetoothNicolBluetooth Member Posts: 48

    argent77 said:

    Sales triggers require STO V1.1 structures, which are currently only supported by PST and PST:EE. They are defined directly in the "Item for Sale" entries of the store. You can see how it works in FELL.STO. It's usually just a matter of checking one or more globals.

    The trigger itself is a simple strref however, so something like this should work:
    COPY_EXISTING ~store.sto~ ~override~ // calculate trigger offset... SAY offset ~Global("MyGlobal", "GLOBAL", 1)~

    Ah, it was not clear that these questions were about PST.
    Sorry, forget all I said.
    Thanks for the support. I knew about REPLACE_TRIGGER_TEXT, but I didn't know if REPLACE_TEXTUALLY or REFACTOR_D_TRIGGER were more appropriate since the WeiDU Docs warned "Never use this if you can help it". Now I know the warning doesn't apply to my situation. I also knew my store edits need to start with "COPY_EXISTING ~storename.sto~ ~override~", but I didn't know SAY offset was used to change the triggers of items. I should be able to guess the rest, and work out any bugs through trial-and-error. Thank you.
  • OlvynChuruOlvynChuru Member Posts: 3,075
    Currently I'm trying to make a TRA file for my big mod. It makes many hundreds of strings. What I'm wondering is, is there any reason to make the TRA file by hand instead of using the --traify command?
  • The user and all related content has been deleted.
  • OlvynChuruOlvynChuru Member Posts: 3,075
    How do I use --traify or any other of those command line commands? The WeiDU documentation tells me to "use the DOS Shell ("command" or "cmd") to run WeiDU." I don't know how to do that.
  • TressetTresset Member, Moderator Posts: 8,264
    kjeron said:


    COPY_EXISTING_REGEXP ~.*\.itm~ override
     READ_LONG 0x6a fx_off
     READ_SHORT 0x70 glob_fx
     FOR (i = 0; i < glob_fx; ++i) BEGIN
      READ_SHORT (fx_off + i * 0x30) opcode
      PATCH_IF opcode = 208 BEGIN	// Item has MINHP effect
       LPF DELETE_EFFECT
        INT_VAR
         check_headers = 0	// Ignore abilities / Only remove global/equipped effects
         match_opcode = 101  // Immunity to effect
         match_parameter2 = 241  // Control Creature
       END
       SET i = glob_fx
      END
     END
    BUT_ONLY
    Ok, so this code is almost exactly what I need. The only problem is that I need to delete multiple different effects with multiple different opcodes having multiple different parameters1&2. Can I put some OR's in that function somewhere to make it easier? If so, how would that be done?
  • PaulaMigratePaulaMigrate Member Posts: 1,201
    edited September 2017

    How do I use --traify or any other of those command line commands? The WeiDU documentation tells me to "use the DOS Shell ("command" or "cmd") to run WeiDU." I don't know how to do that.

    You normally have something like this
    C:\Windows\System32\cmd.exe
    You start that exe and get the *command line*. You navigate to the directory your game and weidu is in using *cd...* commands. Once you are there you enter the weidu command you find in your description.
  • kjeronkjeron Member Posts: 2,367
    Tresset said:

    Ok, so this code is almost exactly what I need. The only problem is that I need to delete multiple different effects with multiple different opcodes having multiple different parameters1&2. Can I put some OR's in that function somewhere to make it easier? If so, how would that be done?

    Unfortunately functions don't really support multiple choice. You would have to run the function separately for each effect/parameter combination.
  • TressetTresset Member, Moderator Posts: 8,264
    Crap, I was beginning to figure as much. Ah well...
  • ArdanisArdanis Member Posts: 1,736
    edited September 2017
    The macro source. If you edit the lines 99 & 100
              READ_SHORT (___#fx_off + 0x30 * ___#index2) ___#opcode
              PATCH_IF ( (___#opcode = opcode_to_delete) OR (opcode_to_delete = (0 - 1)) ) BEGIN //match of delete all 
    to read and check other parameters, you can pretty much have your custom version. You can even just check for exact opcodes/params directly, without passing opcode_to_delete arguments.
Sign In or Register to comment.