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...

Script Requests


Tonycubed2
 Share

Recommended Posts

Hi TESA!

 

I need to know how I can call a function when the player tries to use/equip a misc item on a specific trigger area. What kind of even do I use or what other line should I use?

 

Cheers!

 

Edit: It needs to recognize the player is inside a specific trigger area.

 

Edit2: I figured it out! For those who need the same thing, here's the script.

 

On the item you want to use:

GlobalVariable Property IsInsideArea auto ;The Area checker

Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer() ;Applies for player only, just a safety procedure
	if (IsInsideArea.GetValue() == 1) ;You get the value of 0 = false or 1 = true
        Debug.MessageBox("YourItem: I can't work, I'm not in the area")
	Else
	Debug.MessageBox("YourItem: I can't work, I'm not in the area")
	EndIf
  endIf
endEvent 

 

 

And for the area you put this bit of code:

GlobalVariable Property IsInsideArea auto

Event OnTriggerEnter(ObjectReference akActionRef)
	Actor actorRef = akActionRef as Actor
	if(actorRef == game.getPlayer())
		ShelterLocationMessage.Show()
		IsInsideArea.SetValue(1) ;True - player in area
	EndIf
EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)
	Actor actorRef = akActionRef as Actor
	if(actorRef == game.getPlayer())
		IsInsideArea.SetValue(0) ;False - player not in area
	EndIf
EndEvent 

 

 

Just don't forget to attach the properties and script properly and to create a globalVar :)

Edited by bleakraven
Link to comment
Share on other sites

Hey, I'm making a pre-thieves guild quest.   At the end of it, the player gets directions to go talk to Brynjolf.   I set Brynjolf as a reference allias with an objective to talk to him.   I set up a script that when Brynjolf is activated, the quest objective is complete.   The idea is that as soon as you are in dialogue with Brynjolf, the quest is complete.    On the reference alias screen, I use the script: 

 

 

Scriptname TG00StartBrynjolf extends ReferenceAlias  

Event OnActivate(ObjectReference akActivator)
        if (akActivator == game.GetPlayer() && GetOwningQuest().GetStage() < 20 && GetOwningQuest().GetStage() >= 10)
                GetOwningQuest().SetStage(20)
        endif
EndEvent

 

 

 

The problem is that when starting the TG quests, you don't initiate dialogue with Brynjolf.  He initiates it with you.  So in order to complete the quest, you have to talk to Brynjolf a 2nd time.   Now I suppose this is OK as you will be interacting with Brynjolf alot in the TG questlines.  

 

However, is there a script that can be set up so that the quest can be advanced when an actor(in this case, a reference alias) starts dialogue with the player?

Link to comment
Share on other sites

  • 3 weeks later...

Hi Guys 

I have been looking into trying compile a script that when the player equips a sword it adds a full set of armor to that player an then removes it when the player unequips the

weapon. I am really struggling getting my head around Papyrus, Lol If a person who is experienced in scripting could help or write the script so i could learn of it would be great. Thanks

Link to comment
Share on other sites

  • 1 month later...

Hey guys!

 

I'm trying to write a script that casts a spell on an actor when their attack kills another actor. This script effect will be applied to a magic effect / constant enchantment (for armor).

This is what I have so far, but I don't know how to make the event check for the death of the kill target, and then cast the spell on the killer. Do I need more properties to identify the two different actors?

 

Scriptname KARestoreStaminaSCRIPT extends ActiveMagicEffect  
 
SPELL Property RestoreStaminaAll  Auto  
 
Event OnDying(Actor akKiller) <------------ death target (i.e. npc)
 
Actor TargetActor = GetTargetActor()
 
; ; debug.trace(self + "OnDeath() casting RestoreStaminaAll from Target Actor:" + TargetActor)
 
RestoreStaminaAll.Cast(TargetActor, None) <-------------attacker (i.e. player)
 
EndEvent

