Sign in to follow this  
corpsecotillion

Scripts contingent upon an item being equipped/DS quest mod help

Recommended Posts

So I was in the middle of making a unique saber with special properties that drops from Darth Bandon when I had the thought that I'd negate the Solari crystal properties since Bandon is a dark sided individual and essentially, his saber would "suck" the goodness out of anything it touches.

 

Which got me thinking.

 

Is it possible to run scripts based on whether or not you have an item equipped? For example, you can only use stealth if you have a stealth field generator belt (or equivalent) equipped.

 

Basically, I'm looking to make a mod that sets your PC down a path of corruption. You'll find a seemingly normal lightsaber that, while equipped, has you use a different table than the one in the Adjust Character Alignment section of k_inc_utility so you gain dark side points at 1.5-2 times the rate of normal.

 

How difficult would it be to take this a step further and add additional conversation options based upon the saber being equipped? A lot of the options in K1 and TSL are rather cut-and-dry as to what's the light side and what's dark side. I'd like to add options that don't necessarily jump out as the DARK!! choices but add to slowly turning your PC evil.

 

Also, my knowledge of scripting is kind of basic. I can look at a script and figure out what it does for the most part but I'm not an ace at creating things from scratch.

 

TL;DR I wanna make a cursed saber that's gonna be pretty rad property-wise but essentially dooms you to the dark side. I don't know where to begin.

Share this post


Link to post
Share on other sites

I know you can tell use an item in the players inventory. I think you can even check current inventory, but I can't be sure.

 

I used > int StartingConditional()

{
    return GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "resref/goes/here"));
}
to start a conversation requiring the PC to have that item. 
 
That's all I can help you with, don't know how to do the rest.
  • Like 1

Share this post


Link to post
Share on other sites

You can also use GetItemInSlot() to check if the lightsaber is actually equipped:

int StartingConditional(){

return GetItemInSlot(<inventory slot goes here>, GetFirstPC()) == GetObjectByTag("<tag of your lightsaber>")

}

And then probably also add an or condition to check the second hand.

 

For the alignment shifts you can use the same conditions to check for the equiped item or the item being in the inventory and apply them to the corresponding functions. The scripts for that are k_act_darksml, k_act_darkmed and k_act_darkhigh. If you have a look at those, you'll see that they look like this:

#include "k_inc_debug"
#include "k_inc_utility"
void main()
{
    UT_DarkMed(GetPCSpeaker());
}

One possibility would be to add a condition in here that moves the DS hit up one category if you have the item equipped:

#include "k_inc_debug"
#include "k_inc_utility"
void main()
{
  if(GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "<item resref>"))) {
    UT_DarkHigh(GetPCSpeaker());
  }
  else {
    UT_DarkMed(GetPCSpeaker());
  }
}

I used JC's method to check for the item here but you could use mine as well (if it actually works^^). For k_act_darkhigh you'd then have to fire UTDarkHigh and UTDarkSml or something if the item is equiped to get a bigger hit.

 

Or you could directly alter the calculations. To do that you'll need k_inc_utility. The functions like UT_DarkMed are in there but all they do is to call another function called "void UT_AdjustCharacterAlignment(object oTarget, int nScale)". You could edit these calculations, once again using if-conditions to check for your item being equiped, then save your UNCOMPILED k_inc_utility to the Override folder and recompile k_act_darksml, k_act_darkmed and k_act_darkhigh. That would probably be the more elegant solution, but it's up to you.

  • Like 3

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this