Geeves83 Posted February 4, 2011 Share Posted February 4, 2011 A couple of things I'm having some trouble with. 1. I'm trying to make unarmed and melee combat a more important factor in this game. I'm trying to implement a perk that allows a player to have a random chance to disarm an NPC that he hits, but am having problems scripting. I think I know mostly how it would be implemented (ability perk tied to base effect) and how most of the script would work, as well I can reference the great "More Perks" mod (there's a perk in there that cause you to steal all of an opponents things when you hit them). The only problem I'm having is find a command that references the particular weapon that an npc is holding, then removing it from their inventory and giving it to the player. Does anybody know how I would be able to do this? 2 Also trying to make a way that cause the player to lose fatigue while running, and set it so that when they get below a certain fatigue level, they can only walk. If anyone has any pointers/ideas with either of these it would be great Thanks Link to comment Share on other sites More sharing options...
davidlallen Posted February 4, 2011 Share Posted February 4, 2011 For #1, maybe something involving IsWeaponInList? There are probably already formlists that list all the weapons. You may need to create a new formlist since I doubt you want to disarm weapons like deathclaw claw, boxing gloves, robot builtin weapons, etc. You probably already know about RemoveItem and AddItem for the actual removal and addition. For #2, I am not sure how you can prevent running, but one way is to reduce carrying capacity. If you are over your carrying capacity then you can't run. You could reduce carrying capacity as fatigue increases, so that a character carrying almost nothing could run longer. GetActorValue/SetActorValue should allow you to do this in a gamemode block. Link to comment Share on other sites More sharing options...
Radrunner Posted February 4, 2011 Share Posted February 4, 2011 Not a modder by any stretch... But, when you cripple an arm from repeatedly shooting it, the weapon drops. It doesn't go into your inventory - just flies off like most things do with the physics engine. It might be the direction to look though.. .copy the effect as a 'random chance' when in melee combat, rather than a 100% chance upon limb crippling... Link to comment Share on other sites More sharing options...
Geeves83 Posted February 4, 2011 Author Share Posted February 4, 2011 Hey davidlallen Thanks for the quick response. Yes, for the second one, I was originally thinking of adding invisible heavy item whenever the fatigue level got low, but obviously that idea would be more convoluted.... don't know where my head was on that. Thanks for the suggestion. The problem with the disarming is that I'm trying to get the engine to recognize the specific weapon equipped by the target. I guess that's what I'm looking for, a way to reference the target's weapon so that it returns what actual, specific weapon it is, so it knows what to remove from him and what to add to the player...I guess like looking for a 'getequippedweapon' function that returns the enemy's weapon (type, name and condition....or at least just type and name) that I can then just set to a reference at the start of the script, (like 'removeitem myreference disarmtarget') but I can find no such thing. It sounds like it should be simple...I feel like I'm missing something obvious. Link to comment Share on other sites More sharing options...
rickerhk Posted February 4, 2011 Share Posted February 4, 2011 Even if you have the reference of a target, with vanilla scripting it's a major effort to get the weapon, and if it's a custom weapon from another mod, you can't without compatibility patches. And then it's multiple iterations of isweaponinlist. IMO you are better off considering NVSE functions such as set rWeaponREF to ActorREF.GetEquippedObject 5 Which gets the base object of the weapon no matter what mod it comes from. Link to comment Share on other sites More sharing options...
Geeves83 Posted February 4, 2011 Author Share Posted February 4, 2011 Excellent...that's exactly what I was looking for. I finally found the command in the NVSE function list, but had no idea where to find what number the 'weapon' slot was. Thanks rickerhk, I'll try it out in the next little bit. Link to comment Share on other sites More sharing options...
Recommended Posts