Edited by edhelsereg
Link to comment
Share on other sites

Hi Guys 

I have been looking into trying compile a script that when the player equips a sword it adds a full set of armor to that player an then removes it when the player unequips the

weapon. I am really struggling getting my head around Papyrus, Lol If a person who is experienced in scripting could help or write the script so i could learn of it would be great. Thanks

 

I'm not that great at scripting, but I did write a script that works similarly to this, except it extends ActiveMagicEffect. Try attaching the script to the weapon and fill in the three properties. I hope this works for you! 

 

Scriptname SwordGenArmorScript extends ObjectReference
 

Armor Property cuirass  Auto  
 
Armor Property boots  Auto  
 
Armor Property gauntlets  Auto  
 
Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
    Debug.Trace("We were equipped by the player!")
game.getPlayer().EquipItem(cuirass)
game.getPlayer().EquipItem(gauntlets)
game.getPlayer().EquipItem(boots)
  endIf
endEvent
 
Event OnUnequipped(Actor akActor)
  if akActor == Game.GetPlayer()
    Debug.Trace("We were unequipped from the player!")
game.getPlayer().RemoveItem(cuirass)
game.getPlayer().RemoveItem(gauntlets)
game.getPlayer().RemoveItem(boots)
  endIf
endEvent

 

Edit: I tried compiling it and it didn't show any errors, but idk if it will work in-game though.

Edited by edhelsereg
Link to comment
Share on other sites

  • 2 weeks later...

Script Help 

 

Hello all, I am looking for a fairly simple script, I do not know a lot about the functions yet,

 

Looking for a script that will remove X amount of gold from player, when player removes ALL items from a container. 

 

The ALL part is important, because I can only find scripts that remove a SPECIFIC item. 

 

So I would want the player to be able ADD items, but is only charged when removing. 

 

I hope this was clear enough, This seems so simple but I am really stuck. 

 

Thanks in advance,

Fallhammer

 

 

Link to comment
Share on other sites

Script Help 

 

Hello all, I am looking for a fairly simple script, I do not know a lot about the functions yet,

 

Looking for a script that will remove X amount of gold from player, when player removes ALL items from a container. 

 

The ALL part is important, because I can only find scripts that remove a SPECIFIC item. 

 

So I would want the player to be able ADD items, but is only charged when removing. 

 

I hope this was clear enough, This seems so simple but I am really stuck. 

 

Thanks in advance,

Fallhammer

Hi,

 

I put a small script together. It should work, but will require SKSE.

 

ScriptName InsertScriptNameHere extends ObjectReference

MiscObject Property gold001 auto

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
	if GetNumItems() == 0
		Game.GetPlayer().RemoveItem(Gold001, 100)
	endif
endEvent
Link to comment
Share on other sites

  • 2 weeks later...

Hiya,

 

I'm looking for a script that functions like that of the Black Books from the Dragonborn DLC.  When you open the book and turn the first page the book teleports you to a defined location, so a marker in a world i'm making.  It doesn't have to have a return function, sending you back to the original place of casting if used again, but that would be very convenient!

 

Thanks

Link to comment
Share on other sites

Hello folks,

 

Before I get into my scripting question a little background - I wanted to add an OnHit summon effect to a non-staff weapon. I would attack an NPC, hit them, summon an atronach; and have the atronach attack the NPC as I attack it. In the CK I made a new actor as my atronach. I used the standard atronach template however I removed all Factions and added in a faction of my own that incluced the "Player" as the ally, I even made a parent/child relationship in the Relationships catagory. I used this atronach NPC as part of my magical effect, I added the magical effect to an enchant, and than I added the enchant to a sword. I can hit NPC's and summon the atronach however; the atronach won't stop attack me. It's like the AI thinks I'm the enemy and the emeny is the ally. I really have no idea what's going on...or how to fix it to make it work properly. So I'm hoping a script will do the job

 

