My CK Help Thread

Post » Fri Jan 11, 2013 4:53 pm

PlayerREF will autofill, as will WhatEverPersonREF if it matches your NPC's EditorID. I recall reading that lights won't fade in/out using Enable/Disable, but you could approximate this by gradually increasing/decreasing the scale of the light REF, I believe.

Try:
ObjectReference Property kLightREF AutoEvent SomeEvent()	kLightREF.ToggleLightWithFade()EndEventFunction ToggleLightWithFade(ObjectReference akLightRef) Global	Float fScale = akLightRef.GetScale()	If fScale		While fScale > 0			fScale -= 1.0			akLightRef.SetScale(fScale)		EndWhile	Else		While fScale < 100.0			fScale += 1.0			akLightRef.SetScale(fScale)		EndWhile	EndIfEndFunction
User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Fri Jan 11, 2013 7:02 am

still not working , nothing gets enabled ...
User avatar
maria Dwyer
 
Posts: 3422
Joined: Sat Jan 27, 2007 11:24 am

Post » Fri Jan 11, 2013 10:24 am

You might need some notifications in the code to get a better idea of what's going on.
Just curious, what is the volume of your trigger box? If the box is too thin sometimes none of the Trigger related events get sent. Make it a couple of body-widths wide at least, if you can.
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Fri Jan 11, 2013 1:55 pm

Its as large as the room and as deep as two NPCs...
User avatar
scorpion972
 
Posts: 3515
Joined: Fri Mar 16, 2007 11:20 am

Post » Fri Jan 11, 2013 5:22 am

Then I used a xmarker and I linked it to the box

then I linked to the xmarker all braziers , ashes and lights and set all of those ( xmarkers only ) to initially disabled
et in the properteis the fade in and the player only but nothing ..
This may be a totally silly remark, and I apologize for it from the start, but if I take what you describe literally, I am compelled to ask: Did you add the xmarker to your lights as an enable parent or as a mere linked reference (as your post kind of implies)? The former should work better than the latter.

Also, if I were you, I would temporarily replace the xmarker with some simple visible object, like a standing stone or something, just to see if the triggering script works as intended, and once that is established, then proceed to get the lighting working.

P.S. I am also under the impression, that apart from fading not effecting lights, as suggested above, fading is not even passed through enable parent linkages for any kind of object. I agree that you may need to have each light individually managed by your script along the lines of what JustinOther described.

P.P.S. A couple of points on efficiency (to the best of my understanding, others might disgree):

1.
if (!PlayerOnly) || (triggerRef == Game.GetPlayer())
would be better than
if (triggerRef == Game.GetPlayer()) || (!PlayerOnly)
because the second test is skipped if the first one is enough, and Game.GetPlayer() is more resource demanding.

2.
If you refer to your set of lights in a script in some master object or whatever (like through an ObjectReference property or variable) those lights can easily become persistent in memory. Some people might argue that would be a needless use of resources, others might be indifferent. (It works the other way around If you set an enable parent in an object, as it references some master object, which alone needs to be persistent).

If I were you, I might consider adding to each light a script, that runs from when the cell is attached, and begins to periodically monitor the distance of the the player from some trigger point (or the enable state of an xmarker that uses your trigger script). When the player closes in on the trigger point (or the xmarker is enabled by your trigger script), the script launches the fade-on process and then shuts down. That should probably work without the lights having to become persistent.

I might actually try something like this on the lights (adapted from the script above by JustinOther), although I haven't tested it in practice
Spoiler
ScriptName LightFadeOn extends ObjectReferenceObjectReference property EnableMaster auto{Monitored to initiate gradual switch-on}float property fMaxScale auto{Maximum extent of light}int property iSteps auto{Number of growth steps}; This should usually equal the number of frames used for transition, but that may not necessarily be an absolute truth.bool Lit = FalseEVENT OnCellAttach()if Lit  returnendifSetScale(0.0)RegisterForSingleUpdate(1.0)endEVENTEVENT OnCellDetach()UnregisterForUpdate()endEVENTEVENT OnUpdate()if EnableMaster.IsDisabled()  RegisterForSingleUpdate(2.0)  returnendiffloat fDelta = fMaxScale / iStepsint iCounter = 0while iCounter < iSteps  iCounter += 1  SetScale(fDelta * iCounter)endwhileLit = True ; allows the light to remain on once litendEVENT
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Fri Jan 11, 2013 7:49 am

