Jump to content

Need a script? Maybe I can help.


fg109

Recommended Posts

@Nephilim722

 

There isn't any function to set your crime gold with each faction so I had to improvise. Using this will cause the misc stat for total lifetime bounty to skyrocket. For all I know, this script could break your game as well.

 

 

Scriptname GreyCowlScript extends ObjectReference

MiscObject Property Gold001 Auto
Formlist Property CrimeFactionsList Auto
Int[] Property PlayerBounties Auto
{36 element array, same length as the formlist}
Int[] Property GreyFoxBounties Auto
{36 element array, same length as the formlist, all default 1000}

Bool Equipped

Auto State CowlOff
Event OnEquipped(Actor akActor)
	if (akActor == Game.GetPlayer())
		Equipped = True
		HandleEquip()
	endif
EndEvent
EndState

State CowlOn
Event OnUnequipped(Actor akActor)
	if (akActor == Game.GetPlayer())
		Equipped = False
		HandleUnequip()
	endif
EndEvent
EndState

State Busy
Event OnEquipped(Actor akActor)
	if (akActor == Game.GetPlayer())
		Equipped = True
	endif
EndEvent
Event OnUnequipped(Actor akActor)
	if (akActor == Game.GetPlayer())
		Equipped = False
	endif
EndEvent
EndState

Function HandleEquip()
GoToState("Busy")
Actor Player = Game.GetPlayer()
Faction TempFaction
int TempInt
int index = CrimeFactionsList.GetSize()
while (index > 0)
	index -= 1
	TempFaction = CrimeFactionsList.GetAt(index) as Faction
	PlayerBounties[index] = TempFaction.GetCrimeGold()
	Player.AddItem(Gold001, PlayerBounties[index], true)
	TempFaction.PlayerPayCrimeGold(False, False)
	TempInt = TempFaction.GetCrimeGoldViolent()
	TempFaction.SetCrimeGoldViolent(GreyFoxBounties[index])
	TempFaction.SendAssaultAlarm()
	TempFaction.SetCrimeGoldViolent(TempInt)
endwhile
GoToState("CowlOn")
if (!Equipped)	;player unequipped the cowl while we were doing our loop
	HandleUnequip()
endif
EndFunction

Function HandleUnequip()
GoToState("Busy")
Actor Player = Game.GetPlayer()
Faction TempFaction
int TempInt
int index = CrimeFactionsList.GetSize()
while (index > 0)
	index -= 1
	TempFaction = CrimeFactionsList.GetAt(index) as Faction
	GreyFoxBounties[index] = TempFaction.GetCrimeGold()
	Player.AddItem(Gold001, GreyFoxBounties[index], true)
	TempFaction.PlayerPayCrimeGold(False, False)
	TempInt = TempFaction.GetCrimeGoldViolent()
	TempFaction.SetCrimeGoldViolent(PlayerBounties[index])
	TempFaction.SendAssaultAlarm()
	TempFaction.SetCrimeGoldViolent(TempInt)
	Player.StopCombatAlarm()
endwhile
GoToState("CowlOff")
if (Equipped)	;player equipped the cowl while we were doing our loop
	HandleEquip()
endif
EndFunction

 

Edited by fg109
Link to comment
Share on other sites

  • Replies 272
  • Created
  • Last Reply

Top Posters In This Topic

Hello everyone.

I am a total noob at modding and over the past week i have been teaching myself. I think i have got it down pretty well except i don't know a single thing about scripting. Could you see if you can write a script for me?

 

I was wondering if it was possible to write a script that checks if you have an item (armor or weapon) equipped before using it in a recipe. I was making my own mod that is like Val's Crafting Meltdown and i was tired of melting down items that I had equipped. Is their a way to make it check if the item is equipped before crafting the recipe? And if the item is equipped make it so you cant craft the recipe it is included in?

 

Hope you can help me!

 

(edit) sorry my first script i wanted written was a total derp moment.

Edited by bluesmurph
Link to comment
Share on other sites

I have never scripted before and I seem to learn best by looking at something already made and figuring out how it was done. (One of those people who can actually take anything apart and always get it back together right) I am hoping to learn from this question: the step-by-step stuff doesn't always work as well for me.

 