That said - I have 2 scripts I would like

 

1. Summon Atronach OnHit

  • Player hits NPC
  • Sword player is using has 15% chance of summoning an atronach to assist the Player in combat
  • Sword player is using has a 30 seconds cooldown period before the sword can summon another atronach
  • Summoned atronach shall be summoned for 30 seconds

2. Activate Reflect Physical Damage/Reflect Magical Damage OnHit

  • Player hits NPC
  • Sword player is using has 15% chance of activating Reflect on the Player in combat
  • Sword player is using has a 30 seconds cooldown period before the sword can activate Reflect on the player
  • Reflect shall last for 30 seconds

Thanks a ton for any help on the atronach because I've really been slamming my head on this one. I often wonder if there's a bug in the game that prevents the item I created from working properly

Link to comment
Share on other sites

@Brecca - There is no way to know 'when' a page was turned. The black books are not really books, they are activators, that cause an animation to be played of you opening the book and tentacles surrounding you. It then does a Move on the player which acts like a teleporter. You can always move an xMarker to the player before teleport, so you can move back to the original location.

 

@Chiefsoap - The problem is your faction. I am guessing you either are using a dirty save game, or you have the faction setup wrong, or its not on the Atronach you created correctly.

  • Upvote 1
Link to comment
Share on other sites

Ah, my mistake I was getting the black books confused with the oghma infinium in functioning similarly.  I wanted the book to be able to be picked up first before activating the script much like you can do with the Ogh.Inf., then the flipping of the page transports you.

 

I tried decompiling the scripts with DEX.D to see if I could identify the functions of the scripts and trim the quest related stuff but those are beyond my freshman knowledge of scripting.

Link to comment
Share on other sites

@Chiefsoap - The problem is your faction. I am guessing you either are using a dirty save game, or you have the faction setup wrong, or its not on the Atronach you created correctly.

Thanks for the reply - do you know of a faction off the top of your head that I can use as a template; as far as I know I set it up properly but I am curious to cross reference it.

 

Also, adding it is as simple as adding under the Faction tab of the NPC, right?

Edited by Chiefsoap
Link to comment
Share on other sites

@Brecca - The scripts should be available for use through steam. When they were released, steam would put them in your source folder.

 

@Chiefsoap - FollowerFaction (or something like that) should work. And yes, you add it to the base objects faction tab.

But you have not said anything about using a clean save game for testing. Or verifying that the actual atranach you placed has the faction on it.

You might also want to check the aggression of your base creature object. If they are aggressive, they can ignore faction relations.

Edited by WillieSea
  • Upvote 1
Link to comment
Share on other sites

@Chiefsoap - FollowerFaction (or something like that) should work. And yes, you add it to the base objects faction tab.

But you have not said anything about using a clean save game for testing. Or verifying that the actual atranach you placed has the faction on it.

You might also want to check the aggression of your base creature object. If they are aggressive, they can ignore faction relations.

I will start with a clean save, it doesn't take too long so I'm going to start from scratch. New weapon/enchant/effect/npc. Shouldn't take too long, ill let you know what my results are.

Edited by Chiefsoap
Link to comment
Share on other sites

I will start with a clean save, it doesn't take too long so I'm going to start from scratch. New weapon/enchant/effect/npc. Shouldn't take too long, ill let you know what my results are.

It's still happening the same, even on a new save. I can also confirm that the aggression is unaggressive. How do I go about verifying that the actual atranach has the faction while in game?

Link to comment
Share on other sites

Sorry, there is no way to look at the faction on the object reference placed in the world.

 

Lydia has several factions on her base object. Your atronach should as well.

Normal atronach's should have the DaedraFaction on them. Make sure its removed from yours.

On the AI Data tab, make sure Aggression is not high. And if Aggro Radius Behavior is checked, it may also attack on sight.

Link to comment
Share on other sites

Sorry, there is no way to look at the faction on the object reference placed in the world.

 

