Jump to content

Newbie Scripting Request


ebondream

Recommended Posts

So I've very hesitantly started wrestling with the Creation kit and Papyrus, and may well be in over my head.

 

My attempts at trying out various small things have failed so far--once my head's cleared, I'm gonna try to study the various tutorials and wikis floating around more attentively.

 

In the meantime, I would be very grateful if someone could show me the script that'd be used if I want to have an object that when activated (OnActivate Event) displays a text box with the player's current bounty in Whiterun Hold. Being shown a working example of that script would help me wrap my head around a few things, I think.

Link to comment

Faction Property CrimeFactionWinterhold Auto 
 
Event OnActivate(ObjectReference activater)
  Debug.MessageBox("The bounty for the Player in Whiterun for the crimes is " + CrimeFactionWinterhold.GetCrimeGold() + " and the bounty for non criminal activities is " + CrimeFactionWinterhold.GetCrimeGoldNonViolent())
EndEvent
Link to comment
Faction Property CrimeFactionWinterhold Auto 
 
Event OnActivate(ObjectReference activater)
  Debug.MessageBox("The bounty for the Player in Whiterun for the crimes is " + CrimeFactionWinterhold.GetCrimeGold() + " and the bounty for non criminal activities is " + CrimeFactionWinterhold.GetCrimeGoldNonViolent())
EndEvent

 

@ CPU: I guess you mean CrimeFactionWitherun don't you?^^

 

A word for explainations, Skyrim track two values of bounty, one that you get through hurting people (violent) and the other (non-violent) through anything else (trespassing, pickpocketing, stealing). I don't know why it's done this way, but the bounty you see sometimes in the game are both values added together.

Link to comment

Hmm, trying it out and I keep getting 0 for both values, whether I change it to Whiterun or not.

 

But at least the scripts compile now, so gonna keep trying a few things...

Where did you put the script? Did you fill the property of the Crimefaction correctly?

Link to comment

 

Hmm, trying it out and I keep getting 0 for both values, whether I change it to Whiterun or not.

 

But at least the scripts compile now, so gonna keep trying a few things...

Where did you put the script? Did you fill the property of the Crimefaction correctly?

 

 

I attached it to an activator (WETempActivator, just to test things). And I put in the script basically as CPU posted it, starting with

 

Faction Property CrimeFactionWhiterun Auto

 

Which I thought would take care of everything...

Link to comment

Then you need to fill in the property.

 

The line Faction "Property CrimeFactionWhiterun Auto" sets the crime faction a bit like a variable for the script to work with internally, but you still need to set where it is actually pointing at.

 

When you open up the activatery on the right side hit edit properties -> select the crime faction -> hit edit value -> select "CrimeFactionWhiterun" from the list.

 

If you worte everything right hitting auto-fill should also work.

Link to comment

Okay, while I'm at it:

 

I'm now slowly learning how to use the SexLab Hooks to make certain things happen--to create a message whenever a sex animation ends, for example. But I'm a bit confused as to how I'd check, for instance, whether the sex animation that just ended involved a particular type of character, a Whiterun Guard for example.

 

EDIT: Actually, figured it out. Go me :P

Link to comment

Hmm, but do I see correctly that if I want to catch everything that covers the chest/body, I have to check for a lot of different potential values of the SlotMask there? Since there are things like robes that cover various combinations of body, head, hair...

 

I'm guessing the Keyword thing (checking for ArmorCuirass or ClothingBody) would work except for armor added by other mods that didn't put those keywords in?

Link to comment

And while I'm at it, I may as well pile on my impossible problems...

 

 