I want to look at making a generic script that when the player marries a NPC it changes their clothing after the marriage is complete automatically. This stems from situations like marrying Muiri who wears, well, basically farmer's tattered rags: most player characters can get their spouse nice clothes by the time they marry them!! However, with running multiple characters I don't want to change the clothes of a NPC for every character, or have to do character-based mod loading. I want a generic script where I know how to duplicate the first script, change the script name, and then change the NPC & clothes to suit.

 

I know that Delphine changes clothes:

 

 

Scriptname MQDelphineScript extends ObjectReference  
{redress Delphine when in Riverwood inn}

Event OnLoad()
; put normal outfit on
if MQ106.GetStage() < 50
	; if she's in Riverwood
	if GetEditorLocation() == GetCurrentLocation()
; 			debug.trace(self + "OnLoad: Delphine changing back to normal outfit")
		ObjectReference selfRef = self as ObjectReference
		(selfRef as Actor).SetOutfit(NormalOutfit)	
	endif
endif
endEvent

Quest Property MQ106  Auto  

Outfit Property NormalOutfit  Auto 

 

 

 

Using Muiri for example, before marriage she has set as her Default Outfit inventory "FarmClothesOutfit02". Upon completion of the marriage ceremony I want her Default Outfit inventory to change to "MerchantClothesOutfit02NoHat". But I don't know how to change/use/modify/pick-apart Delphine's script to be able to change Muiri's clothes after the marriage: is it after a quest stage of the marriage that it should be done, or just a check if Muiri is married and then do it? As Pooh would say, "Oh Bother!" :ohdear:

 

Then I want to be able to know how to change that script for someone like Annekke Crag-Jumper who might need a clothing change from "MinerClothesOutfit01withGloves" to something like "ArmorLeatherAllOutfit" to suit their Light Armor skills.

 

I am also hoping it helps others who want to get clothing changes

 

Thanks in advance!!!

 

Anubis_Priest

Link to comment
Share on other sites

Hey there! Can you please help me with one thing? I need event that activates when player (or other actor, irrelevant) activates the actor in sneak mode (in my case horse). I had a try with:

Event OnActivate(ObjectReference senderRef)

if Game.GetPlayer().IsSneaking()

main code here

endIf

endEvent

 

but it does not work :(

 

Also i wonder if there is something like "this" in most programming languages, i mean the work that returns the current object on wich script is assigned.

Link to comment
Share on other sites

Hi fg109,

 

I was wondering if you knew of a way to remove a script from an existing actor. A mod I had added a script to regenerate and equip a default chestpiece to all the game followers, and now when the mod is removed the script remains attached to that actor and runs every onload, so they revert to this default chestpiece every time I fasttravel.

 

Is there a counter-script I can add that will basically one once and remove or disable these scripts from my current follower or something? The script appears to be "defaultEquipItemOnLoad". If I use player.placeatme to create a copy of the actor, the script is gone, it needs to remove it from existing instances of the actor.

 

Maybe something like a script that would be attached to a Lesser Power that could terminate/remove/or somehow disable scripts on your current follower that have a certain name. Is that possible?

Edited by Nite16
Link to comment
Share on other sites

... and now when the mod is removed the script remains attached to that actor and runs every onload, so they revert to this default chestpiece every time I fasttravel.

 

I am absolutely no scripter... but what it sounds like is your origional mod has caused your script that adds the armor to be imbedded in your save game; for the lack of a better explaination. It is quite common for someone to add a mod, play with it for a couple of in-game weeks (causing numerous saves), remove the mod and then find out that parts of the mod are still around: the save game file can hold large amounts of data, including changes made by mods no longer installed.

 

You might try the following to solve this, and it might work although it is a little bit of work:

1. Create a new "latest and greatest" save

2. Exit Skyrim and move all other saves (but the one above) into another back-up folder -> That means MOVE ALL other saves (including other characters) somewhere so Skyrim can't find them :biggrin:

3. Re-enter Skyrim and remove all followers from you (tell them "It's time we parted ways" or whatever) including dropping any mod followers that are always following you (be be certain)

4. Move your character to an interior cell by actually going there (not using a console command) that is completely follower free and forces you to move through other cells. Suggestions are

cells like Angarvunde03 (Catacombs), Avanchnzel03 (Boilery) and Bthardamz03 (Arcanex). PotemasCatacombs03 (Sanctum) is extra nice because you don't have to go all the way back, there is an exit to Skyrim.

 

5. Save the game in a new save

6. Delete the save made in #1 so no other save is present

7. Exit Skyrim to desktop (to ensure game re-load, not just cell re-load)

8. Re-load Skyrim and load that ONE save made in #6

9. Go out of the cell and find a follower you have origionally modified

 

I know someone will say you can skip some steps: but this makes sure something isn't forgotten (unless I forgot something :facepalm: )

 

If it works, you know it is your old mod getting embedded in the save file and may have to do that with every character. If not, than somehow there is another mod active with the same script.... :yucky:

 

EDit: Also, trying to use a power to remove scripts could, if it can be done, break the game if you accidentally remove quest and other required scripts... :mellow:

Link to comment
Share on other sites

Thank you so much for your response. The quests I'm currently working on don't require precise time. I just need to be able to stagger certain events to occur anywhere from 1 to 10 days apart. I've seen scripts from Oblivion that are set up similar to the one below (sorry, I can't seem to find the exact script anymore)...

 