this is the error I get

Starting 1 compile threads for 1 files...
Compiling "QF_PROM_HyborianMound_01047909"...
d:\giochi\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_PROM_HyborianMound_01047909.psc(32,0): mismatched input 'Event' expecting ENDFUNCTION
d:\giochi\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_PROM_HyborianMound_01047909.psc(37,0): missing EOF at 'EndFunction'
No output generated for QF_PROM_HyborianMound_01047909, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_PROM_HyborianMound_01047909




and this is the code

Spoiler
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 5Scriptname QF_PROM_HyborianMound_01047909 Extends Quest Hidden;BEGIN ALIAS PROPERTY Conan;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_Conan Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY PullChain;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_PullChain Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY AtlanteanSword;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_AtlanteanSword Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_2Function Fragment_2();BEGIN CODESetObjectiveDisplayed(30);END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_3Function Fragment_3();BEGIN CODESetObjectiveDisplayed(40)Event OnDeath(Actor killer)    EndEvent;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_4Function Fragment_4();BEGIN CODESetObjectiveDisplayed(50);END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN CODESetObjectiveDisplayed(10);END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_1Function Fragment_1();BEGIN CODESetObjectiveDisplayed(20);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin comment
User avatar
gandalf
 
Posts: 3400
Joined: Wed Feb 21, 2007 6:57 pm

Post » Fri Jan 11, 2013 12:17 pm

That's not an NPC in the picture :) So yes, it works. It should work on any character that matches the list of races selected in the ArmorAddon.
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Fri Jan 11, 2013 7:16 am

You can't have an event in a function (OnDeath was empty anyhow).
Spoiler
ScriptName QF_PROM_HyborianMound_01047909 Extends Quest HiddenReferenceAlias Property Alias_Conan AutoReferenceAlias Property Alias_PullChain AutoReferenceAlias Property Alias_AtlanteanSword AutoFunction Fragment_0()	SetObjectiveDisplayed(10)EndFunctionFunction Fragment_1()	SetObjectiveDisplayed(20)EndFunctionFunction Fragment_2()	SetObjectiveDisplayed(30)EndFunctionFunction Fragment_3()	SetObjectiveDisplayed(40)EndFunctionFunction Fragment_4()	SetObjectiveDisplayed(50)EndFunction
User avatar
e.Double
 
Posts: 3318
Joined: Tue Jul 24, 2007 11:17 pm

Post » Fri Jan 11, 2013 6:14 pm

ok removing it solved but how do I do to activate a chain from inside the script? I have already placed it as alias but what's the command?
User avatar
Rusty Billiot
 
Posts: 3431
Joined: Sat Sep 22, 2007 10:22 pm

Post » Fri Jan 11, 2013 12:03 pm

If you don't have a material keyword on the item, the item will appear in the MISC category.
User avatar
Leticia Hernandez
 
Posts: 3426
Joined: Tue Oct 23, 2007 9:46 am

Post » Fri Jan 11, 2013 5:20 am

ok removing it solved but how do I do to activate a chain from inside the script? I have already placed it as alias but what's the command?

I have absolutely no clue what you are talking about? A chain? what do you mean?
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Fri Jan 11, 2013 1:06 pm

mmm could you send me a sample plugin ?that woudl solve a lot of my issues .... can it be applied also on the face? since the bodypaint I am doing goes from toes to eyes ...
User avatar
sunny lovett
 
Posts: 3388
Joined: Thu Dec 07, 2006 4:59 am

Post » Fri Jan 11, 2013 7:43 pm

ok removing it solved but how do I do to activate a chain from inside the script?
Alias_PullChain.GetReference().Activate(kSomeRefOrActor)
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Fri Jan 11, 2013 12:05 pm

it said ...

Starting 1 compile threads for 1 files...
Compiling "QF_PROM_HyborianMound_01047909"...
d:\giochi\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\QF_PROM_HyborianMound_01047909.psc(56,40): variable kSomeRefOrActor is undefined
No output generated for QF_PROM_HyborianMound_01047909, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on QF_PROM_HyborianMound_01047909
User avatar
Alex Vincent
 
