Howdy, Stranger!

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

Categories

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!

Getting the most out of Opcodes 318 and 177(EFFs).

2»

Comments

  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    edited March 2019
    kjeron wrote: »
    It can be patched to check STATE_CONFUSED, just not with those functions.

    How? I mean, apart from checking for STATE_CONFUSED separately (i.e., using 2 additional opcode[#318] just for 'STATE bit_eq STATE_CONFUSED'.....)

  • kjeronkjeron Member Posts: 2,137
    @Luke93 After cloning the effect with value "0x0015602f":
    	READ_LONG 0x64 ab_off
    	READ_SHORT 0x68 ab_num
    	READ_LONG 0x6a fx_off
    	FOR (i = 0; i < ab_num; ++i) BEGIN
    		READ_SHORT (ab_off + i * 0x28 + 0x1e) fx_num
    		READ_SHORT (ab_off + i * 0x28 + 0x20) fx_idx
    		FOR (j = 0; j < fx_num; ++j) BEGIN
    			READ_SHORT	(fx_off + (fx_idx + j) * 0x30)	opcode
    			READ_SHORT	(fx_off + (fx_idx + j) * 0x30 + 0x4)	parameter1
    			PATCH_IF	opcode = 318	AND parameter1 = 0x0015602f BEGIN
    				WRITE_LONG	(fx_off + (fx_idx + j) * 0x30 + 0x4)	0x8015602f
    			END
    		END
    	END
    

    Luke93
  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    @kjeron Minor nitpick:
    READ_SHORT	(fx_off + (fx_idx + j) * 0x30 + 0x4)	parameter1	// Should be READ_LONG...
    

    Anyway, isn't that equivalent to
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	.........
    	parameter1 = 0x8015602f
    	.........
    END
    
    ?

  • kjeronkjeron Member Posts: 2,137
    edited March 2019
    Yes, READ_LONG not SHORT - it was just copied from the opcode READ.
    Luke93 wrote: »
    LPF ADD_SPELL_EFFECT
    INT_VAR
    	.........
    	parameter1 = 0x8015602f
    	.........
    END
    
    ?
    Yes, which is what subtledoctor is currently using, it just can't be done directly with CLONE or ALTER.

  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    kjeron wrote: »
    Yes, which is what subtledoctor is currently using, it just can't be done directly with CLONE or ALTER.

    I see, so ADD_SPELL|ITEM_EFFECT aren't affected by this issue, right? If so, I need to edit my bug report......

  • kjeronkjeron Member Posts: 2,137
    Luke93 wrote: »
    I see, so ADD_SPELL|ITEM_EFFECT aren't affected by this issue, right? If so, I need to edit my bug report......
    Bug report?

  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    edited March 2019
    kjeron wrote: »
    Luke93 wrote: »
    I see, so ADD_SPELL|ITEM_EFFECT aren't affected by this issue, right? If so, I need to edit my bug report......
    Bug report?

    Yes, I created one here.....

    Anyway, as you said, the problem is restricted to CLONE and ALTER (not ADD....)

  • subtledoctorsubtledoctor Member Posts: 11,468
    edited March 2019
    IIRC Camdawg intentionally designed those functions specifically to use "-1" as a default "no change" value... and, when asked about a few years ago, stated a disinclination to change that (it would break LOTS of mods that might not still be maintained). It's not a bug.

    The older functions - ALTER/ADD_SPELL/ITEM_(CF/EQ)EFFECT - are still there, and they can use negative values. The only one that can't be easily replicated is CLONE_EFFECT.

    EDIT - huh, I didn't realize the old ADD_ functions were different from the old ALTER_ functions.

    Post edited by subtledoctor on
  • kjeronkjeron Member Posts: 2,137
    The old ALTER_SPELL_EFFECT and CLONE_SPELL_EFFECT functions document this behavior - it's retained in the new ALTER_EFFECT and CLONE_EFFECT functions, just not documented:
    ALTER_SPELL_EFFECT: patch effects on spells. This is a PATCH function. All integer variables except check_globals, check_headers, header and savebonus default to -1 and negative values result in no change to the corresponding field. The integer variables check_globals and header default to 0. The integer variable check_headers defaults to 1. The integer variable savebonus defaults to -11 and values lower than -10 result in no change to the corresponding field. The string variable resource defaults to the string "same", which results in no change to the corresponding field.

  • kjeronkjeron Member Posts: 2,137
    (it would break LOTS of mods that might not still be maintained).
    Even if it did break old mods, Weidu reloads it's internal functions for every component, so if the new function was released in a *.tpa file, it could be INCLUDED in the ALWAYS block of any mod that wants to use it, and others would still default to the internal function.

    I'm not sure how it would break old mods though - unless they were actually specifying useless negative values in the function call.

  • subtledoctorsubtledoctor Member Posts: 11,468
    Hey, beats me. Maybe it would be fine. I'm just reporting a half-remembered conversation from about 5 years ago...

  • Luke93Luke93 Member, Mobile Tester Posts: 1,312
    kjeron wrote: »
    ...just not documented...

    Will be documented......

  • CirdanCirdan Member Posts: 21
    edited December 2019
    Allow me to petition you all for help in using op code 177. I don't know what i'm doing wrong but I can't get the effect to activate or properly target. the idea is a ring that will unsummon any creatures that the caster has summoned. I've posted a screen shot here of the creature im targeting, the IDS table im referencing, the effect im using, the item effect, and the item itself. send help.

    P.S. I was successful in getting the unsummon effect to work on a single creature and even a group. (not w/ multiple actions) But, I ran into issues that other NPCs would get unsummoned as well, so Im using 177 to specify the targeting even more.

    1bcunafz2hbv.png

  • kjeronkjeron Member Posts: 2,137
    @Cirdan
    There is no mechanic to target only the summons of a specific caster.
    A summoned creature does know who summoned it, up until you save&reload, at which point the information is lost, but any interaction with this knowledge would have to run through the summon's AI scripts.
    Other than that a summoned creature is either an "ALLY" or an "ENEMY", the game doesn't keep track of their ownership any further than that.

    You could target all summons that are allies of the caster by giving the item ability the projectile "INAREAPA" #158.

  • GrammarsaladGrammarsalad Member Posts: 2,510
    edited December 2019
    Cirdan wrote: »
    Allow me to petition you all for help in using op code 177. I don't know what i'm doing wrong but I can't get the effect to activate or properly target. the idea is a ring that will unsummon any creatures that the caster has summoned. I've posted a screen shot here of the creature im targeting, the IDS table im referencing, the effect im using, the item effect, and the item itself. send help.

    P.S. I was successful in getting the unsummon effect to work on a single creature and even a group. (not w/ multiple actions) But, I ran into issues that other NPCs would get unsummoned as well, so Im using 177 to specify the targeting even more.

    1bcunafz2hbv.png

    I have a few non script ideas. My mod knowledge is a bit off, so I hope @kjeron let's me know if I utter an impossibility

    Okay, let's start from the beginning. Sorry, I can't see the screen shots with my dumb phone so I'm not sure exactly what you are trying to do. I have a few interpretations and some ideas that should work for any of them, with suitable modifications. Just in case I'm grossly misinterpreting you, I'll set my cards on the table.

    I'm assuming here that either 1) the ring unsummons creatures summoned by a particular npc (e.g. Jon Irenicus(sp)) Or 2) it unsummons creatures summoned by the wearer of the ring. Another 3) possibility that just occurred to me is that the ring may summon creatures and also allow the user to unsummon those specific creatures (would be pretty useful if the ring summoned a hostile demon, for example). All of these are possible, I think.

    If, so, you could do something like this.

    a) I'm designating "spell A" as the spell that unsummons the creatures (i.e. that will be cast by the ring).

    b) The ring should cast spell A using effect 148 as it's unsummon ability

    c) I'm designating "spell B" as the spell that protects against spell A (using say effect 318)

    d) I'm designating "spell C" as the spell that removes spell B. It needs to be cast using a projectile that covers a large enough area that would affect all creatures just summoned in that area, but not much bigger. See note 2 after step two

    Step one: regexp glob all summoned creatures and apply spell B to them (with timing permanent after death)

    Step two: you need to alter all relevant summoning spells to cast spell C after summoning it's creatures, if and only if the relevant creature casts that spell (hopefully targeting just summoned creatures). The idea here is to remove that protection from Spell A from all creatures the relevant creatures summons just after they summon them (i.e. in the very spell that

    Note 1: This is likely the most tricky step and how to proceed depends on what you want to do. I think that the easiest way to do it would be to create a unique spell state and apply it to that creature (either as an on equip effect of the ring, or by applying it to the specific npc or creature) and then set it( using 326) so that only creatures with the given unique spell state cast the subspell. . It's easier If the ring only unsummons cretures that it summons itself. In that case, you just need to it to cast a 148 that applies spell C after it casts the summoning spell.

    Note 2: a problem with this method is that it will still affect summoned creatures that are nearby when the relevant creatures are summoned. You can protect from this somewhat (e.g. by adding 318 effects protecting enemies or allies of source to the beginning of spell C) but you likely can't protect against it completely. You should also try to be sure that the projectile you choose is only covers enough area to affect your just summoned creatures but not more than that.

Sign In or Register to comment.