Magic Weapon

Discussion in 'Negative Energy Plane' started by Chris Woods, Sep 28, 2003.

Remove all ads!
  1. Chris Woods

    Chris Woods Member

    Joined:
    Sep 25, 2003
    Messages:
    48
    Likes Received:
    0
    This spell, along with Magic Vestiment and Greater Magic Weapon, are of a personal need for me because they're my favorite spells in DnD and the permancy side-effect keeps me from using them because they're so powerful.

    I've spent a good amount of time working on them only to come to a dead end, so I'm posting all my information here in homes that someone else might have some better ideas.

    For the purposes of thisdiscussion, the duration of the spell will assumed to be 10 rounds.

    Problem stems from the condition_add_with_args method used to attach the spell to a wepon (as seen in src/spell292 - Magic Weapon.py)

    This method does not remove the effect when the duration reaches zero. The "Spell End" message is getting sent, ans the "magic weapon over" spell sound does get played, but the item retains it's bonus because the condition_add_with_args method doesn't clean up after itself.

    After woking with ToEE.exe for some time, I determined that condition_add_with_args was broken into two seperate methods, add_with_args and condition_add. I do not know the formal parameters neede to use these methods.

    When I use add_with_args the result is both good and bad:

    Good: The duration of Magic Weapon is listed as a tab on my Character portrait (10/10 Rounds) and counts down to zero.
    Good: When the duration reaches zero, the spell expires.

    Bad: The weapon isn't +1
    Bad: If I unequip and reequip the weapon, the duration resets to 10.

    When I use condition_add, the weapon is made +1 but it doesn't "glow blue". Finally, the spell is again permamnt.

    If I try to remove the conditon in SpellCastEnd, the game crashes when the duration expires.

    There is one thing I don't know that I feel may be critical in fixing this and other similar spells. The nominclature of condition_add_with_args is as follows:

    condition_add_with_args( [EFFECT ID], [SPELL ID], [SPELL DURATION], 0 )

    I have no clue what the "0" is for.

    I am under the impression that condition_add_with_args is improperly implemented in Toee.exe, which would indicate that it is impossible to fix this without an official patch from Troika. This problem would extend to Spiked Growth, all Magic Weapon/Armor spells. Unless there is something I've missed, we would be out of luck.

    Ideas?

    Chris Woods
     
  2. Nomad_Wanderer

    Nomad_Wanderer Established Member Veteran

    Joined:
    Sep 25, 2003
    Messages:
    305
    Likes Received:
    0
    I just logged your earlier comment about this in the comprehensive bug list.. :)

    Hopefully Huy get in touch with us and we can get some comments..
     
  3. Chris Woods

    Chris Woods Member

    Joined:
    Sep 25, 2003
    Messages:
    48
    Likes Received:
    0
    A feasiable (but painful) workaround might be as follows:

    OnSpellCast:

    Check the ID of the item against protos.tab. If the item has the "OIF_MAGICAL" property, the spell fails.

    The item is then removed from the caters inventory

    A new +1 version of the item is insereted into the casters inventory.

    OnSpellCastEnd:

    The +1 version is removed from the inventory

    The normal version is placed in the inventory.


    This would be painful because someone would have to make "if" clauses for every item. (if item.id == 4220 then remove 4220 and add 4221).....

    But it would work at least, in theory.

    Chris Woods
     
  4. Nomad_Wanderer

    Nomad_Wanderer Established Member Veteran

    Joined:
    Sep 25, 2003
    Messages:
    305
    Likes Received:
    0
    Yeah, That would work...But that's not painful, That's very painful... This is one of those, "well, technically you could do that..But do you really want to" questions... I wonder how long it would take the game to fall through all those if's.....

    IMO, (which really don't count fer much)..Lets hear back from huy before starting an endeavor like that.. You had a huge day today.. Would rather see you hand over another zip like the last one rather than a shaky implementation like you mention above..
     
  5. Akira4332

    Akira4332 Member

    Joined:
    Sep 27, 2003
    Messages:
    2
    Likes Received:
    0
    couldn't you just add a command that adds -1 to the weapon at the end of the spell? then even if it gets a permanent +1, the -1 added at end would cancel it out.
     
  6. Chris Woods

    Chris Woods Member

    Joined:
    Sep 25, 2003
    Messages:
    48
    Likes Received:
    0
    This is a very bright idea.

    Unfortunatly, it has a side effect.

    While the item works right, clicking on the d20 for a hit results in the following:

    +1 Class
    +1 (magic weapon)
    -1 (magic weapon)
    +1 (magic weapon)
    -1 (magic weapon)
    +1 (magic weapon)

    after the third cast. Too many casts, and it crashes, not to mention the preformance hit of having spells stay on characters forever. (Every time you cast it, thats two more spells that will be processed, every frame, until the end of the game.)

    Chris Woods
     
  7. DrPraetorious

    DrPraetorious Member

    Joined:
    Sep 28, 2003
    Messages:
    3
    Likes Received:
    0
    Assuming that all of the weapons and their plus one versions are one step apart. First, sit down at a real computer, then type:

    awk 'BEGIN{for (i = ###; i < ###; i+= ###)
    print "(if item.id == " i " then remove " i " and add " i+1 ")";}'

    Substitute the actual range of IDs and seperation between IDs for the ###.

    Now, take the output from that awk command and paste it into whatever code you dudes are editing - I just arrived on this board and I have no idea what is going on. Of course, depending on how their scripting language works 300-some compares might also be a performance hit.

    Also - would this work for arrows? After shooting 30 magic arrows would I get them back as regular arrows (not that I care.)
     
  8. Nomad_Wanderer

    Nomad_Wanderer Established Member Veteran

    Joined:
    Sep 25, 2003
    Messages:
    305
    Likes Received:
    0
    nice *nix joke. :)

    I was going to suggest awk for another problem then decide nah.. Probably not good idea. (they're probably sed fans).
     
Our Host!