Author Topic: Script Assistance  (Read 700 times)

Legacy_Junnest

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +0/-0
Script Assistance
« Reply #15 on: October 05, 2011, 01:13:33 am »


               I checked to see if the OnModuleLoad event had that switch in it, and it looks exactly like that. So I changed the tag of the item to the same name as the OnActivateItem event script name, but I'm having the same result (both in the CEP and non-CEP modules). I remade the items to include the script name as the resref as well as the tag, with no results. I don't doubt this is an issue on my end, though.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Script Assistance
« Reply #16 on: October 05, 2011, 10:31:23 am »


               You want the OnActivateItem module event script to be default if you're using tag based scripts.  You don't need to make a change to that at all.

 When any item activates one of the Cast Spell: Unique Power abilities those scripts will attempt to execute a script with the same name as the items tag.  If the OnActivateItem module script is changed, then it might not necessarily be setting the proper item event switch before the code executes, which would make the script exit when it gets to that check.
               
               

               
            

Legacy_Junnest

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +0/-0
Script Assistance
« Reply #17 on: October 05, 2011, 11:45:14 am »


               Oh yeah, I know what you mean by tag-based scripting now. Or at least I used to know several years ago and now remember. As for the result of this script...

You, sir, are amazing. Thank you for going through all this trouble. It looks just as I would have liked, so it's next to perfect. One thing that is a little strange is that the horse stands around for about 5-10 seconds after the dismount before getting dismissed/destroyed. Is there any way to make that a little quicker if not instant? I doubt there is considering it seems that the delay is caused by the processing of the heartbeat script itself and not an actual scripted delay, I was just wondering is all.

Whether the horse sticks around for a few seconds before disappearing or not, this is exactly what I was looking for and it works great (even dismounts/dismisses automatically when entering a no-mount zone, nice!). A million thanks to you and your patience.
               
               

               


                     Modifié par Junnest, 05 octobre 2011 - 10:45 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Script Assistance
« Reply #18 on: October 05, 2011, 12:56:46 pm »


               I had to put the delay in, to ensure that the horse wasn't destroyed in that 0.5 seconds between when it's created and the player mounts it. I'd considered just having it be a delayed DestroyObject to get around that, but it still would have likely meant a delay of 2-8 seconds before being destroyed on dismount, instead of the 6-12 seconds it is now.

One thing you could do, is add a 2 stage VFX to the dismissal. Something like the ghostly pulse when the variable is initially set, and then an unsummoning effect when it's destroyed. While it would still have the same delay, it would look a little more like it was meant to be that way then.

Edit:  Try this in the mounts HB script.

void main()
{
 if (GetLocalInt (OBJECT_SELF, "UNMOUNTED"))
    {
     ApplyEffectAtLocation (DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_FNF_SMOKE_PUFF), GetLocation (OBJECT_SELF));
     DeleteLocalInt (GetMaster (OBJECT_SELF), "MOUNTED");
     DestroyObject (OBJECT_SELF);
    }
 else
    {
     SetLocalInt (OBJECT_SELF, "UNMOUNTED", TRUE);
     ApplyEffectToObject (DURATION_TYPE_PERMANENT, EffectVisualEffect (VFX_DUR_GHOSTLY_PULSE), OBJECT_SELF);
    }
}
               
               

               


                     Modifié par Failed.Bard, 05 octobre 2011 - 12:03 .
                     
                  


            

Legacy_Junnest

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +0/-0
Script Assistance
« Reply #19 on: October 05, 2011, 03:26:47 pm »


               That looks fantastic. I can't thank you enough for how much you've helped me. I've finished implementing all the mounts into the game and they all work great. It will be a long while before this this releases and I just might open a beta period for those willing to help me with the bugs, but hopefully someday you'll be able to take a look at where your efforts are going if you so happen to be interested.

Until the next scripting issue arrives... farewell and thank you. '<img'>
               
               

               
            

Legacy_Junnest

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +0/-0
Script Assistance
« Reply #20 on: October 19, 2011, 04:51:55 am »


               Back again with a new and much simpler issue (or so I think). I can't manage to forge the simple idea of a quest reward script that gives the PC (and the PC only) 5 gold and 20 experience for every item by the tag "NW_IT_MSMLMISC13" in the PC's inventory. All of those items are then destroyed. Otherwise the PC would have to start up a new conversation to turn in each individual item which is just a hassle for those with large quantities of said item.

The idea is that this item is proof of a kill and the NPC rewards the player per kill. Can anyone help me?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Script Assistance
« Reply #21 on: October 20, 2011, 02:17:03 am »


               There are actually two ways to do this.  One would award the gold and XP for each item, and the other would do a count, and then award based on using that count as a multiplier.

 Since I'm away from home for a few more days still this time, I'll try to find you a link to a script that'd work for you.  I'd just write one, but I can't double check terminology here.
 I'll just edit this post if I find an example.

Edit:  Okay, try this one.  Hopefully I got all the terms right.

void main()

{

 object oPC = GetPCSpeaker();
 int nCounter;

 object oItem = GetFirstItemInInventory (oPC);
 while (GetIsObjectValid (oItem) )
       {
         if (GetTag (oItem) == "NW_IT_MSMLMISC13")
             {
              DestroyObject  (oItem);
              nCounter ++;
             }
         oItem = GetNextItemInInventory(oPC);
        }
 
  if (nCounter > 0)
      {
       GiveXPToCreature (oPC, nCounter * 20);
       GiveGoldToCreature (oPC, nCounter * 5);
      }
}
               
               

               


                     Modifié par Failed.Bard, 20 octobre 2011 - 01:33 .