Making an Activator only activate once.

Post » Sun May 18, 2014 1:46 am

I must have done this a 100 times before but I haven't been scripting for a while. I need an activator to activate once and then become dormant. I know there is a DoOnce command but I don't know where to put it and how to script it correctly in the following script. Help please.

Quest Property MyQuest AutoInt Property StageToSet AutoGlobalVariable Property PaintCount AutoEvent OnActivate(ObjectReference akActionRef)If akActionRef == Game.GetPlayer()    endIf    GoToState("Done")If PaintCount.GetValue() < 6.0PaintCount.Mod(1.0)EndifIf PaintCount.GetValue() == 1.0debug.messagebox("You have found a Cityscape. Five more to find.")MyQuest.Setstage(StageToSet)EndifIf PaintCount.GetValue() == 2.0debug.messagebox("You have found a Cityscape. Four more to find.")Endif; more script to add hereIf PaintCount.GetValue() == 6.0debug.messagebox("You have found all the Cityscapes.")MyQuest.Setstage(StageToSet)EndifEndevent
User avatar
Mariana
 
Posts: 3426
Joined: Mon Jun 12, 2006 9:39 pm

Post » Sun May 18, 2014 1:10 am

Hard to script on my phone, but you can fill in the rest.


auto state Ready

Event OnActivate(Objectreference akActionRef)

;your stuff here

GoToState("Done")

EndEvent

EndState

State Done

Event OnActivate()

BlockActivation()

EndEvent

EndState
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Sun May 18, 2014 1:21 am

Appreciated BigBadDaddy but I know I'm a doing something wrong because it won't compile. I know you are limited scripting by phone.

User avatar
Margarita Diaz
 
Posts: 3511
Joined: Sun Aug 12, 2007 2:01 pm

Post » Sat May 17, 2014 10:40 pm

Hi,

a good resource to look to resolve your problem are the vanilla defaultOnActivateXYZ scripts. Most of them are designed to act as a one-shot-activation (the DoOnce or DisableWhenDone property).

Here is a short solution for your activator script:

ScriptName MyOneShotActivatorScript extends ObjectReferenceQuest Property MyQuest AutoInt Property StageToSet AutoGlobalVariable Property PaintCount Autobool Property DoOnce = true Auto{Fire only once?  Default: TRUE}auto State WaitingForActivationEvent OnActivate(ObjectReference akActionRef)	If akActionRef == Game.GetPlayer()		GotoState("Activated") ;disable further activation unless stated		BlockActivation(true)				If PaintCount.GetValue() < 6.0			PaintCount.Mod(1.0)		Endif		If PaintCount.GetValue() == 1.0			debug.messagebox("You have found a Cityscape. Five more to find.")			MyQuest.Setstage(StageToSet)		Endif		; ...		; more script to add here		; ...		if DoOnce == false ;is further activation allowed?			GotoState("WaitingForActivation")		endif	endifEndeventEndStateState Activated	;nothing to do hereEndState

-docblacky

User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Sun May 18, 2014 2:21 am

Thanks doc, I knew it was something like that, I haven't scripted for ages so I am well out of touch. Don't suppose you'd do me another favour? After the painting has been activated once and player tries to activate it again, because the activate message still appears even though it can't be activated, could you add a message that says something like "Already Discovered". Would make this script more complete. Cheers.

User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Sun May 18, 2014 12:44 pm

No problems :D

Change the state Activation section with this script:

State ActivatedEvent OnActivate(ObjectReference akActionRef)	if akActionRef == Game.GetPlayer()		debug.MessageBox("This Cityscape is already discovered.")	endifEndEventEndState

-docblacky

User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Sun May 18, 2014 3:01 am

Your the doc, doc

User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm


Return to V - Skyrim