Jump to content

ADD_CRE_EFFECT - Visual Effects


JediMindTrix

Recommended Posts

Hello!

 

Just curious if someone would be willing to show me a quick example of how this would be written in Weidu? Also, I saw a post from 2012 stating that this depends on a GAME_IS check and that it doesn't function on BG:EE. Is this still true (I think unlikely, but have to be sure!).

 

Currently what I have is:

 

 

LPF ADD_CRE_EFFECT INT_VAR opcode: 215 target = 0 parameter 1 = 0 parameter 2 = 1 timing = 9 restype = sourceslot = AMYAG_A END

 

I'm not sure if I need to define restype or what I should define it is (so it's left blank for now), and unsure if I formatted the AMYAG_A correctly.

 

Cheers!

Link to comment

This all is shown in the weidu readme ADD_CRE_EFFECT section, it's under the Macro listings.
If as said you wish to not define the restype, you just remove it and the is sign( = ) from the row, and the opcode has to have the same marker, not the ":" . So it becomes:

LPF ADD_CRE_EFFECT INT_VAR opcode = 215 target = 0 parameter 1 = 0 parameter 2 = 1 timing = 9 sourceslot = AMYAG_A END

So try that.

Or if it bothers you, you can add a few line ends:

LPF 
ADD_CRE_EFFECT 
  INT_VAR 
opcode = 215 
target = 0 
parameter 1 = 0 
parameter 2 = 1 
timing = 9 
sourceslot = AMYAG_A 
END 
Link to comment

I need to take back a few of my words... but it's unlikely that you need to declair either of: the restype or the sourceslot.

 

The default zero is the .eff's offset at 0x0090 address, which by default is NONE. And the sourceslot, aka the value at offset 0x0094 is likely to be set to a default of -1. Now of course if the effect comes from either of the other, you would change both, but I am not sure you need to worry about that as the effect would be reapplied after it's casted from such a source.

AKA, the ADD_CRE_EFFECT is likely to be applied when the parrents resource type is zero, as it's easier to apply the whole spell if it's the spell with the ADD_CRE_SPELL, or if it's an item, then just carrying it should apply the spell and the if the AI keeps it equipped. Or I could be totally oofffffffff. :undecided:

 

What are you by the way trying to archive here ?

Link to comment

It's confusing because I misread the Weidu Documentation and tried using the wrong field lol.

 

Next question:

How do I find the extended header of a spell effect using near infinity?

 

Specifically this part:

ADD_SPELL_EFFECT: adds an extended effect to a spell. All variables except probability1 and insert_point are 0 by default. This is a PATCH macro and function.

SET header to number of extended header (starting from 1) the effect should be added to (by default the effect is added to every header).
Link to comment

You want to add an effect to a spell, and have it repeat through the various iterations of the spell that get cast at different levels?

 

Then, instead of counting headers and bits in hexadecimal and using ADD_SPELL_EFFECT, I would just use CLONE_EFFECT (find an effect that already exists in the spell, clone it, and then change the clone to your effect.)

 

http://gibberlings3.net/forums/index.php?showtopic=27496&do=findComment&comment=237470

Link to comment

You want to add an effect to a spell, and have it repeat through the various iterations of the spell that get cast at different levels?

 

Then, instead of counting headers and bits in hexadecimal and using ADD_SPELL_EFFECT, I would just use CLONE_EFFECT (find an effect that already exists in the spell, clone it, and then change the clone to your effect.)

 

http://gibberlings3.net/forums/index.php?showtopic=27496&do=findComment&comment=237470

 

That willprove useful at another point, but the instances I am dealing with now are innate and creature abilities that only have one level.

Link to comment

Then why do you need to count headers? In any event CLONE_EFFECT still works great in this instance.

 

What exactly are you trying to do?

 

EDIT - just re-read your question and I might have misinterpreted it. I think the short answer is, for a basic spell or innate with one 'ability' and then few effects within the ability (eg hold person + display "held" symbol + display text "held") then I think the extended header is that 'ability.' I'm pretty sure you can just ignore the "header" part of the patch macro. Leave it blank and the macro will do the work for you.

Link to comment

Then why do you need to count headers? In any event CLONE_EFFECT still works great in this instance.

 

What exactly are you trying to do?

 

