Jump to content

Need a script? Maybe I can help.


fg109

Recommended Posts

Real easy one. I need to disable an actor during daytime and re-enable the same actor at night. In Oblivion, is was basically this:

 

short turnon

 

Begin gamemode

 

If gamehour >=6 && gamehour < 20

disable

else

enable

end

 

Basically, the street light script. Except, I need this to work in Papyrus for Skyrim, and on an actor in real time. Basically, I want custom monsters in the game world at night, to make night time more dangerous. But I want them disabled during daylight hours.

 

Hope this is as simple as it seems. But then, I couldn't manage it using the Wiki, so...Thanks either way!

Link to comment
Share on other sites

  • Replies 272
  • Created
  • Last Reply

Top Posters In This Topic

@ BlackCompany

Just take a look at Automatic Light Switch. It provides the script you're searching for with a detailed tutorial on how to use it.

 

 

There's a "duh" moment for you. Handy information. And now I think about it, I downloaded the mod that gives main roads street lamps now. And they are off during the day. So, yeah...that probably uses the same or a similar script, too. Will check these out.

 

Thanks for the info. Really want more dangerous nights in the game world. Would liven things up.

Link to comment
Share on other sites

It's gonna fight with me to the bitter end. Only 1 error this time...

 

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 1

Scriptname PF_NomadHealingSpell1_01001D9F Extends Package Hidden

 

;BEGIN FRAGMENT Fragment_0

Function Fragment_0(Actor akActor)

;BEGIN CODE

akActor.SetFactionRank(TestFaction1, 0)

akActor.EvaluatePackage()

;END CODE

EndFunction

;END FRAGMENT

 

And the error

 

Starting 1 compile threads for 1 files...

Compiling "PF_NomadHealingSpell1_01001D9F"...

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\PF_NomadHealingSpell1_01001D9F.psc(8,23): variable TestFaction1 is undefined

No output generated for PF_NomadHealingSpell1_01001D9F, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on PF_NomadHealingSpell1_01001D9F

 

 

Hope this is the last one! So sorry about this!

Link to comment
Share on other sites

@AwesomeSkyrimDude

 

Make sure that you keep the "extends ReferenceAlias" in the first line. This tells the compiler that the script extends the reference alias script, meaning it inherits all its functions and properties.

 

 

@kryptopyr

 

If you're not using the vanilla follower quest to control your followers, then trying to use one of its quest properties to control your followers wouldn't work. You can do it, but since the two things are unrelated you're not going to get any results.

 

Using a combat override package sounds promising.

 

 

@M3rvin

 

SKSE with Papyrus support is still in closed beta, so you won't find any documentation (or functionality) for scripting.

 

 

@screamingabdab

 

If you have two NPCs sharing the same package to patrol the same route starting at the same location, why do you need a script for them to do the same thing at the same time? Wouldn't they start at the same time anyway?

 

 

@avenger404

 

That means that you didn't define a property for the faction. Package fragments are strange because you can't add properties to them right away. So first, instead of putting in any script in the fragment, just put in a semicolon ";" and compile it.

 

A script fragment for the package will be created. Now you have to close the package window, then re-open it. Now you can right-click the script and add properties to it. So you want to add a faction property named Test01 to the script.

 

After doing that, and setting the property to your custom faction, you can paste the real script into the script fragment window and compile it.

Edited by fg109
Link to comment
Share on other sites

@kryptopyr

 

If you're not using the vanilla follower quest to control your followers, then trying to use one of its quest properties to control your followers wouldn't work. You can do it, but since the two things are unrelated you're not going to get any results.

 

Sorry for not explaining myself properly. I meant that I could use a quest property from my own quest, the quest that does control my follower.

Link to comment
Share on other sites

Is there a way for the script to check to see whether or not follower has been hit or is under attack? Is there also a way to check whether the player has been hit?

 

I think in order to get the follower to do what I want, I need to make this the condition for the script to trigger the combat override. So basically, if neither the player nor the follower has been hit, then the follower will ignore combat. Once one of them has been hit, then I want to turn off the combat override to allow the follower to attack.

 

I would still like to have the radius limitation, but I think triggering combat mode off of actually getting hit is probably going to get me closer to what I'm looking for.

Link to comment
Share on other sites

If you have two NPCs sharing the same package to patrol the same route starting at the same location, why do you need a script for them to do the same thing at the same time? Wouldn't they start at the same time anyway?

 

They should, but because they are different distances from the start point one gets there first and sets off without the other one.

Link to comment
Share on other sites

@krptopyr

 

To use a property from a quest as a condition for your packages, you will need the condition function GetVMQuestVariable.

 

If you want to use a property from the quest in some other quest, then you need to do this:

 

MyQuestScript property MyQuest auto

;some event

int MyInt = MyQuest.IntProperty

;end some event

 

You can put a script on the follower that checks for OnHit events. For the player, I recommend using a reference alias script instead, because my game always crashes when I try to put a script directly on the player.

 

I suggest just modifying the script I gave you earlier to:

 

 

Scriptname Example extends Actor

Float property MaxAggroDistance = 1024.0 auto
Float property UpdateInterval = 5.0 auto
bool Registered

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
if (Registered) && (some check to see if the actor is not currently a follower)
	UnregisterForUpdate()
	Registered = False
elseif (!Registered && some check to see if the actor is currently a follower)
	RegisterForSingleUpdate(UpdateInterval)
	Registered = True
endif
EndEvent

Event OnUpdate()
Registered = False
if (some check to see if the actor is currently a follower)
	if (GetDistance(Game.GetPlayer()) > MaxAggroDistance)
		StopCombatAlarm()
		SetActorValue("Variable07", 1)	;or whatever the package condition is
		EvaluatePackage()
	endif
	RegisterForSingleUpdate(UpdateInterval)
	Registered = True
endif
EndEvent

 

 

And make sure the package has the ignore combat flag as well as the must complete flag checked.

Link to comment
Share on other sites

@screamingabdab

 

Why not change their patrol package a little? I haven't done much with packages, but I think it should be possible to make a package template like this:

 

1. Travel procedure (target = patrol start marker)

2. Wait or Hold Position procedure (completes when both NPCs at start marker (use a GetDistance check from each other))

3. Patrol

Edited by fg109
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...