Jump to content


Photo

Toss your semi-useful WeiDU macros here


51 replies to this topic

#46 Angel

Angel
  • Members
  • 117 posts
  • Gender:Not Telling
  • Location:Netherlands

Posted 07 August 2017 - 03:18 PM

Oh, this is great! Any chance for a 'shawdowed' option (i.e. like shades or shadow monsters in iwdee)?

Eh, didn't expect such a response to a relatively simple function.  Is nobody interested in my erase-journal-o-matic for BGT? :-)

 

And yeah, writing variants should not be too hard, if I'd know what makes a monster a shade or shadow.  Here's a variant that makes the monster illusionary.

 

Spoiler

Edited by Angel, 22 August 2017 - 10:51 AM.


#47 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9239 posts
  • Gender:Not Telling

Posted 07 August 2017 - 03:54 PM

 

Another small one, turn a creature into a summoned creature. 


This is GOLD. Gonna make good use of this.

Anyone know of a macro that is the obverse of SNPRINT - instead of retaining the first x characters of a string, I want to remove the first x characters and keep the rest. (Basically I want to automate switching out the modder prefix for a different one.)

 

In a patch context, this will take the file name sppr101/spwi101 and set the new_res variable to abcd101:

  INNER_PATCH_SAVE new_res ~%SOURCE_RES%~ BEGIN
    REPLACE_TEXTUALLY ~^[Ss][Pp][WwPp][IiRr]~ ~abcd~
  END

In an action context, it's the same syntax except with OUTER_INNER_PATCH_SAVE.


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.


#48 Grammarsalad

Grammarsalad
  • Modders
  • 445 posts
  • Gender:Male

Posted 07 August 2017 - 08:02 PM

 

Oh, this is great! Any chance for a 'shawdowed' option (i.e. like shades or shadow monsters in iwdee)?

Eh, didn't expect such a response to a relatively simple function.  Is nobody interested in my erase-journal-o-matic for BGT? :-)

 

And yeah, writing variants should not be too hard, if I'd know what makes a monster a shade or shadow.  Here's a variant that makes the monster illusionary.

 

Spoiler

 

 

 

Oh, I love all of these!  I just have a specific issue that this will help with.  Basically, I have some bugs with a couple of summoning spells.  I think the issue has something to do with imported animations.  I'm just going to convert existing creatures, and this'll help.  It's great timing.  

 