Hrm, because I read somewhere that ADD_SPELL_EFFECT required all fields to be filled in order for it to function; I'm trying to convert a .spl in override format to use WeidU's patching.

Link to comment

How do I find the extended header of a spell effect using near infinity?

I am not exactly sure what you are looking for so I'll add my answer to what SD has to say...

The amount of how many extended header there are in the .spl file is set in the .spl files:

0x0064 4 (dword) Extended Header offset 0x0068 2 (word) Extended Header count

You can go through them by reading the content of those offsets and counting the bits. It's not used in the ADD_/CLONE_ -functions, but in moding the .spl file itself...

 

Hrm, because I read somewhere that ADD_SPELL_EFFECT required all fields to be filled in order for it to function;

But unless someone else already messes up the file, you don't need to worry about that ... as the function itself is made to count the Extended Headers placement and add the default amount of bits to the file, and that only works correctly if the file is uncorrupted. I had a mod that made this fault and well it had very unfun results as I didn't have the correct bit count nor the CLONE_/ADD_ -functions weren't invented yet, and the mod itself wasn't mine originally. Eventually I fixed it as with the help of others.

You do not wish to support those mods. The reason being that it's kinda impossible, as you would have to use recression and find the faulty bit, by first reading the lenght of the file, then then use magic to divine it's original intention, and then fix it.

Link to comment

I read somewhere that ADD_SPELL_EFFECT required all fields to be filled in order for it to function;

That's possible. To paraphrase a wise man, ADD_SPELL_EFFECT is old and busted; CLONE_EFFECT is the new hotness.

 

Want to add a 10 point Lore bonus to the Luck spell? No problem:

COPY_EXISTING ~spwi209.spl~ ~override~
   LPF CLONE_EFFECT INT_VAR match_opcode = 22 opcode = 21 parameter1 = 10 parameter2 = 0 END
...More or less, anyway
Link to comment

I'm not following what anyone is saying, honestly.

 

I am trying to write some WeidU code to patch the original file (top) to match the override file (bottom) (except in this case, the override is missing a charm effect that I intend to not patch out of the original file.)

 

This is the code I have so far:

 

COPY_EXISTING ~DEMOCHM.SPL~ ~override~
DELETE_SPELL_EFFECT //177
INT_VAR
opcode_to_delete = 177
END
 
ADD_SPELL_EFFECT
INT_VAR
opcode = 177
target = 2
power = 0
timing = 4
parameter1 = 5
parameter2 = 160
power = 0
resist_dispel = 2
duration = 1
probability1 = 100
probability2 = 0
dicenumber = 0
dicesize = 0
savingthrow = 0
savebonus = 0
header =
insert_point = 7
resource = POOL1a10

 

My only missing field is the header. I'm not sure exactly how to 'count bits', though a link to a tutorial would probably suffice unless there's a fairly simple explanation- and that clone script example looks unwieldy and rather massive for what I need to do.

Link to comment

 

 

That's possible. To paraphrase a wise man, ADD_SPELL_EFFECT is old and busted; CLONE_EFFECT is the new hotness.

 

Want to add a 10 point Lore bonus to the Luck spell? No problem:

COPY_EXISTING ~spwi209.spl~ ~override~
   LPF CLONE_EFFECT INT_VAR match_opcode = 22 opcode = 21 parameter1 = 10 parameter2 = 0 END

 

 

This is signficantly more helpful,

Link to comment

Try this:

 

COPY_EXISTING ~demochm.spl~ ~override~
LPF DELETE_EFFECT INT_VAR match_opcode = 177 END

COPY_EXISTING ~demochm.spl~ ~override~
LPF CLONE_EFFECT INT_VAR match_opcode = 142 opcode = 177 parameter1 = 5 patameter2 = 160 STR_VAR resource = blah END
...where "blah.eff" is the name of the .eff file referenced by your 177 effect (don't include the .eff extension in the patch function, just the name of the file).

 

AFAIK, DELETE_SPELL_EFFECT is also old and busted, though it may still work fine in this case.

 

DELETE_EFFECT, ALTER_EFFECT, and CLONE_EFFECT were written by CamDawg, I believe, and added to Weidu about a year ago. They work great on .CREs, .ITMs, and .SPLs. For this kind of patching work, they have become my holy trinity of patch functions.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...