Dynamically Attaching Scripts: Difference between revisions
Jump to navigation
Jump to search
added a known issues section
imported>Fg109 |
imported>Fg109 (added a known issues section) |
||
| Line 136: | Line 136: | ||
MiscObject Property Firewood01 Auto | MiscObject Property Firewood01 Auto | ||
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked) | Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, \ | ||
bool abSneakAttack, bool abBashAttack, bool abHitBlocked) | |||
if (akAggressor == Game.GetPlayer()) | if (akAggressor == Game.GetPlayer()) | ||
if (akSource.HasKeyword(WeapTypeBattleAxe) || akSource.HasKeyword(WeapTypeWarAxe)) | if (akSource.HasKeyword(WeapTypeBattleAxe) || akSource.HasKeyword(WeapTypeWarAxe)) | ||
| Line 176: | Line 177: | ||
=== Conclusion === | === Conclusion === | ||
The two quests are all that's necessary for this mod. Save the mod and then load | The two quests are all that's necessary for this mod. Save the mod and then load the game with it to test it out. A piece of firewood should be received every time the player hits a tree with an axe. | ||
The method for attaching scripts to objects using reference aliases is much easier than what we did with magic effects and actors. But there are disadvantages to using it: | The method for attaching scripts to objects using reference aliases is much easier than what we did with magic effects and actors. But there are disadvantages to using it: | ||
| Line 186: | Line 187: | ||
That would have been much more complicated because then we would have to store the number of times we hit the tree somewhere. Obviously, we cannot store this variable in the reference alias scripts because the object filling the alias is not always going to be the same tree. We might swing our axe twice but then the alias gets refilled before the third strike, which means it could take us 5 strikes to get a piece of firewood. | That would have been much more complicated because then we would have to store the number of times we hit the tree somewhere. Obviously, we cannot store this variable in the reference alias scripts because the object filling the alias is not always going to be the same tree. We might swing our axe twice but then the alias gets refilled before the third strike, which means it could take us 5 strikes to get a piece of firewood. | ||
== Known Issues == | |||
*When using the second method with constantly refilling aliases, be careful with your alias scripts. If the alias script happens to be running a while loop when its quest is stopped, then it leads to suspended stacks, in turn leading to suspended scripts. | |||
== External Links == | == External Links == | ||
[http://forums.bethsoft.com/topic/1364191-porting-kuertees-sittable-rocks-mod-from-oblivion/ Porting Kuertee's Sittable Rocks Mod from Oblivion] | |||
[http://forums.bethsoft.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/ Dynamically Attaching Scripts to Actors Near the Player] | [http://forums.bethsoft.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/ Dynamically Attaching Scripts to Actors Near the Player] | ||
[http://forums.bethsoft.com/topic/ | [http://forums.bethsoft.com/topic/1362501-suspended-stacks-suspends-your-scripts-sometimes-indefinitely/ Suspended Stacks Suspends Your Scripts, Sometimes Indefinitely] | ||
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
[[Category:Papyrus Tutorials]] | [[Category:Papyrus Tutorials]] | ||
[[Category:Community Tutorials]] | [[Category:Community Tutorials]] | ||