Skip to content

Item Property Help

I'm just trying to make some healing berries, but am having trouble getting it to work out right.
I've assigned unique item properties (self only) to the berries. That's about as far as I've got right now.
I know you have to edit the OnItemActivated scripts but am at a loss.

Could someone help walk me through the latter parts of the rigmarole? :)

Comments

  • ForSeriousForSerious Member Posts: 446
    edited June 2021
    There are two main ways to do it: Check the tag of the item being activated and apply the code in OnItemActivated, or just have OnItemActivated execute the script with the name of the tag that was activated.
    For example here's my whole OnItemActivated script:
    void main()
    {
        object oItem = GetItemActivated();
        object oPC = GetItemActivator();
        if(GetIsObjectValid(oItem))
        {
            ExecuteScript(GetTag(oItem), oPC);
        }
    }
    
    If you share what your OnItemActivated script already looks like, that could help us point you witch way to go.
  • ZephiriusZephirius Member Posts: 411
    Hey Serious,

    Code so far.
    object oPC = GetItemActivator();
        
        if(GetIsObjectValid(oItem))
        {
      
            string sTag = GetTag(oItem);
       
        if(sTag == "GOODBERRY_KIT")
        {
                ExecuteScript("if_goodberry", oPC);
           }
        }
    
    }
    

    Question. When we use the command "Execute script", What script? I don't understand what script or what it does? Anyway, Thanks again.
  • ForSeriousForSerious Member Posts: 446
    edited June 2021
    You make a script and name it if_goodberry.
    this script would look something like:
    void main()
    {
        int iHP = GetCurrentHitPoints();
        SetCurrentHitPoints(OBJECT_SELF, iHP + d10());
    }
    
    You can add visuals and all that.
  • ZephiriusZephirius Member Posts: 411
    Got ya. Wil try this.
  • ZephiriusZephirius Member Posts: 411
    Not sure what's happening. Well nothing is happening. When I use the item she just stretches out her arms then nothing. I checked my tags and spelling but their fine...
  • ForSeriousForSerious Member Posts: 446
    I'm assuming the line object oItem = GetItemActivated(); is just not shown in what you shared, but is there.
    Add a bunch of SendMessageToPC(GetFirstPC(), "Debug message") at each step.
    One right before 'if(sTag == "GOODBERRY_KIT")'
    One right before 'ExecuteScript("if_goodberry", oPC);'
    And one in the if_goodberry script. Of course make the messages unique.
Sign In or Register to comment.