WeerW3ir Posted July 1, 2023 Posted July 1, 2023 Because right now i am clueless. My newest follower who i am making is just straightforward refusing to summon the bow. so.. there is my simple script. Scriptname AranaenRanging extends Actor spell property ARAranaenBoundBow auto function OnCombatStateChanged(Actor akTarget, Int aeCombatState) if aeCombatState == 1 ARAranaenBoundBow.Cast(self as objectreference, self as objectreference) endIf endFunction This script working just fine for example with a Bound Sword. ( i have made two npc with that already) But with a bound bow.. she just refusing to use. What do i do wrong?
traison Posted July 1, 2023 Posted July 1, 2023 (edited) 1 hour ago, Weerz said: refusing to summon the bow 1 hour ago, Weerz said: she just refusing to use These are 2 entirely different things, which one is it? I'm fairly certain I've seen thalmor elves summon bows so I'm 99% certain it can be done. Whether this is a vanilla thing or part of some mod I can't say, I have over 500 of them and this is not something I've ever concerned myself with. Whether it can be done with a script or not I don't know. Personally what I'd do is make the npc a spell caster, give them one spell (bound bow), enough mana and skills and hope they figure it out. Anyhow, if we assume the bow doesn't even appear then: Spot the differences between the bound sword and bound bow spells. Cost? Duration? One has a script and the other doesn't? Anything? Normalize it and test again. If we assume the bow does appear but the NPC switches to another weapon immediately: Something tells me doing this in the OnCombatStateChanged event is not a good idea. I wouldn't be surprised if at this point there was AI and packages taking over and overriding everything else. Ever tried getting an NPC to wear a certain piece of armor? Sort of like that. The NPC is set to be a sword user, or has a weapon in their inventory they consider better. The NPC is set to be an archer, but the AI considers this weapon a "spell". Edited July 1, 2023 by traison
WeerW3ir Posted July 1, 2023 Author Posted July 1, 2023 (edited) Quote Personally what I'd do is make the npc a spell caster, give them one spell (bound bow), enough mana and skills and hope they figure it out. Thats what i did. but she just standing there, and grabs her hunter bow, if i take it away, then she just trying to run away from combat, or steals a weapon. 2 hours ago, traison said: If we assume the bow does appear but the NPC switches to another weapon immediately: Something tells me doing this in the OnCombatStateChanged event is not a good idea. I wouldn't be surprised if at this point there was AI and packages taking over and overriding everything else. Ever tried getting an NPC to wear a certain piece of armor? Sort of like that. The NPC is set to be a sword user, or has a weapon in their inventory they consider better. The NPC is set to be an archer, but the AI considers this weapon a "spell". I never make packages to override eachother. a simply Sandbox AI package they have. Her CombatStyle is and so far it was working for my other followers who have used bound weapons. She does not have any other weapon, just food and potion in her inventory. and her spells and stats are simply Edited July 1, 2023 by Weerz
traison Posted July 1, 2023 Posted July 1, 2023 (edited) Hm, alright. I'll see if I can make an NPC use the bound bow. Edited July 1, 2023 by traison
WeerW3ir Posted July 1, 2023 Author Posted July 1, 2023 (edited) okay. great news. i do managed to make her use the bound bow. she does using it, bad news is. she instead of actually shooting arrows in the enemy. trying to fistfight the enemy from far away lol.. now what? (yes her head is not exported out correctly, still not finished, first wanted the main part of her, the spell to work) Edited July 1, 2023 by Weerz
traison Posted July 1, 2023 Posted July 1, 2023 (edited) I'm sort of seeing the same thing. NPC doesn't do anything with the bound bow spell, doesn't even equip it. Given the bound sword spell they cast it but the sword never appears (or they immediately switch to the spell again, canceling the sword). There's a lot of tweaking to do here though. This is with the CombatMageConjurer class and 500 mana. Edited July 1, 2023 by traison
Miauzi Posted July 1, 2023 Posted July 1, 2023 It is a typical Skyrim mechanic - that companions are automatically equipped with the standard hunting bow - if they do not have another bow IN inventory. A bound bow is NOT in the inventory - ergo this mechanic kicks in. You can take this hunting bow away from the companion ... then she has nothing for ranged combat. If she has no melee weapon either -> automatic change to melee. So the problem is something rather basic ... a deeply woven mechanic that provides EVERY companion with a ranged weapon. By the way - if you take the bow away from the companion ... after a few ingame days the mechanic has "reset" itself ... and puts the hunting bow back into the inventory - as long as there is no ranged weapon. Yes - you can stop this somehow - but please don't ask me how ... this is several levels above "my pay grade".
traison Posted July 1, 2023 Posted July 1, 2023 (edited) I got the bound sword working by switching from the BoundSword spell to the BoundSwordLeftHand spell. I'll apply the same logic to the bound bow and test again. Edit: I get a feeling there's something hardcoded in the AI to prevent it from using 2 handed bound weapons. They use the bound sword just fine but simply swapping out the MGEF of that spell to one that would spawn the bow prevents the AI from using it - so it's not simply a form check limitation on the SPEL, its something more specific. Edit again: and I guess just to prove a point, simply swapping the spawned weapon to the BoundWeaponSwordRightHand allows the AI to use my custom SPEL BoundBowLeftHand, except it obviously spawns the sword and not the bow. Also, the BoundBowEffectScript does interfere a bit: it made the sword invisible, and the arrows appeared for a frame before disappearing. I think what I remember seeing the elves use was actually the bound sword, not the bound bow. This is a vanilla feature, as many of the thalmor melee npcs have been set to use SPEL BoundSwordLeftHand. I'll continue messing with this for a bit but right now its not looking good. Edited July 1, 2023 by traison
traison Posted July 1, 2023 Posted July 1, 2023 (edited) Oh, nevermind, I got it to work (without scripts). Sending esp in a bit for you to analyze. Edit: Here you go, I think the key was adding the bound arrows to the NPC's inventory and removing the script from the bound bow MGEF. The script normally adds the arrows, so you'll have to find another way to replenish them. I'm sure you can figure that one out. weerz.esp Edited July 1, 2023 by traison
WeerW3ir Posted July 1, 2023 Author Posted July 1, 2023 (edited) Miauzi: Quote It is a typical Skyrim mechanic - that companions are automatically equipped with the standard hunting bow - if they do not have another bow IN inventory. It is a folower quest script. All follower have it sadly. except if you make an uniquely scripted one. which does not count into the normal followers. Its too much hassle if you ask me. >:D traison: Quote I got the bound sword working by switching from the BoundSword spell to the BoundSwordLeftHand spell. I'll apply the same logic to the bound bow and test again. Yes, i know this sadly. i do have learned it on my own hand with Sun-Xu. He is having two bound sword at once. by normal way he couldnt use them when i tried. the only way was actually make a left handed and a right handed sword spell and make him spawn them in at once. and one for the player in the spellbook which is eitherhand, (since whenever i add an unique spell for my followers, i let you learn it as spellbook) This is why i mentioned. bound sword is not a problem. but the bow? that i do not get. Somehow i did a crazy thing, and set from eitherhand to onehand. game crashed when i tried to use the spell on my own, so then i have set it back as eitherhand and now its works. but.. well. she is punching the air as you seen on the pic. i take a look at your file. edit:Y es. i see. but it not working ? Edited July 1, 2023 by Weerz
traison Posted July 2, 2023 Posted July 2, 2023 5 hours ago, Weerz said: but it not working Issue is on your side unfortunately: Spoiler
WeerW3ir Posted July 2, 2023 Author Posted July 2, 2023 13 hours ago, traison said: Issue is on your side unfortunately: Reveal hidden contents I dont get it. i literally have made a 2nd spell. only one handed. now she just trying to respawn it over and over again. if i go back to the normal eitherhanded. she just still trying to fist fight from far away. like she dont know how to use a bow.
traison Posted July 2, 2023 Posted July 2, 2023 (edited) There's more than the spell going on here: Combat style. Class. Packages, or lack of. Arrows in inventory, not added by script. Follower frameworks, my npc was not a follower at the time of testing. If all else fails test with my npc. If my npc doesn't work in your game we got some external factors interfering. Edit and maybe give her an outfit first as I apparently forgot to ? Edited July 2, 2023 by traison 1
WeerW3ir Posted July 3, 2023 Author Posted July 3, 2023 (edited) 18 hours ago, traison said: There's more than the spell going on here: Combat style. Class. Packages, or lack of. Arrows in inventory, not added by script. Follower frameworks, my npc was not a follower at the time of testing. If all else fails test with my npc. If my npc doesn't work in your game we got some external factors interfering. Edit and maybe give her an outfit first as I apparently forgot to ? I have loaded up an old save without addons. i had remake her ai, her combat style. made her use the original boundbow. she still just runs away ? Edited July 3, 2023 by Weerz
Alunder Posted January 13, 2024 Posted January 13, 2024 This is my script to make an NPC use an bound Weapon randomly, being 'OnHit' the process, so it will be activated when the NPC is attacked and when your magic is below a configurable percentage, in my case I configured 5%. Considering that the NPC has affinity with: 'Combat Style' and 'Class'. It will be necessary to create a Magic Effect and configure the properties to link this script and add to the NPC... process similar to PerkAvoidDeath. I am sharing this script openly, so that everyone can enjoy it, but if someone uses it commercially do not forget to credit the source... Scriptname HEBoundWeaponScript extends ActiveMagicEffect ; Obs. NPCs are not able to cast magical weapons, if a conjuration is done the npc will not be able to attack, so the sword will be stuck in your hand. ; Solution: Do not force a conjuration, but add and equip the weapon during the utility time. 'abPreventRemoval' is necessary to prevent the NPC to remove the weapon when attacked. Ammo Property boundArrow Auto Float Property PercentageMagickaThreshold Auto Weapon Property BoundWeaponBow Auto Weapon Property BoundWeaponSword Auto Weapon Property BoundWeaponBattleaxe Auto Weapon Property DLC2BoundWeaponDagger Auto bool abPreventRemoval = false Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked ) ; make sure the script effect should be applied. if !(abPreventRemoval) ; get the current magic values of the actor. float currentMagicka = GetTargetActor().GetActorValue("Magicka") ; 'GetActorValueMax' suitable for calculating the correct percentage of buff/strengthening attributes. float maxMagicka = GetTargetActor().GetActorValueMax("Magicka") ; get the current magic percentage values of the actor. float currentMagickaPercentage = (currentMagicka / maxMagicka) * 100.0 ; condition to distribute a weapon randomly to the actor with a chance of 25%. int RandomWeapon = Utility.RandomInt(1, 4) ; conditions of the actor's magic percentage to equip the weapon. if currentMagickaPercentage < PercentageMagickaThreshold ; condition 1 of 4 (25%) to equip a weapon randomly. if RandomWeapon == 1 ; add the weapons to the actor. GetTargetActor().AddItem(boundArrow) GetTargetActor().AddItem(BoundWeaponBow) ; equip the weapons in the actor. GetTargetActor().EquipItem(boundArrow) GetTargetActor().EquipItem(BoundWeaponBow) ; prevents the actor from removing the weapons. abPreventRemoval = true ; waiting time to consecutively remove the actor's weapons. obs. Put the same time as spells. utility.wait(180) GetTargetActor().RemoveItem(BoundWeaponBow) GetTargetActor().RemoveItem(boundArrow) ; returns the default configuration to allow the actor to remove his weapons. abPreventRemoval = false elseif RandomWeapon == 2 GetTargetActor().AddItem(BoundWeaponSword) GetTargetActor().EquipItem(BoundWeaponSword) abPreventRemoval = true utility.wait(180) GetTargetActor().RemoveItem(BoundWeaponSword) abPreventRemoval = false elseif RandomWeapon == 3 GetTargetActor().AddItem(BoundWeaponBattleaxe) GetTargetActor().EquipItem(BoundWeaponBattleaxe) abPreventRemoval = true utility.wait(180) GetTargetActor().RemoveItem(BoundWeaponBattleaxe) abPreventRemoval = false else GetTargetActor().AddItem(DLC2BoundWeaponDagger) GetTargetActor().EquipItem(DLC2BoundWeaponDagger) abPreventRemoval = true utility.wait(180) GetTargetActor().RemoveItem(DLC2BoundWeaponDagger) abPreventRemoval = false endif endif endif EndEvent
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now