Temple+ Modding Question

Discussion in 'General Modification' started by _doug_, Feb 21, 2018.

Remove all ads!
  1. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,202
    Likes Received:
    296
    Hmmm, it's a bit strange because you applied the condition to the item rather than wielder.

    Another missing detail: did you do d20 status init on the item as part of thr spell script?
     
  2. dolio

    dolio Established Member

    Joined:
    May 30, 2005
    Messages:
    244
    Likes Received:
    43
    Conditions added as `item_condition_add` get the wielder as the attachee in callbacks.
    Conditions added as `condition_add` get the object as the attachee.

    And yeah, if you don't do `d20_status_init` before `condition_add`, it won't work on the object.
     
  3. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    181
    Likes Received:
    37
    Yes I did. Though I found no difference in using item_conditon_add with and without d20_status_init(), only with the "normal" condition_add it did matter.

    When you pass the item to another character the attachee printout will change to the new character, which led me to the assumption, that attachee reads the parent?

    Sonic Weapon Debug Print.jpg

    I actually tried the following in the game console as well:
    partyMember1 = game.party[0]
    partyMember1.inventory_item(203)
    and this returns also OBJ_HANDLE_NULL (as well as 0, 3, 4, 204). The character actually has an item in inventory space 1, which led me believe I simply use inventory_item with an incorrect syntax.

    EDIT: AH @dolio beat me with the first part, yes this is exactly the behaviour I experience. Which is no problem, as long as I get inventory_item to work, which I apparently do not atm :(
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,202
    Likes Received:
    296
    Hmm, apparently inventory_item only reaches up to 199. Not sure why, perhaps I had intended it to strictly access non-worn (i.e. backpack) items. I guess it could be changed without causing any harm, it's currently only used in a few scripts and none of them go crazy with it.
     
    Sagenlicht likes this.
  5. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,202
    Likes Received:
    296
    About the removal: the crux of it is that Remove callback should hooked to 'sp-Sonic Weapon' rather than 'Weapon Sonic'. As dolio said, when done that way you don't have to fetch the item from inventory index at all, since it's just the attachee (and as he said, you can apply the condition to the spell target's main hand weapon inside the spell script).
     
  6. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,202
    Likes Received:
    296
    BTW, note about d20_status_init: normally items do not have 'dispatchers' at all. This is initialized via d20_status_init, which allows them to respond to various dispatcher events. In particular, Begin Round events. This also adds them to the dynamic object registry - which is responsible for sending out Begin Round events to all dynamic objects.
    Without this they would neither be able to process Begin Round events, nor receive them in the first place.
     
  7. Sagenlicht

    Sagenlicht Established Member

    Joined:
    Apr 14, 2004
    Messages:
    181
    Likes Received:
    37
    Ok,I will switch to @dolio s approach. Thank you Sitra and Dolio for helping me out :)
     
  8. Kriegdoom

    Kriegdoom Member

    Joined:
    Jun 7, 2016
    Messages:
    39
    Likes Received:
    17
    thank you Sagenlicht for picking up the torch along with Anatoliy and others. Circle of Ten?
     
    anatoliy likes this.
Our Host!