Lydia has several factions on her base object. Your atronach should as well.

Normal atronach's should have the DaedraFaction on them. Make sure its removed from yours.

On the AI Data tab, make sure Aggression is not high. And if Aggro Radius Behavior is checked, it may also attack on sight.

Yep. All that's done, so I'm stumped. If you have time can you confirm that you are able to add a summon spell to a daedric sword, hit an npc, and summon a friendly atronach when you hit an NPC? I'm about to play with perks to see if I can add the effect with an OnHit trigger that would add a perk with a % chance to summon an atronach...

 

Happy 4th btw if you're American

Edited by Chiefsoap
Link to comment
Share on other sites

Since this is not script related, you may want to go over to the 'study hall' instead.

I have not been modding Skyrim in a few months, with my family obligations I currently have.

Yes, I am in the USA, Happy Independence day!

Thanks for the help thus far. I'll head over to the study hall to see if anyone is experiening and hopefully found a solution to the issue I'm having.

Link to comment
Share on other sites

  • 2 weeks later...

Hello :)

 

Since weeks im trying to write a script, but im a noob, reading a lot tutorials and looking for some similar scripts was more confusing than helpful. i hope to find some help here, a script to mess around with, to understand some of the Papyrus mechanics.

 

The Background, i build a Cell, a Prison with a Mine, 6 prisoners are working by day, mining, a Guard is watching them, so far it works all well with AI-Packages.

To get some live into the Scene:

one of the prisoners (randomly selected), stops working and try to escape (changing his Faction from PrisonerFaction to an enemy Faction)

the Guard catch and beat him until he turns back to work (changing back to PrisonerFaction, by low health)

this should happen 1 or 2 times a day, only 1 prisoner at once.

 

Thanks in advance for any help

Link to comment
Share on other sites

  • 3 weeks later...

Hi folks, I hope someone can help me out. I have a mod that I would like for my custom voiced NPC to fear spiders and run from them during combat in a tomb/dungeon/cave.  What I need is something that checks if spiders are in a cell, if so the NPCs confidence is changed to coward and he runs away. Once the spider count = 0, his confidence is changed back to brave and he rejoins the player. 

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I have an idea for a an Episodic Mod Series, Involving the Player Discovering Djinn/Genies across Skyrim, each with their own small story and quest line. The only problem im having is figuring out the best method of making the mechanics of the Djinn to work. Ive tried to find help at the Nexus forums, but with no joy. A Friend recommended I should try here.

They need to:

a) Be Summonable, If you have the Bottle in your Inventory, Using it Spawns the Djinn next to you. The Djinn is a fully interacterable NPC/Companion. Using the Bottle Again Returns them to it.

b)The Djinn needs to be Interactable. You can talk to them, they will give you the Story Quest, and they can obey your commads. Using a Dialogue Option, you can be granted three wishes, but you must be careful. After using all three, the bottle vanishes from your inventory, and you must find it again! (That last part im still contemplating, might be seen as unfair. Maybe just a wish recharge instead?)

Im just wondering how best it is to do this, if maybe I can alter the summonable creatues, like the ghostly horse or the daedric warrior, but replace the staff with a bottle, and the creature with the Djinn? Or maybe request a set of scripts I can use over and over, editing them for each Djinn. Thoughts?

If anyone would like to help out on this mod, id be much abliged smile.gif
Comment with your thoughts.

-The Northridge

Link to comment
Share on other sites

You might want to introduce yourself in the community forum. :D

 

A) could be done here.

B) would need to be asked in the quests or dialogue forums. I don't know how to do either, but I can make scripts.

 

I usually make the object an armor object, since you can attach scripts to them and use a variable to determine if your summoning or sending back the creature. You then place the creature at the players location, or at the holding cell. Pretty simple actually. My Levelers Tower mod has a summonable horse that works this way, but through a spell. A few changes and it would work on an object.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...