-
Posts
1497 -
Joined
-
Last visited
Everything posted by dylbill
-
[LE] Reanimation Scripting
dylbill replied to AshPtMods's topic in Skyrim's Creation Kit and Modders
If that's the case, I suppect the OnDeath event isn't firing for the reanimated actor. To get around this, also try putting the resurrect function in the script: Spell property SpellRef auto {The name of the Reanimate Spell. (REQUIRED!)} Float Property WaitTime Auto {Set amount of time in seconds after death to reanimate} Event OnDeath(Actor akKiller) Utility.Wait(WaitTime) SpellRef.Cast(self, self) ;this actor casts the reanimate spell on themself Utility.Wait(2) Self.Resurrect() EndEvent -
SSE Checking if the player has a companion
dylbill replied to RedxYeti's topic in Skyrim's Creation Kit and Modders
No problem -
SSE Checking if the player has a companion
dylbill replied to RedxYeti's topic in Skyrim's Creation Kit and Modders
for vanilla, you can use the Follower reference alias in the DialogueFollower quest. Something like: Actor current follower = Follower.GetActorRef() If follower ;do something endifThis wouldn't account for multiple follower mods though. To do that, you can make an area spell, put the condition GetRelationshipRank >= 3, that way it only affect companions, then put a script on the spell's magic effect with OnEffectStart, the target will be a companion. -
[LE] Reanimation Scripting
dylbill replied to AshPtMods's topic in Skyrim's Creation Kit and Modders
I would keep it simple and put a new script directly on your NPC. Something like this: Scriptname TM_ActorScript extends Actor Spell property SpellRef auto {The name of the Reanimate Spell. (REQUIRED!)} Float Property WaitTime Auto {Set amount of time in seconds after death to reanimate} Event OnDeath(Actor akKiller) Utility.Wait(WaitTime) SpellRef.Cast(self, self) ;this actor casts the reanimate spell on themself EndEventChange the scriptname to something else. -
Yes this is a problem with working in inventories or containers. When an item enters a container, it loses it's object reference unless it's a permanent reference. I think Bethesda did that to save memory. To make a reference permanent, you can just hold it as a script property, BUT it has to exist physically in the world, not in a container first. So it depends on the item sword you're trying to reference. If it's an item from your mod, you can use PlaceAtMe first and store the objectReference in a script property, then add the reference to the inventory and that does the trick, if it's a vanilla sword it might be harder to do.
-
SSE Script to change container's items
dylbill replied to baloney8sammich's topic in Skyrim's Creation Kit and Modders
So you're trying to change vanilla container's contents based on conditions? If that's the case, I would recommend using SkyPal: https://www.nexusmods.com/skyrimspecialedition/mods/43925 It's a script resource where you can pass all object references in the game, then filter them by type (28 for containers) and can then filter those with an array of actor owners. -
SSE OnUpdate() Speeding up over time
dylbill replied to RedxYeti's topic in Skyrim's Creation Kit and Modders
Gotcha. No worries, glad you got it working. -
SSE Script to change container's items
dylbill replied to baloney8sammich's topic in Skyrim's Creation Kit and Modders
To help, I'd need more info for what you're trying to do. A simple way I can think to is just have separate containers, and enable / disable different ones that have different items in them based on conditions. Example: Actor Property PlayerRef Auto Event OnLoad() ;event triggered when this reference loads 3D. If PlayerRef.GetLevel() > 20 ;if players level is greater than 20, enable this container, else, disable it. Self.Enable() Else Self.Disable() Endif EndEventAnother way is to just use leveled items in the container, and put the conditions on those in the creation kit, but that might be a lot more work if you've already set up the container. -
SSE OnUpdate() Speeding up over time
dylbill replied to RedxYeti's topic in Skyrim's Creation Kit and Modders
I've also noticed that the OnUpdate event doesn't work reliably while in menus. Instead, I would try a while loop: Function AdvanceSkillInMenu() While UI.IsMenuOpen("Crafting Menu") Game.AdvanceSkill("alchemy", 18) Utility.WaitMenuMode(2) EndWhile EndFunction -
A lot of things in papyrus you will find in other languages. I started with papyrus to mod Skyrim and it helped me with learning C++. It all depends on what you want to do. If you want to make mods for Bethesda games, I'd say learn it, if you're just looking to get into programming I'd say to start with another language.
-
GetName requires skse. If you don't want to use skse, replace GetName with a string such as "Ability A". You can also use a string property and set it's value in the creation kit. String Property AbilityNameA Auto Debug.Notification("You have gained " + AbilityNameA) Although, I would recommend just using another message form that's not a message box to display the notification. Reason being it makes your mod easier to translate, and with debug.notification sometimes doesn't display capitals correctly.
-
[LE] How to obtain nearby followers?
dylbill replied to pxd2050's topic in Skyrim's Creation Kit and Modders
No problem, I haven't tested it but I think it should work. Also note that the Utility.CreateFormArray() and Utility.CreateFloatArray() functions require skse. -
[LE] How to obtain nearby followers?
dylbill replied to pxd2050's topic in Skyrim's Creation Kit and Modders
Here is what I would do. First to find followers, make a new spell, script archetype, that is an area spell. Make the radius something like 10,000 units. Put the condition on the spell GetRelationshipRank >= 3 to the player, that way it only affects ally's. Then put a script on the spell's magic effect that adds the target to a formlist.: Scriptname TM_MagicEffectScript extends ActiveMagicEffect FormList Property NearbyFollowers Auto Event OnEffectStart(Actor akTarget, Actor akCaster) NearbyFollowers.AddForm(akTarget) ;add target of spell to formlist EndEventThen, in another script, you can use arrays to sort them by distance: Spell Property FindFollowersSpell Auto ;spell is an area spell, say with 10,000 unit range. Has the condition getRelationShipRank >= 3 FormList Property NearbyFollowers Auto ;Stores nearby followers from above spell. Actor Property PlayerRef Auto Function FindNearbyFollowers() NearbyFollowers.Revert() ;clear formlist first FindFollowersSpell.Cast(PlayerRef) ;player casts the FindFollowersSpell, adding nearby followers to formlist Endfunction Form[] Function SortRefsByDistance() FindNearbyFollowers() Utility.Wait(1) ; wait for spell to cast and find followers Int M = NearbyFollowers.GetSize() ;find max entries Int I = 0 ;index int Form[] NearbyFollowersArray = Utility.CreateFormArray(M) ;easier to sort actors in array rather than formlist Float[] Distances = Utility.CreateFloatArray(M) While I < M NearbyFollowersArray[I] = NearbyFollowers.GetAt(I) ;store actors in formlist to array I += 1 EndWhile I = 0 While I < M Distances[I] = PlayerRef.GetDistance(NearbyFollowersArray[I] as actor) ;get and save current actor's distance from center ref to array I += 1 ;add 1 to I moving to next actor in array EndWhile I = 0 Int M2 = M - 1 ;only need next to last entry for sorting While I < M Int I2 = 0 While I2 < M2 Int Next_I = I2 + 1 ;save next index to check against current index If Distances[I2] > Distances[Next_I] ;is the current distance greater than the next? Float NextDistance = Distances[Next_I] Distances[Next_I] = Distances[I2] Distances[I2] = NextDistance ;swap the current and next distances in array Form NextActor = NearbyFollowersArray[Next_I] NearbyFollowersArray[Next_I] = NearbyFollowersArray[I2] NearbyFollowersArray[I2] = NextActor ;swap the current and next actors in array Endif I2 += 1 Endwhile I += 1 EndWhile Return NearbyFollowersArray EndFunctionThe function should return a form array, where the actors are sorted the closest to the player to the farthest away. -
No problem :) actually it was in the OnUpdate event, I mis typed. You had: If Self.IsDead() UnregisterforUpdate() else EndifIn the original script. I just moved the Endif down so the rest of the code was in the Else block. As it was, the rest of the code still ran in every update because it wasn't conditionalized.
-
In the OnCombatStateChanged event, you need to move the Endif to the end of the event. As it stands now, it unregisters for the update, but still registers again at the end of the event because the rest of the code isn't in the Else block. Make sure you indent properly so you can better see the logic. It should look like this: Scriptname MMO_BossMobs_SCRIPT extends Actor Actor Property PlayerRef Auto ObjectReference property Xmarker1 auto ObjectReference property Xmarker2 auto ObjectReference property Xmarker3 auto ObjectReference property Xmarker4 auto ObjectReference property Xmarker5 auto ObjectReference property Xmarker6 auto ObjectReference property Xmarker7 auto ObjectReference property Xmarker8 auto ObjectReference property Xmarker9 auto ObjectReference property Xmarker10 auto ActorBase Property BossMobs Auto ObjectReference MobNPC1 ObjectReference MobNPC2 ObjectReference MobNPC3 ObjectReference MobNPC4 ObjectReference MobNPC5 ObjectReference MobNPC6 ObjectReference MobNPC7 ObjectReference MobNPC8 ObjectReference MobNPC9 ObjectReference MobNPC10 Explosion Property ExplosionIllusionMassiveLight01 Auto {Big Explosion for Pillar} Explosion Property ExplosionIllusionLight Auto {Big Explosion when Ambush Ends} Explosion Property iExplo3 Auto {Explosion when Battle is Over} ;=========================================================================== Event OnCombatStateChanged(Actor akTarget, int aeCombatState) If aeCombatState == 1 Actor player = Game.GetPlayer() If akTarget == player Registerforsingleupdate(10.0) Endif Endif EndEvent Event OnUpdate() If Self.IsDead() UnregisterforUpdate() else GoToState("Busy") self.PlaceAtme(ExplosionIllusionMassiveLight01) MobNPC1 = Xmarker1.PlaceAtme(BossMobs) Xmarker1.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC2 = Xmarker2.PlaceAtme(BossMobs) Xmarker2.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC3 = Xmarker3.PlaceAtme(BossMobs) Xmarker3.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC4 = Xmarker4.PlaceAtme(BossMobs) Xmarker4.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC5 = Xmarker5.PlaceAtme(BossMobs) Xmarker5.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC6 = Xmarker6.PlaceAtme(BossMobs) Xmarker6.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC7 = Xmarker7.PlaceAtme(BossMobs) Xmarker7.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC8 = Xmarker8.PlaceAtme(BossMobs) Xmarker8.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC9 = Xmarker9.PlaceAtme(BossMobs) Xmarker9.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) MobNPC10 = Xmarker10.PlaceAtme(BossMobs) Xmarker10.PlaceAtme(ExplosionIllusionLight) utility.wait(2.0) RegisterForSingleUpdate(30.0) GoToState("") Endif EndEvent ;=========================== State Busy Event OnUpdate() EndEvent EndState ;=========================== Event OnDeath(Actor akKiller) Xmarker1.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker2.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker3.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker4.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker5.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker6.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker7.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker8.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker9.PlaceAtme(iExplo3) utility.wait(2.0) Xmarker10.PlaceAtme(iExplo3) utility.wait(3.0) self.PlaceAtme(ExplosionIllusionMassiveLight01) EndEvent
-
SSE How to add a spell (script?) to an armor?
dylbill replied to Gekoeko's topic in Skyrim's Creation Kit and Modders
Here's how I would do it. Put a custom enchantment on the armor. Make the enchantment's magic effect the script archetype. Put the condition IsInCombat == 1 on the enchantment spell in the Creation Kit. That way, the enchantment only becomes active when the wearer starts combat. Then you can put a simple script on the enchantment's magic effect. Something like this: Scriptname TM_MagicEffectScript extends ActiveMagicEffect ActorBase Property SummonedActor Auto Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.PlaceActorAtMe(SummonedActor, 3) EndEventChange the script name to something else. You also might be able to just use the Summon archetype for the magic effect, but I'm not sure if that works for enchantments. -
SSE How are casting animations linked to spells?
dylbill replied to baphy93's topic in Skyrim's Creation Kit and Modders
Sphered is correct. The animation that displays is based on the type of spell, and which hand it's in. If you want to look at the conditions for which animation plays, look under the Gameplay tab in the CK, and animations. There look under Actors/Characters/Behaviors, then under ActionLeftAttack and ActionRightAttack. Search through those and you will find the magic animations and what conditions are on them. -
SSE ForceRefTo problem
dylbill replied to dizietemblesssma's topic in Skyrim's Creation Kit and Modders
No problem, and no the dummy cell doesn't have to be empty. You can place the reference anywhere, I just suggest an empty cell, or a cell that the player never enters so that the object can't interact with any loaded actors. -
SSE ForceRefTo problem
dylbill replied to dizietemblesssma's topic in Skyrim's Creation Kit and Modders
In your passed in form akItem, it must be an objectreference to force it into an alias. Problem is that object references lose their reference when they are in an inventory, unless the object reference is set as a script property. If you are passing in a base form for akItem, such as miscObject or Armor ect, you can do something like this: ObjectReference Property EmptyCellRef Auto ;ObjectReference in an empty dummy cell Function dz_check_item_in_inventory(Actor akActor,Form akItem,String type) If akActor.GetItemCount(akItem As Form) == 0 ;is the item in the actor's inventory ;DEBUG_NOTIFY(akActor,akItem.GetName()+" is not in inventory") dz_outfits_msg_alias.ForceRefTo(akActor) ObjectReference MessageRef = EmptyCellRef.PlaceAtMe(akItem, 1) ;place new ObjectReference of base form in empty cell. dz_outfits_msg_alias2.ForceRefTo(MessageRef) dz_outfits_msg28.Show() debug.notification(akItem.GetName()+" is no longer in the inventory for "+actor_name+", "+type+" outfit is incomplete.") Utility.Wait(1) ;wait till menu is closed ;delete temp ObjectReference MessageRef.Disable() MessageRef.Delete() MessageRef = None ;akActor.Additem(akItem) ;move the item to the actor's inventory EndIf EndFunction -
SSE Return in function question
dylbill replied to dizietemblesssma's topic in Skyrim's Creation Kit and Modders
IsharaMeradin Is correct. I would add that return is also used to get a value back from a function. Example: Function SomeFunction() Int TestInt = IntFunction() ;TestInt is 10 EndFunction Int Function IntFunction() Return 10 EndFunction