Posts: 3514
Joined: Thu Jun 28, 2007 9:31 pm

Post » Fri Jan 11, 2013 11:38 am

Obviously, you need to pass that Function (a reference alias to) an Actor, not the word kSomeRefOrActor.
User avatar
cassy
 
Posts: 3368
Joined: Mon Mar 05, 2007 12:57 am

Post » Fri Jan 11, 2013 8:06 pm

what means?I need to activate when player pass what shoudl I type in it?

Game.GetPlayer() ?
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Fri Jan 11, 2013 8:36 pm

As you can see http://www.creationkit.com/ObjectReference.Activate_%28Papyrus%29, the Activate() function requires as a parameter an object reference (or actor), that is considered to do the activation.

Try Game.GetPlayer(), and the game will react as if it is the player who is yanking the chain. (Though it often may not really matter who is doing the yanking, that is still a required parameter.)
User avatar
W E I R D
 
Posts: 3496
Joined: Tue Mar 20, 2007 10:08 am

Post » Fri Jan 11, 2013 4:35 pm

That will work, but http://www.gamesas.com/topic/1409991-best-practices-papyrus/ recommends using a property for efficiency.
User avatar
oliver klosoff
 
Posts: 3436
Joined: Sun Nov 25, 2007 1:02 am

Post » Fri Jan 11, 2013 2:02 pm

Yes, that is absolutely so, although personally I prefer to use 'Game.GetForm(0x14)' in place of Game.GetPlayer() as that is very efficient (or 'Game.GetForm(0x14) as actor' if required).
User avatar
Sheila Reyes
 
Posts: 3386
Joined: Thu Dec 28, 2006 7:40 am

Post » Fri Jan 11, 2013 1:15 pm

what is actronaut?
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Fri Jan 11, 2013 4:50 pm

Yes, that is absolutely so, although personally I prefer to use 'Game.GetForm(0x14)' in place of Game.GetPlayer() as that is very efficient (or 'Game.GetForm(0x14) as actor' if required).
Same here, if not using a property. I've taken to manually editing my Game.psc so GetPlayer reads:
Actor Function GetPlayer() Global	Return Game.GetForm(0x00000014) As ActorEndFunction
That way, everything else that uses GetPlayer is sped up w/o editng anything else.

Also, Prometheus, you might be able to get away with passing 'None' as akActionRef

actronaut: Someone's alternative to akActionRef in critter.psc, although it doesn't alter the behavior of the function.
User avatar
priscillaaa
 
Posts: 3309
Joined: Sat Dec 30, 2006 8:22 pm

Post » Fri Jan 11, 2013 6:35 am

I've uploaded the proof-of-concept mod on Steam: http://steamcommunity.com/sharedfiles/filedetails/?id=119023520

It won't work for the face, because the face/head is special. You might be able to make something work using warpaints (as per your other thread).
User avatar
Robert Jackson
 
Posts: 3385
Joined: Tue Nov 20, 2007 12:39 am

Post » Fri Jan 11, 2013 6:59 am

Names of parameters are just that: names. They are only really relevant inside the Function. It's the type of the parameter that matters (e.g. Actor, or ObjectReference).
User avatar
loste juliana
 
Posts: 3417
Joined: Sun Mar 18, 2007 7:37 pm

Post » Fri Jan 11, 2013 6:52 pm

I used getplayer( ) and seemed to work but I seem not to be able to perform a stupid task by script , I used a default script for on triggerenter activate the linked ref .....
basically when the player enter the trigger box the door at his shoulder gets closed ....

any idea how I can do that? the default script doesnt work or seems not to get taken ...
User avatar
CArla HOlbert
 
Posts: 3342
Joined: Wed Feb 21, 2007 11:35 pm

Post » Fri Jan 11, 2013 10:55 am

what you mean is there a way to change ingame the warpaint somehow?
User avatar
Avril Louise
 
Posts: 3408
Joined: Thu Jun 15, 2006 10:37 pm

PreviousNext

Return to V - Skyrim