Jump to content

I Could Use A Bit of Scripting Help


Aalsper

Recommended Posts

I'm new here and I've been working on a hideout type house mod outside of the Imperial City. At first I just wanted to work on my modding skills, but now I want to make it special, so that I won't feel like I'm uploading just another house mod. I would really like to make a script that for X amount of time spent in the hideout your bounty is reduced by Y. Something like 250-500/hour. That way you could take a nap and presto your bounty is gone.

 

Thank you in advance,

Aalsper

 

 

 

Edit: Alright I I've searched through the scripts and I can't find anything for setting bounty. Theres SetInfamy, SetFame, no set Bounty, theres no B section in the list of commands even. I'm not sure where I could find it. But other than that I have found a new way to do it I think. Either GetInCell [cellname] or I could make it the OnActivate script to reduce bounty when you activate the bed. I'm not sure though. Thanks!

Link to comment
Share on other sites

There are three functions associated with bounty. Getcrimegold, Setcrimegold, Modcrimegold. Using those with getincell and set <variable> to gamehour you have pretty much all you need.

 

When looking at functions, it's easier to just look at the base scripting functions, and become familiar with them, before even thinking about using OBSE functions.

http://cs.elderscrolls.com/constwiki/index...ctions_%28CS%29

 

It's a smaller list, and can be a bit easier to utilize.

Link to comment
Share on other sites

Yeah I didn't have time to post again, but I am done with the interior and exterior, all I need is the script and the key. I tried playing with the script and found those crime gold options (Ctrl+F is your friend!), but when I tried it didn't work the script was:

 

ScriptName HideoutScript

 

Start GameMode

GetInCell Caveo

ModCrimeGold 1000

End

 

and I know that wouldn't achieve the desired effect (In fact if what I'm thinking is right it would increase your bounty by 1000) it did nothing. Any tips? I know it should be SetCrimeGold 0, but I'm still confused as to how to do the sleep/time script.

Link to comment
Share on other sites

A few things: Firstly, it's Begin, not Start. Secondly, the GetInCell function needs to be in an if line, and it needs an endif to match. Thirdly, unless the script is attached to the player (which is almost always a bad idea), you need to specify that you're talking about the player. Otherwise, it will think you're asking about whatever object the script is attached to. So it should look something like this.

ScriptName HideoutScript

Begin GameMode
  if (player.GetInCell Caveo)
  player.ModCrimeGold 1000
;Or -1000, if you actually wanted it to decrease your bounty.  I have no idea if it might make it a negative.
  endif
End

 

A script that checks every hour would be more complex. You'd need a variable to store the last "hour" checked, and update it frequently. You could rig it to work in mid-sleep, or just keep it rigged to GameMode and the changes will take place when the player wakes up. Assuming you attach it to a quest (Object scripts run sporadically at best when the player isn't in the same cell), it might look something like...

 

ScriptName HideoutScript
short LastHour
short DoOnce
float LastDay
float BountyModifier
;Declaring a few variables for use in the script.  Shorts and Floats both store numbers... 
;...with Floats taking up more space and holding larger ones.

Begin GameMode
;When attached to a Quest, GameMode blocks run every four or five seconds if not specified otherwise.

  if (DoOnce == 0)
;Setting up LastHour and LastDay if this script is running for the first time.
;They default to 0 (Midnight or Day 1), which could cause trouble

  set LastHour to GameHour
  set LastDay to GameDaysPassed
  set DoOnce to 1
  endif

  if (player.GetInCell caveo)
  if (LastHour <= (GameHour - 1) && LastDay > (GameDay - 1) )
;GameHour is a global variable that keeps track of the hour of the day.  It can hold fractions...
;...so we need to check if a full hour has passed or not.

	 set BountyModifier to ((GameHour - LastHour) * -1000)
;If an hour has passed, set BountyModifier to the difference between GameHour and LastHour...
;...times whatever we want the bounty to be modified by per hour.

  elseif (LastDay <= (GameDaysPassed - 1) )
;Same thing as hours, except for days.  Otherwise, it will get messed up when the clock goes past midnight.
;GameDaysPassed is a global variable that keeps track of the total days passed since the file started.
;Elseif lines run only if their condition is true and the previous if line (not separated by an endif...)
;...was *false*.  So this will only run if the above bit didn't.

	 set BountyModifier to ((GameDaysPassed - LastDay) * (((24 - LastHour) + GameHour) * -1000 )
  endif

;Now that we've set up BountyModifier, we'll check if it's not 0.  If so, modify the bounty and reset the variables.
  if (BountyModifier != 0)
	 player.ModCrimeGold BountyModifier
	 set BountyModifier to 0
	 set LastDay to GameDaysPassed
	 set LastHour to GameHour

;Not sure if this is necessary, but let's play it safe.  If the player's bounty is below 0, set it back to 0.
	 if (player.GetCrimeGold < 0)
		player.SetCrimeGold 0
	 endif
  endif

  else
;Else runs if the previous if-line (not separated by an Endif) was false.
;In this case, If the player isn't in the hideout, reset the variables.
  set LastDay to GameDaysPassed
  set LastHour to GameHour
  endif

end

Link to comment
Share on other sites

ModCrimeGold -1000 should work, but PayFine would be easier. The only problem is that it pays off your whole bounty. which isn't exactly what you wanted.
Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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