Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

-HOW TO DO STUFF IN WEIDU-

13567

Comments

  • RaduzielRaduziel Member Posts: 4,476
    I want to make opcode 139 show a string made by me. How can I do it, doc?

  • GwendolyneGwendolyne Member Posts: 246
    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)...

    subtledoctorGrammarsaladRaduziel
  • OlvynChuruOlvynChuru Member Posts: 2,246
    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.

  • subtledoctorsubtledoctor Member Posts: 11,176
    He's not using a tra file so it would be
    RESOLVE_STR_REF (~my string~)
    Which creates the string, adds it to dialog.tlk, and then populates a variable with its strref number - which is why you can use that variable as a integer in the INT_VAR section of the ALTER_EFFECT function.

  • GrammarsaladGrammarsalad Member Posts: 2,473
    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: 2,246
    How do I rename a file with WeiDU?

  • subtledoctorsubtledoctor Member Posts: 11,176
    edited July 2017
    COPY ~this~ ~that~
    EDIT I mean that's a copy, not a rename, but without more specific circumstances I think it functionally gets the job done...

  • GwendolyneGwendolyne Member Posts: 246
    edited July 2017
    Not sure about it (never tested), but did you try MOVE ~sourceFile~ ~destinationFile~?

  • NickBluetoothNickBluetooth Member Posts: 43
    Can someone please tell me how to modify Sale Triggers in STOs and Response Triggers in DLGs?

  • semiticgodsemiticgod Member, Moderator Posts: 13,381
    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.

  • subtledoctorsubtledoctor Member Posts: 11,176
    edited July 2017

    How do I get WeiDu to patch all items of a given type to change their price value?

    COPY_EXISTING_REGEXP GLOB ~^.+\.itm$~ ~override~
    PATCH_IF (%SOURCE_SIZE% > 0x71) BEGIN
    READ_SHORT 0x1c type
    PATCH_IF (%type% = X) BEGIN
    WRITE_LONG 0x34 Y
    END
    END
    BUT_ONLY
    Change X to whatever item type your items are, and Y to whatever price you want to assign them. Note, you might have to edit .STO files to buy them. (Or use the Tweaks Anthology component that lets all store buy all items.)

    semiticgod
  • GwendolyneGwendolyne Member Posts: 246
    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

    subtledoctorsemiticgod
  • OlvynChuruOlvynChuru Member Posts: 2,246
    What is the easiest and most compatible way to edit a kit's ability 2DA file?

  • subtledoctorsubtledoctor Member Posts: 11,176
    You've gotta be more specific than that. The easiest way to edit a .2da file is with a text editor :tongue:

    If we understand what you want to do we can tell you the easiest and most compatible way to do it...

    Grammarsalad
  • OlvynChuruOlvynChuru Member Posts: 2,246
    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?

  • subtledoctorsubtledoctor Member Posts: 11,176

    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?

    If you have a bunch of files that don't need any patching like SAY or anything like that, you can just put them all in a folder and copy the whole folder. Something like:
    COPY ~mymod/files/bulk_copy~ ~override~
    Because "bulk_copy" has no extension, Weidu reads it as a directory and copies its contents into /override.

    semiticgod
  • 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?

  • NickBluetoothNickBluetooth Member Posts: 43

    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: 2,736
    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.

  • NickBluetoothNickBluetooth Member Posts: 43

    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: 2,246
    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?

  • subtledoctorsubtledoctor Member Posts: 11,176

    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?

    I do it because I'm OCD and I want my tra numbers to correspond to the designated component numbers, and stuff like that.

    But if you're not like that, then just use --traify

  • OlvynChuruOlvynChuru Member Posts: 2,246
    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: 7,571
    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.

    verlaine
  • kjeronkjeron Member Posts: 2,003
    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.

    Tresset
  • TressetTresset Member, Moderator Posts: 7,571
    Crap, I was beginning to figure as much. Ah well...

  • ArdanisArdanis Member Posts: 1,617
    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.

    Tresset
Sign In or Register to comment.