Previous Threads:
Have a quick question? Need a quick answer? If you have not had any luck with the http://www.creationkit.com/Main_Page, post away and hopefully someone will have the answer(s) you seek.
Previous Threads:
This is probably the best approach available without going through the trouble of a SkyProc patch. I think most thoughtful mod authors would have added the bow keyword to their bows, but there may undoubtedly be exceptions that you can't do anything about.
really? the best idea for that who i am trying to do?
do you know how to write it at papyrus script?
Say I want to drop an item and item with an attached script that will return back to the player's inventory. How do I do that since there is not container reference? Do I have the item delete itself then use add item? Will this cause save game bloat?
(New Question) What happens if RemoveItem Function is used to remove items from one container (or actor) to another container (or actor) and the items moved exceeds the weight limit set on the container? Will it stop at the limit? Will items be lost to the void? Or will it fill it anyway (and potentially overburden Lydia)?
trilloth,
Almost certainly it will overburden the person-- you can try it easy enough if you do something like use the console to give someone a million iron daggers; you'll see they all get added, and the target's encumbrance is crossed.
i want to tell to the machine if the weapon that attack has keyword (WeapTypeBow) to do the rest of my script
so, how to do that?
There is an event called onHit which will tell you everything you need.
I asked in the last thread and didn't get an answer what exactly does reset do for quests?
Resets the quest stage back to 0. All scenes and dialogue are reset. Aliases are emptied until the quest is started again.
And I missed your last question.
Well in that case your script should be compatible with any bow, even mod added bows, thanks to GetEquippedItemType() function. Try this script. You will need to attach it to a PlayerAlias. http://www.creationkit.com/Dynamically_Attaching_Scripts#Set_Up_a_Reference_Alias (Ignore the cloak stuff that comes after that). Then attach your script to that alias.
Event OnHit(ObjectReference Attacker, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) if((attacker as actor).getequippeditemtype(0) == 7) ;if this is true, the enemy is wielding a bow ; the player was just hit by a bow shot, add your script here. endif EndEvent
To extend Brandy's explanation. You need to use the OnHit event in a script attached to the item that gets hit. (Unless you are trying to do something a bit more universal, then you will need to create a perk. I'm not sure about the details for that part).
Here is an example script for a single object that tests to see if it was hit by a bow:
ScriptName Thing_That_Gets_Hit_Example Extends ObjectReferenceKeyword Property WeaponTypeBow Auto ; must be sure to attach propertyEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \ bool abBashAttack, bool abHitBlocked) if (akSource as Weapon) ; check to see if it's a weapon first if akSource.HasKeyword(WeaponTypeBow) Debug.Trace("THING got hit by a bow!") ; for testing, make sure you have logging turned on. ; do stuff here endif endif EndEvent
Edit: LOL Ninja'd by egocarib. Though my example is slightly different. I think I would go with testing the the source weapon instead of checking the attacker's equipped item, in case the attack switches weapons suddenly. Who knows if that can happen fast enough?