Radioactivelad Posted July 14, 2014 Share Posted July 14, 2014 I have a perk in mind for a companion I'm creating that has a chance to give the player helpful items like stims and grenades while in combat. I want the chance of receiving the item and the exact item you receive to be influenced by your own character's Charisma and Luck. Ideally it would also proc a vocal response from the companion ("Hey, use this!"). I'm not much good at scripting, and it's certainly more complicated than something like Gannon's perk, so is such a perk even possible, and if it is, how would I go about creating it? Link to comment Share on other sites More sharing options...
devinpatterson Posted July 14, 2014 Share Posted July 14, 2014 It's going to be a judgement on your part as to the "exact item", but lets take for example the stimpacks (or other healing items). You run a quest script (have it check as often as you see fit) using the getHealthPercentage on the playerRef. Figure out what should be the threshold, say 50% (health, more, less?). If health returns at 50 or less <= then fire off the getRandomPercent and compare that to a formula based on Luck and Charisma (say 5% per a point, which means 10 luck and 10 charisma will be 100%). If the random percent is less than the players formula, addItem or check inventory (getItemCount), depending on whether you want the npc to be an eternal source of teh stimpacks or only if they actually have some in inventory. Then your going to make a travel package to teh player (or a use weapon package if you go with the fancier alternative for tossing the time, discussed below). And you'll have to make a "bark" as well as (the "Hey, use this!"). Depending on how closely you want to simulate the throw there's a couple of options. You could just use playGroup for an animation that looks like a throw and add player.additem stimpack 1 to the script. If you want to be fancy(ier), you can replace the model of a grenade or hatchet or other thrown weapon with the stimpack's model and change the stats (ie no boom) to have a object effect of adding 1 stimpack. Remember to have it be effective it will have to do 1 pt of damage, but have a CIOS (cast immediate on self), the base effect associated with a stimpack if you want it to heal the player on impact or player.additem stimpack 1 if you just want it to go into their inventory. Then have the NPC actually throw it you can do a use weapon package or the useWeapon function, either with the player as target. My standard disclaimer; Not a scripting guy, and other peeps may have a more elegant solution. Link to comment Share on other sites More sharing options...
devinpatterson Posted July 14, 2014 Share Posted July 14, 2014 Also I'd suggest, if you don't have any experience with scripting, you might make this a request. It's a little steep (learning curve) if it's your first foray into scripting. Link to comment Share on other sites More sharing options...
Radioactivelad Posted July 14, 2014 Author Share Posted July 14, 2014 Well, I hadn't planned on having an actual throw. I was content to just have the companion call out and add the item to the player's inventory, possibly with a check to make sure the companion and player are within a reasonable distance of one another, like how a lot of npcs "give" items to the Pc. I think I'll look into requesting such a script from someone if possible, thanks. Link to comment Share on other sites More sharing options...
devinpatterson Posted July 14, 2014 Share Posted July 14, 2014 Well, I hadn't planned on having an actual throw. I was content to just have the companion call out and add the item to the player's inventory, possibly with a check to make sure the companion and player are within a reasonable distance of one another, like how a lot of npcs "give" items to the Pc. All that much easier to script. I think I'll look into requesting such a script from someone if possible, thanks. Want me to take a crack at setting it up for you? Link to comment Share on other sites More sharing options...
Radioactivelad Posted July 14, 2014 Author Share Posted July 14, 2014 That'd be great, thanks! Link to comment Share on other sites More sharing options...
kingwilfre16 Posted July 14, 2014 Share Posted July 14, 2014 Well, I hadn't planned on having an actual throw. I was content to just have the companion call out and add the item to the player's inventory, possibly with a check to make sure the companion and player are within a reasonable distance of one another, like how a lot of npcs "give" items to the Pc. I think I'll look into requesting such a script from someone if possible, thanks.sounds like Bioshock Infinite's Elizabeth Link to comment Share on other sites More sharing options...
Recommended Posts