Jump to content

Need a script? Maybe I can help.


fg109

Recommended Posts

@EnaiSiaion (...)

And then in your magic effect scripts, you can check the global variable to see whether or not the player was dual casting.

 

I found out by accident there's actually an "EffectWasDualCast" condition... there's a workaround and it works great. (There is another dual cast related condition but that one does nothing :facepalm: )

 

Thanks! :)

Link to comment
Share on other sites

  • Replies 272
  • Created
  • Last Reply

Top Posters In This Topic

Hello! I have a simple mod I'm trying to make, but I'm terribly inexperienced with scripting, so I figure I'd reach out to the community for pointers.

The idea is a unique set of gauntlets that give you a 'Bound Sword' like spell when you equip them (and removes it when unequipped). I figured I'd add a script to the gauntlets, that checked to see if they were equipped, which would then give you a custom spell (I'd start with just bound sword until I got the specifics down for the actual custom spell). I went through the first 3 tutorials on CreationKit.com and I also found two articles regarding IsEquipped and AddSpell, but I don't understand how to use them. Any advice or pointers would definitely be appreciated.

 

Thanks in advance. :-)

Link to comment
Share on other sites

To add a spell when an item is equipped and remove it when the item is unequipped, you would put a script like this on the item:

 

Scriptname Example extends ObjectReference

Spell property SpellToAdd auto

Event OnEquipped(Actor akActor)
akActor.AddSpell(SpellToAdd)
EndEvent

Event OnUnequipped(Actor akActor)
akActor.RemoveSpell(SpellToAdd)
EndEvent

Link to comment
Share on other sites

Dear fg109, you are like the Mother Theresa of modders :wub:

 

I have been struggling all night with what should probably be a totally noobishly simple script. Makes sense given that I am a noobish simpleton when it comes to scripting bwaha

 

Anyway, I'm trying to set the value of Timescale to 90 whenever I (and only me) am using a forge, grindstone or workbench, then to have it return to normal (default 20) when I leave it. This is just 'cause I like realism and want it to take a couple of in-game hours to make a suit of armor lol. I can get a cup of coffee or whatever in the meantime. I'd been messing around with trying to extend the Form script and the ObjectReference script, but nothing seems to actually compile. I feel like it should be really simple with an activator (the forge, etc.) and the get and set global variable, but my syntax seems to fail each time.

 

If you're still feeling like a saint, I would be overwhelming grateful if you could point me in the right direction :)

Link to comment
Share on other sites

You can try this:

 

 

Scriptname CraftingFurnitureScript extends ObjectReference

GlobalVariable property TimeScale auto
Float property DefaultTS auto
Float property ModTS = 90.0 auto

Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
	DefaultTS = TimeScale.Value
	TimeScale.SetValue(ModTS)
	RegisterForAnimationEvent(akActionRef, "IdleFurnitureExit")
endif
EndEvent

Event OnAnimationEvent(ObjectReference akSource, String asEvent)
UnregisterForAnimationEvent(akSource, asEvent)
Timescale.SetValue(DefaultTS)
EndEvent

 

 

If that doesn't work, then use this:

 

 

Scriptname CraftingFurnitureScript extends ObjectReference

GlobalVariable property TimeScale auto
Float property DefaultTS auto
Float property ModTS = 90.0 auto
Float property UpdateInterval = 1.0 auto
Bool ChangedTS

Event OnActivate(ObjectReference akActionRef)
if (akActionRef == Game.GetPlayer())
	DefaultTS = TimeScale.Value
	TimeScale.SetValue(ModTS)
	RegisterForSingleUpdate(UpdateInterval)
	ChangedTS = True
elseif ChangedTS
	UnregisterForUpdate()
	TimeScale.SetValue(DefaultTS)
	ChangedTS = False
endif
EndEvent

Event OnUpdate()
if (IsFurnitureInUse())
	RegisterForSingleUpdate(UpdateInterval)
else
	TimeScale.SetValue(DefaultTS)
	ChangedTS = False
endif
EndEvent

 

Edited by fg109
Link to comment
Share on other sites

@ChampionOfHircine

 

Search for an xMarkerHeading. Should be a red box with an arrow pointing off a side. Drop that in the render window where you want to travel to and set the home marker property to that xMarkerHeading. Give the marker a name you can find easy.

 

How do I do this? I tried adding a script to the marker and giving it the home marker property (object reference, right?) and it didn't work. Could you make another video for this please? Or show me a tutorial?

Link to comment
Share on other sites

@veritas22

 

You may need to deal with the possibility that the player already has the Bound Sword spell before he equips the ring. In that case the ring should do nothing otherwise when the ring is unequipped the Bound Sword spell will be stolen from the player! I've tested the code below so it should work. The formatting is a bit off; for some reason it won't display here like it does in Notepad++, when I copy and paste.

 

Scriptname BoundSwordScript extends ObjectReference  

Spell Property BoundSword auto
Bool PlayerHasSpellAlready 

Event OnEquipped(Actor akActor)
if (akActor == Game.GetPlayer())
	if (Game.GetPlayer().HasSpell(BoundSword))
	  PlayerHasSpellAlready = TRUE ; no need to add the spell if the player already has it
	endif
else
	Game.GetPlayer().AddSpell(BoundSword, true) ; add spell and tell player
       endif
EndEvent

Event OnUnequipped(Actor akActor)
if (akActor == Game.GetPlayer())
	if (PlayerHasSpellAlready == TRUE)
	;do nothing
	endif
else	
	Game.GetPlayer().RemoveSpell(BoundSword) 
       endif
EndEvent 

Edited by cooltrickle
Link to comment
Share on other sites

How about a script that runs on game start and makes your character randomly pick one of various idle animations when your character isn't moving/standing around? :)

 

So far I have a quest that starts when the game starts and attached to it this script. Also, everything is dependent on the "FNIS" mod so I can use completely new animations.

 

Scriptname PlayRandomIdle extends Quest  

Idle Property MyFNISspellc1  Auto  

Idle Property MyFNISspellc2  Auto  

Event OnGameStart (actor akactor)

Game.Getplayer().playidle(MyFNISspellc1)

Game.Getplayer().playidle(MyFNISspellc2)

EndEvent

 

But how do I make the game choose randomly between the two idles?

Edited by Phnx
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...