Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

jaxonz

Allies
  • Posts

    32
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by jaxonz

  1. Well, I'm not quite clear on what you are trying to accomplish, but I you should probably know that SetAngle, SetPosition and MoveTo functions can be buggy. TranslateTo is far more reliable.
  2. Hi there Matthias, I've read and reread your source code and can't seem to figure out what it is you are trying to accomplish. Perhaps if we start from there I could offer a code snippet that would work for you.
  3. I see you are using the Game.GetFormFromFile function to test for existence of DLC or any other mod. http://www.creationkit.com/GetFormFromFile_-_Game The example code you are using is actually set up to work with arrays and to test for any number of different mods. What you need to do in your mod is edit the properties and assign values for bDLCIsLoaded, iKnownFormID, and sDLCName. Alternatively, if you only want to check for Dawnguard, you could radically simplify the code code as follows: Bool Function CheckForDawnguard() If Game.GetFormFromFile(2048, "Dawnguard.ESM") return true EndIf EndFunction
  4. Looks like the Unlock command you are using is the same as one would use from command console. For Papyrus, you will need the ObjectReference of the door or container you are targeting. An easy way to get that is to use the SKSE function RegisterForCrosshairRef.... if you wish to allow distant unlocking, you will have to use a projectile in your spell and then call the Game.FindClosestReferenceOfTypeFromRef function to get the objectreference. The source code in my Positioner mod shows both methods if you need more detailed examples. See also: http://www.creationkit.com/Lock_-_ObjectReference http://www.creationkit.com/Locking_and_Unlocking_Doors
  5. Basically, the easiest thing to do is to use a pair of Markers one for each teleport destination. In your case, it sounds like one of the 2 markers will be stationary. Before you teleport the player to the desired destination, just move the marker to their position so that you know where to return them. As an example, here is the source from my Ethereal Ring mod: Scriptname JaxonzEtherealRing extends ObjectReference {Script supporting the JaxonzEtherealRing item.} ObjectReference property destWhereEquippedMarker auto ObjectReference property destWhereUnequippedMarker auto sound property soundTeleport auto Event OnEquipped(Actor akActor) ;move equipped marker to present location destWhereEquippedMarker.MoveTo(akActor) ;teleport player to unequipped marker location akActor.MoveTo(destWhereUnequippedMarker ) ;start FX, visuals from attached enchantment soundTeleport.Play(akActor) endEvent Event OnUnequipped(Actor akActor) ;move unequipped marker to present location destWhereUnEquippedMarker.MoveTo(akActor) ;teleport player to unequipped marker location akActor.MoveTo(destWhereEquippedMarker ) ;start FX, visuals from attached enchantment soundTeleport.Play(akActor) endEvent Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer) if akOldContainer && !akNewContainer ;ring dropped to the ground ;reset both markers to current location destWhereEquippedMarker.MoveTo(Game.GetPlayer()) destWhereUnEquippedMarker.MoveTo(Game.GetPlayer()) endIf endEvent Hope that helps.
  6. Wow! That's some really nice work. I'm sure I will be an eager subscriber to your mod. Also happy to pitch in if there's anything I can do from a scripting role.
  7. Hi there, I know you've had some feedback before on another thread and noticed you've had no replies on this one. You might take as a good example, this post http://tesalliance.org/forums/index.php?/topic/7076-wip-the-elders-island/ of how one might generate interest. In short, providing an example of your work in progress goes a long way toward getting people interested in your vision and proving you are a strong contributor. All the best.
  8. REALLY NICE WORK. From an architectural perspective, the consistent ceiling height throughout makes it seem a bit like an office building or budget motel. You've created some palatial areas here. Consider making the ceiling higher and more interesting in focal areas. Also an opportunity to break the rythm of all those columns. Yes, this would cause the distance between floors to increase. This presents an opportunity for more interesting stairs. Maybe spiral, or winding around an open shaft. Just a suggestion to help the spaces you've designed have the impact they deserve.
  9. If I were writing this code, I would use OnActorAction or OnPlayerBowShot to detect when arrows are fired and then create secondary arrows by casting a spell with the same arrow as the projectile. Example source code for detecting when player shoots a bow can be found in my Archery Perks mod http://www.nexusmods.com/skyrim/mods/53268 The trick with the spell will be to make sure to set the projectile type as Arrow. The default Missile type is not affected by gravity. Note that it may be tricky to get timing exact. The secondary arrows may follow slightly behind the original one. Also, since spells fire from a different location on the character model than do arrows shot from bows, the secondary arrows are not guaranteed to hit the same target (I think this is desirable). You COULD get a reference to the projectile shot by the bow (again, see the source code for Archery Perks... JaxonzArrowsGlowEffect.psc for how to do this), but there doesn't seem to be a method to create a projectile object instance that would match the trajectory and velocity of the original. Just my 2 cents. Good luck.
  10. Place the following line of code after the second Else statement in OnMenuClose: iTotalValueDiff = -1 * iTotalValueDiff This inverts the value difference if negative.
  11. Yep. Looks like I inverted the values for calculating the difference in total value. It should read: ;how much gold does the player have? int iTotalValueDiff = (objPlayer as Actor).GetGoldAmount() - iOldTotalValue
  12. OK, in toying with this I think I've actually developed the math you originally wanted. Here's an updated script: Scriptname JaxonzTestGetGold2 extends ReferenceAlias MiscObject Property frmGoldSeptim Auto MiscObject Property frmSilverSeptim Auto MiscObject Property frmCopperSeptim Auto MiscObject Property frmOriginalGold Auto ObjectReference Property objPlayer Auto int Property iGoldCoinValue = 100 Auto int Property iSilverCoinValue = 50 Auto int Property iCopperCoinValue = 1 Auto int iOldTotalValue Int iNumberGoldSeptims Int iNumberSilverSeptims Int iNumberCopperSeptims Event OnInit() RegisterForMenu("BarterMenu") RegisterForMenu("Training Menu") EndEvent Event OnMenuOpen(String MenuName) Debug.Trace("Converting coins to value") ;it really doesn't matter which menu we open... just convert all coins to native gold ;what's in inventory iNumberGoldSeptims = objPlayer.GetItemCount(frmGoldSeptim) iNumberSilverSeptims = objPlayer.GetItemCount(frmSilverSeptim) iNumberCopperSeptims = objPlayer.GetItemCount(frmCopperSeptim) iOldTotalValue = (iNumberGoldSeptims * iGoldCoinValue) + (iNumberSilverSeptims * iSilverCoinValue) + iNumberCopperSeptims ;remove the coins objPlayer.RemoveItem(frmGoldSeptim, iNumberGoldSeptims, True) objPlayer.RemoveItem(frmSilverSeptim, iNumberSilverSeptims, True) objPlayer.RemoveItem(frmCopperSeptim, iNumberCopperSeptims, True) ;replace with native Skyrim gold objPlayer.AddItem(frmOriginalGold, iOldTotalValue, True) EndEvent Event OnMenuClose(String MenuName) Debug.Trace("Converting value to coins") ;how much gold does the player have? int iTotalValueDiff = iOldTotalValue - (objPlayer as Actor).GetGoldAmount() ;make change for difference in gold value if iTotalValueDiff >= 0 ;same or more total value ;just add new coins of proper denomination iNumberGoldSeptims = iNumberGoldSeptims + iTotalValueDiff / iGoldCoinValue iNumberSilverSeptims = iNumberSilverSeptims + (iTotalValueDiff % iGoldCoinValue) / iSilverCoinValue iNumberCopperSeptims = iNumberCopperSeptims + iTotalValueDiff % iSilverCoinValue Else ;less total value if iNumberCopperSeptims >= iTotalValueDiff ;take the entire difference out in coppers iNumberCopperSeptims = iNumberCopperSeptims - iTotalValueDiff Else ;remove change in coppers iNumberCopperSeptims = iNumberCopperSeptims - iTotalValueDiff % iSilverCoinValue iTotalValueDiff = iTotalValueDiff - iTotalValueDiff % iSilverCoinValue if (iNumberSilverSeptims * iSilverCoinValue) >= iTotalValueDiff ;there is enough silver to cover entire value difference iNumberSilverSeptims = iNumberSilverSeptims - (iTotalValueDiff / iSilverCoinValue) Else iNumberSilverSeptims = iNumberSilverSeptims - (iTotalValueDiff / iSilverCoinValue) ;take everything we can out of silver, OK to go negative While iNumberSilverSeptims < 0 ;iterate making change in gold until we have 0 or more silver iNumberCopperSeptims = iNumberCopperSeptims + (iGoldCoinValue / iSilverCoinValue) ;assumes a gold coin value divides equally into silver coin value iNumberGoldSeptims -= 1 iTotalValueDiff = iTotalValueDiff - iGoldCoinValue EndWhile EndIf Endif EndIf ;remove Skyrim gold objPlayer.RemoveItem(frmOriginalGold, iOldTotalValue, True) ;replace with coins objPlayer.AddItem(frmGoldSeptim, iNumberGoldSeptims, True) objPlayer.AddItem(frmSilverSeptim, iNumberSilverSeptims, True) objPlayer.AddItem(frmCopperSeptim, iNumberCopperSeptims, True) EndEvent Notes: You can make the frmCopperSeptim and frmOriginalGold properties point to the same MiscObject if your mod replaces default gold. I left things as they were just in case you decide to use something different. It works both ways. I made the values of each coin properties. You can change them to whatever values you like and the script will still work. However, it does assume that the value of silver coins divides evenly into the value of gold coins (i.e., if iGoldCoinValue = 100, then iSilverCoinValue could equal 1, 2, 5, 10, 20, 25, or 50) Promoting the number of each coin to higher scope allows tracking the original total value and the number of each coin. The intent of this is to preserve the original number of each coin as much as possible. There is more complexity in the OnMenuClose routine so that change can be made. The logic is as follows:​​ If the player has the same or more money Add new coins of optimal denominations to those already existing If the player has less total money Take as much from copper coins as possible Then take as much from silver coins as possible Take gold coins last. If you look close, you will see that I found it easier to take the remainder out in silver, allowing for a negative number of coins, and then iteratively make change from gold until there were 0 or more silver. It compiles, but I don't have your mod installed so I haven't run the code. As I stated before, the more complex the math the greater the odds of something going wrong so you should thoroughly kick the tires on this. Addressing Ghaunadaur's point, you may want to register for other menu types that may exchange money. There is a list at http://www.creationkit.com/UI_Script#Valid_Menu_Names . However, I would NOT enable this for ContainerMenu, GiftMenu, or InventoryMenu as this would cause players to never see your special coins. Enjoy!
  13. Thanks Brett, I have the movement of mannequins already working today in my Positioner mod. What I'm trying to do is extend that capability without ending up with very complex code. http://www.nexusmods.com/skyrim/mods/52583 Someone else made a sort of warehouse companion mod where one can get furniture without stealing if from other locations. http://www.nexusmods.com/skyrim/mods/53813 And, although I haven't tried them yet, it seems that at least a couple mod allow the dynamic creation and movement of mannequins. http://www.nexusmods.com/skyrim/mods/10578/ http://www.nexusmods.com/skyrim/mods/8635/
  14. Very good point, Ghaunadaur. There are definitely some challenges in attempting to modify something so core to the game. In response to Force85's question: the above script would only change the number of coins when visiting a vendor or trainer, so it would be possible to accumulate any number of silver septims and have them show accurately in inventory. The lore-friendly explanation for the change in number of coins could be that merchants and trainers help make correct change.
  15. How about something like this? Scriptname JaxonzTestGetGold extends ReferenceAlias Form Property frmGoldSeptim Auto Form Property frmSilverSeptim Auto Form Property frmCopperSeptim Auto Form Property frmOriginalGold Auto ObjectReference Property objPlayer Auto Event OnInit() RegisterForMenu("BarterMenu") RegisterForMenu("Training Menu") EndEvent Event OnMenuOpen(String MenuName) Debug.Trace("Converting coins to value") ;it really doesn't matter which menu we open... just convert all coins to native gold ;what's in inventory Int iNumberGoldSeptims = objPlayer.GetItemCount(frmGoldSeptim) Int iNumberSilverSeptims = objPlayer.GetItemCount(frmSilverSeptim) Int iNumberCopperSeptims = objPlayer.GetItemCount(frmCopperSeptim) int iGoldValue = iNumberGoldSeptims * 100 + iNumberSilverSeptims * 50 + iNumberCopperSeptims ;remove the coins objPlayer.RemoveItem(frmGoldSeptim, iNumberGoldSeptims, True) objPlayer.RemoveItem(frmSilverSeptim, iNumberSilverSeptims, True) objPlayer.RemoveItem(frmCopperSeptim, iNumberCopperSeptims, True) ;replace with native Skyrim gold objPlayer.AddItem(frmOriginalGold, iGoldValue, True) EndEvent Event OnMenuClose(String MenuName) Debug.Trace("Converting value to coins") ;how much gold does the player have? int iGoldValue = objPlayer.GetItemCount(frmOriginalGold) ;calculate optimal number of coins Int iNumberGoldSeptims = iGoldValue / 100 Int iNumberSilverSeptims = (iGoldValue % 100) / 50 Int iNumberCopperSeptims = iGoldValue % 50 ;remove Skyrim gold objPlayer.RemoveItem(frmOriginalGold, iGoldValue, True) ;replace with coins objPlayer.AddItem(frmGoldSeptim, iNumberGoldSeptims, True) objPlayer.AddItem(frmSilverSeptim, iNumberSilverSeptims, True) objPlayer.AddItem(frmCopperSeptim, iNumberCopperSeptims, True) EndEvent This script uses the SKSE events to notify your script whenever Barter and Training menus are opened or closed. So far as I can tell, only the Barter and Training menus deal with the exchange of gold. When opened, we count up the value of all the coins, remove them, and replace them with original gold (admittedly, there is a little loss of realism here, but a decent trade-off for convenience to the player). When closed, we convert the gold back to your coin system. This script would be attached to a ReferenceAlias in a Quest. (One referencing the player would be the norm.) You would have to set the properties to the coins in your system.
  16. Thanks for your informative and very respectful response. In this case, decades of OO programming is working to my disadvantage. I get frequent reminders about just how weak, buggy, and poorly documented Papyrus is... this is just another one. But there are many ways to skin cats! This is related to another of my posts in this forum. I'm trying to avoid spaghetti code in my Positioner mod to allow in-game movement of mannequins, weapon racks, interactive bookshelves, etc. These are all actually collections of objects (typically an Activator, a Static, and sometimes a Marker). What I've created is a class that holds references to the related parts and implements ObjectReference functions such as TranslateTo to manage and hide the complexity of moving all those objects in a coordinated fashion. If I could instantiate such classes it would allow easy manipulation of any number of these types of collections. I understand now that no "objects" can exist in Papyrus which do not have some corresponding object created in the CK. (I've seen other threads discussing handshaking between Papyrus and the game engine which allude to this as well.) Rather than create an object in CK to hold my script, I think perhaps the best way to address this is to use a ReferenceAlias to point to the game object which has the physical model (e.g., the the PlayerHouseMannequin Actor in the case of mannequins) and dynamically attach a script that tracks the other objects and overrides the functions I care about. (I realize that this does, in effect create a CK object; not trying to split hairs here; just trying to say that PlaceAtMe or AddItem won't be helpful in this case.)
  17. ESP and script source uploaded to this link https://drive.google.com/file/d/0B6NnkqRw_eqDS2doWmtLZzJTQ2s/edit?usp=sharing
  18. I guess perhaps I don't understand Papyrus as well as I had thought. I've created a new class that extends ObjectReference. In another script, I would like to instantiate a new instance of my class. I thought I could just use something like: MyExtendedClass objMyClass = new MyExtendedClass However, the compiler chokes on this as it assumes I'm trying to use the New keyword to instantiate an array. Hoping this is a simple syntax issue and not that Papyrus fundamentally prohibits generation of new script objects.
  19. Yes, this is probably a scripting task. In the Creation Kit, take a look at the dunLabyrinthianAnimateOnTrig activator and the script it uses, dunLabyAnimateOnTrig. This is probably a good starting point for a trigger that causes an animation. You would just need to change the code to cause the animation to be played on the actor causing the trigger.
  20. Sounds like this is an NPC you are attempting to control rather than the player character. If that is the case, your spell may be fighting with an AI package. I would suggest that using an AI package is the most effective and appropriate way to modify NPC behavior.
  21. OK, here's what I ended up with as a workaround. Happy I didn't have to resort to a quest for holding object references. Weapon has no enchantments, just carries this script: (and forgive me for the script naming, that's just my convention to be able to find things in CK) Scriptname JaxonzSpeedyDaggerScript extends ObjectReference Spell Property splSpeedyDagger Auto Event OnEquipped(Actor akActor) Debug.Notification("OnEquipped") splSpeedyDagger.Cast(akActor,akActor) EndEvent Event OnUnequipped(Actor akActor) Debug.Notification("OnUnequipped") akActor.DispelSpell(splSpeedyDagger) EndEvent Notes: All we are doing here is overcoming the limitation for weapon enchantments having to be of type Contact rather than self cast. The spell is set up to be 1000 days duration, constant effect, 0 cost The Debug.Notification lines are diagnostic and can be removed The MagicEffect for the spell only carries this script: Scriptname JaxonzSpeedyDaggerMGEFScript extends ActiveMagicEffect int ACTOR_ACTION_DRAW_START = 7 int ACTOR_ACTION_SHEATH_END = 10 float fOriginalSpeedMult Actor akWhoHasEquipped Event OnInit() Debug.Notification("OnInit JaxonzSpeedyDaggerMGEFScript") akWhoHasEquipped = GetTargetActor() fOriginalSpeedMult = akWhoHasEquipped.GetActorValue("SpeedMult") RegisterForActorAction(ACTOR_ACTION_DRAW_START) RegisterForActorAction(ACTOR_ACTION_SHEATH_END) EndEvent Event OnActorAction(int actionType, Actor akActor, Form source, int slot) Debug.Notification("OnActorAction: " + actionType) If akActor == akWhoHasEquipped If actionType == ACTOR_ACTION_DRAW_START Debug.Notification("SpeedMult: " + 3.0 * fOriginalSpeedMult) akActor.SetActorValue("SpeedMult", 3.0 * fOriginalSpeedMult) ElseIf actionType == ACTOR_ACTION_SHEATH_END Debug.Notification("SpeedMult: " + fOriginalSpeedMult) akActor.SetActorValue("SpeedMult", fOriginalSpeedMult) ;a bug in skyrim causes reduced SpeedMult not to be honored immediately ;following faked key input is a workaround to cause it to be honored Input.HoldKey(Input.GetMappedKey("Sprint")) Input.HoldKey(Input.GetMappedKey("Forward")) Utility.Wait(0.1) Input.ReleaseKey(Input.GetMappedKey("Forward")) Input.ReleaseKey(Input.GetMappedKey("Sprint")) EndIf EndIf EndEvent Notes: Here we are successfully using the SKSE RegisterForActorAction function to fire events when weapons are drawn and sheathed. (This is a workaround for the "no native object bound to the script object, or object is of incorrect type" cited earlier.) Since the spell is only in effect when the weapon is equipped, there's no need to double check that our weapon is equipped. However, we do check that the actor causing the weapon drawn event is the same as has the spell cast on them. My code doesn't assume akActor is Game.GetPlayer(). This should allow the weapon to be used by NPCs, but I haven't tested it. It may also fail if multiple instances of the weapon exist, as I'm not 100% sure that each weapon would get its own spell script instance and the akActor internal variable may get shared. The script is a bit longer than necessary, but I wanted to use good practices and not make assumptions about an actor's base movement value, control mappings, etc. Note also the workaround for setting movement speed back to normal. I think this may have been the cause of what you observed before. The Skyrim engine has a bug in that a reduced SpeedMult actor value is not immediately honored. One must open a menu or swing a weapon or take some other activity before it takes effect. In this case, the code causes an extremely brief sprint. Yet another reminder that our beloved Skyrim is full of bugs. Debug.Notification lines can all be removed. If you still have difficulty in getting this to work, I can post the .esp and scripts to Google Docs.
  22. OK... this seemed to be fairly straightforward so I gave it a try myself. What I found out is that there's an underlying bug that causes the RegisterForActorAction calls to fail with the log message: "no native object bound to the script object, or object is of incorrect type" Looking this up, there seems to be a disconnect for what some term "transient objectrefereneces". (See http://www.gamesas.com/native-object-object-incorrect-type-t344408.html ) I had similar behavior using the native RegisterForUpdate function. The OnUpdate event never fires. However, there is no error in the script log as with RegisterForActorAction. I commented earlier today (not on this thread) about how buggy and poorly documented Papyrus is, and how valuable it is to have a community of modders to help one avoid the various pitfalls. Here's another prime example. Working on a workaround...
×
×
  • Create New...