set CurrentDay to GameDaysPassed

if GameDaysPassed >= ( CurrentDay + 1 )

setstage MyQuest 50

endif

 

Is there any benefit to setting the timer up in this way versus RegisterForUpdateGameTime or WaitGameTime? If so, then how should this script be written to work for Skyrim?

Link to comment
Share on other sites

I am taking this venture on myself but would love some help and knowledge on where to start. I had requested a Journal mod, like that of Kyoma's Journal Mod for Oblivion. It doesn't have to be that intricate just be able to have a personal in game journal. It is the very last thing I wish to have in my game to make it perfect for me. Cliched maybe lol. Sorry I tend to ramble, uh I have minor, very minor knowledge of working with the CS from Morrowind and Oblivion, but mainly player homes. I have never done any scripting. I am in the process of learning the CK and am comfortable with the controls and running through the menus, but I have no idea where to start creating this mod at. Quest Scripting would seem logical but i am uncertain that will teach me what I need to know about scripting a personal journal my character can use. Do you think you could help me find the information I might need to start me off.
Link to comment
Share on other sites

If it works, you know it is your old mod getting embedded in the save file and may have to do that with every character. If not, than somehow there is another mod active with the same script.... :yucky:

 

EDit: Also, trying to use a power to remove scripts could, if it can be done, break the game if you accidentally remove quest and other required scripts... :mellow:

 

Hey anubispriest, thanks for your in-depth response! I followed your instructions and snuck around in Agravunde Catacombs and made a save there with no follower. When I returned to Lydia, the same script appeared to be active - changing her chestpiece. :wallbash: I have no mods active that touch followers or armors whatsoever. They are all graphical in nature. When I use player.placeatme to make a new copy of Lydia, she doesn't exhibit this behavior, she keeps whatever armor on that she's given. Problem is, she also doesn't return home to Breezehome anymore, she returns wherever she was spawned - which is not ideal. Plus, I don't know what other behaviors or quests might be broken with the copy.

 

That's why I'm hoping there's a way to target and remove or disable the specific script on the original Lydia instance + all the other followers in the game. If you have any other advice I'd appreciate it muchly!

Link to comment
Share on other sites

Hey, I'm an amateur modder but I have the mod here: http://forums.nexusmods.com/index.php?/topic/632810-finished-scrpiting-a-weapon-mod-but-i-cant-model/ almost completly programed even though the graphics aren't there.

 

There are however two aspects I just can't seem to figure out that maybe you can help with...

 

1. How to make it actually fire multiple projectiles instead of a cluster of arrows modeled together into a single projectile

 

2. How to make it check if the player has a certain quantity of arrows, and fail to fire if the player doesn't. (and remove the arrows from the players inventory, the weapon is designed as a staff)

 

The projectile itself is working and so is the staff so I don't need help in that regard.

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