I don't suppose there's a way to essentially add a dialogue choice when a guard is arresting you? (The bit where you have to choose jail, paying bounty, fighting etc... I'd like to have an additional option)

 

At any rate I'm guessing not without changing vanilla files...

Link to comment

Hmm, but do I see correctly that if I want to catch everything that covers the chest/body, I have to check for a lot of different potential values of the SlotMask there? Since there are things like robes that cover various combinations of body, head, hair...

 

I'm guessing the Keyword thing (checking for ArmorCuirass or ClothingBody) would work except for armor added by other mods that didn't put those keywords in?

 

I think you can just look for an individual slot but I am not entirely sure, I have not tried it.

And while I'm at it, I may as well pile on my impossible problems...

 

 

I don't suppose there's a way to essentially add a dialogue choice when a guard is arresting you? (The bit where you have to choose jail, paying bounty, fighting etc... I'd like to have an additional option)

 

At any rate I'm guessing not without changing vanilla files...

 

I think it would need to be added to the arresting dialogue though it may conflict with Prison Overhaul as I think that modifies that as well.

Link to comment

The OnEquip event must be on the item itself to trigger. I guess what you want is OnObjectEquip to listen for the player to equip something. This then goes in a script attached to an alias pointing to the player.

 

I'd be enough to check the slot mask of the chest slot for most armors/ robes since they are usually at least equipped in that slot. As you already seen yourself, mod added armor might do it diffrent and use a diffrent slot, but still cover the body.

 

If you see non-vanilla armor/ chlothes a common thing in your mod it wouldn't hurt to check for both. You could do it like this:

Keyword Property ClothingBody auto
Keyword Property ArmorCuirass auto

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)

If akBaseObject.GetSlotMask() == 0x00000004 || akBaseObject.HasKeyword(ArmorCuirass) || akBaseObject.HasKeyword(ClothingBody)

; do stuff

endif
EndEvent

This checks if the equipped objects goes in the chest slot, if not it checks if it has the ArmorCuirass keyword, if not it checks if it has the ClothingBody keyword. That seem rather foolproof to me^^

 

* * *

 

You can add new dialouge lines to vanilla quests without any problems. Though you can easily mess something up^^ New dialogues don't produce conflicts, since they don't acually override somethinge. Even if two mods add new options to the same dialogue both would be displayed since they simply exist next to each other. To add a new option to the crime dialouge you need to go into the DialogueCrimeGuards quest to the player dialogue tab (the dialogue view tab is way to full here). The next part is a bit difficult so I made some screenshots.

 

Go to the ForceGreet Branch and create your own topic among the others.

 

 

7dPfoWF.png

 

 

Then you need to link you new option to the existing dialouge so it show up in game. Got to the HelloBlocking branch and doubleclick the lower two dialogues. On the left side right click and choose add link. Here select your the first level of your new dialogue.

Do the same in the wanted branch for the lower three dialogues.

Don't thoug the dialogues with the red line, beause these are very important for the Forsworn Consiracy quest in markarth.

 

 

lk3j06P.png

 

wdo4AJd.png

 

4qwTSWx.png

 

 

 

 

Now you should better test in game to see if it worked and if the normal options also are still there^^

Link to comment

The pics don't seem to load for me :/ Will try and see if I can still manage it.

 

But what I meant about the amor. isn't the problem that an item's SlotMask value equals to the sum of all the slots it occupies? So

If akBaseObject.GetSlotMask() == 0x00000004

Only catches armors that cover the body and -only- the body. Whereas the Archmage Robe for instance seems (via its ArmorAddons I guess? To cover the head, hair and circlet slot as well. I tried making a chest that sends me a message box with the SlotMask for every item I put inside--I get 4 for most armor and clothes, but the Archmage Robes gets me 4102. But yeah, I guess in combination with the keywords it should catch most things...

 

EDIT: The dialogue bit seems to work, thanks for your help :)

 

Link to comment

Still don't load for me, but that may well be a problem on my end. I'm pretty sure I got things working with the dialogue anyway, your guide was easy enough to follow :)

 

And the armor thing was actually easier to solve than I thought:

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
Form Cuirass = Game.GetPlayer().GetWornForm(0x00000004)
if Cuirass == akBaseObject
Debug.Messagebox("That was chest armor")
else
Debug.Messagebox("That was not")
endif

endevent

I get a few weird additional notifications on testing that but I think that's because of what some other mod is doing and the definition is obviously too broad.

Link to comment

Hmm. Don't suppose there is a relatively easy way to get a script to fire everytime, say, the PC kills a bandit? Since OnDeath has to be attached to each actor...

 

Yes, I'm afraid there is no easy way. Maybe there is a workaround, but that depends on what you exacty try to do.

Link to comment

Ok...

 

What about tracking if/how long the player has been mining/quarrying/woodchopping? Or failing that, can the OnItemAdded event somehow be used to track whether a piece of firewood was acquired via woodchopping, as opposed to picking it up or buying it from a vendor?

Link to comment

Try an event OnItemAdded, it has the "container" property, do just a simple debug.trace to see what the container is, and try to quarry, wood-chop, and buy.

And see what the containers are.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use