I had to look up what made a creature 'shadow-like'.  I think the only thing required is that the creature has TRANS60.ITM equipped (I'm pretty sure).  That's easy enough for me to add, though.  Thanks...

 

Edit: as for illusionary creatures, I'll probably use it just because it's right there!


Edited by Grammarsalad, 07 August 2017 - 08:17 PM.


#49 K4thos

K4thos
  • Modders
  • 1057 posts
  • Gender:Male

Posted 24 August 2017 - 12:55 AM

Action macro that generates JOINABLE_NPC_ARRAY table which can be used to patch joinable NPC CRE files (more reliable method than checking CRE BIO offset)

https://github.com/K...e_npc_array.tpa
Example usage:

LAM JOINABLE_NPC_ARRAY
ACTION_PHP_EACH JOINABLE_NPC_ARRAY AS cre => dv BEGIN
    PRINT ~%cre% => %dv%~ 
    COPY_EXISTING ~%cre%~ ~override~
    //your patching code
END


#50 Sam.

Sam.
  • Modders
  • 117 posts
  • Gender:Male
  • Location:USA

Posted 05 October 2017 - 02:50 PM

It hasn't been extensively tested yet, but here is a function library to do stuff with tilesets:

PS_Tileset

Note that if you want to add bitmap tiles to a PVRz-based tileset, you will need to run Tile2EE to convert it to a palette-based tileset first, then convert it back.

 

 

ps_tileset_lib ps_tileset_repair_header
Repairs a couple of errors in tileset headers:  missing header and wrong version number
ps_tileset_remove_tiles
Removes tiles from a tileset
ps_tileset_add_tiles
Adds or replaces tiles in a tileset
ps_tileset_create_tileset
Creates a tileset from a number of tiles
ps_tileset_export_tiles
Exports tiles from a tileset
ps_tileset_info
Gathers and reports basic or verbose information from a tileset
ps_tileset_replace_palette_entry
Replaces palette entries in a tile with a new color
ps_tileset_recolor_pixel
Recolors a pixel in a tile without changing the color of every pixel using the same palette entry
ps_zlib_compress
Z-lib compresses a file
ps_zlib_decompress
Z-lib decompresses a file

Edited by Sam., 05 October 2017 - 02:53 PM.

"Ok, I've just about had my FILL of riddle asking, quest assigning, insult throwing, pun hurling, hostage taking, iron mongering, smart-arsed fools, freaks, and felons that continually test my will, mettle, strength, intelligence, and most of all, patience! If you've got a straight answer ANYWHERE in that bent little head of yours, I want to hear it pretty damn quick or I'm going to take a large blunt object roughly the size of Elminster AND his hat, and stuff it lengthwise into a crevice of your being so seldom seen that even the denizens of the nine hells themselves wouldn't touch it with a twenty-foot rusty halberd! Have I MADE myself perfectly CLEAR?!"

-- to Portalbendarwinden

--------------------

Posted Image
___________Old pen and paper modules of the 70s and 80s.___________

CA Forums CA Homepage


#51 argent77

argent77
  • Modders
  • 722 posts
  • Gender:Male

Posted 15 October 2017 - 11:29 AM

This is a patch function that can be used to add multiple effects to items or spells without much effort. It uses a simple syntax with short keywords to keep effect definitions plain and simple. I'm currently using it to dynamically add many game dependent effects to spells.

The function code:

Spoiler

Example (adds fully configured effects "Display String" and "Play Visual Effect" to a spell):

COPY ~%MOD_FOLDER%/spells/myspell.spl~ ~override~
  LPF a7_auto_apply_spl_effect
  INT_VAR
    // some predefined parameters for all effects
    def_target        = 2   // Preset target
    def_savetype      = 1   // Save vs. Spell
    def_savebonus     = "-2"
  STR_VAR
    function_name = ~ADD_SPELL_EFFECT~
    effect_codes  = ~op=139,tmg=1,p1=8203;op=215,tmg=1,dur=2,p2=1,res=ICARMOR~
  END


#52 CamDawg

CamDawg

    Seven billion ton robot monster

  • Gibberling Poobah
  • 9239 posts
  • Gender:Not Telling

Posted 15 October 2017 - 07:26 PM

Background: if you look at a spell with save-for-half-damage like fireball, you'll note that at the seventh-level fireball has two damage opcodes--one does 4d6 fire damage with no save, and second one does 3d6 fire damage but can be negated outright with a save. The upshot is 7d6 damage that is not-quite-halved to 4d6 on a successful save. More egregious examples of poorly-split damage exist, e.g. Storm of Vengeance splits its listed 1d6s as 2d3s; Burning Hands splits its 1d3 as 2d2. EE adds a new flag to the damage opcode (bit 8 in the special field) that allows the engine to do this calculation without having to force two damage opcodes and allowing true save-for-half damage.

 

We're finally getting around to using this in the EEs. CD_DOUBLE_DAMAGE is a macro designed to find these double damage opcodes in items and spells and combine them into one using this new flag. It's not a particularly smart algorithm, as it will find the first damage opcode matching its parameters on a given ability and then try to merge it with any other matching damage opcode that is within a die roll and within one point of the static damage field. You could add spells or items in your mod with the traditional damage splits and then run this macro on them if an EE is detected.

 

Fireball is easy because it just has the pair of damage opcodes on every header. Something like Earthquake, with its three pairs of damage over time, would require this to be run three times

 

Spoiler


I came here with a simple dream: a dream of killing all humans. And this is how it must end? Who's the real seven billion ton robot monster here? Not I. Not... I.




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users