Jump to content

Quick scripting question


braveheart101

Recommended Posts

Hey, thanks for clicking.

 

I'm trying to get a cut scene working in an upcoming mod. I found this on the internet:

 

"ScriptName Cutscene Extends ObjectReference

 

Actor Property PlayerREF Auto

ObjectReference Property Point1 Auto

ObjectReference Property Point2 Auto

ObjectReference Property Point3 Auto

 

Event OnTriggerEnter(ObjectReference akActionRef)

If akActionRef == PlayerREF ; Limit this trigger to the player only.

PlayerREF.SetAlpha(0)

PlayerREF.SetGhost(True)

Game.DisablePlayerControls(True, True, True, False, True, False, True) ; Disable all controls except looking.

Utility.Wait(0.1) ; Give the script time...

PlayerREF.TranslateToRef(Point1, 100)

Utility.Wait(5.0) ; After 5 seconds, proceed to next point.

PlayerREF.TranslateToRef(Point2, 50)

Utility.Wait(10.0) ; After 10 seconds, go to next area

PlayerREF.TranslateToRef(Point3, 200)

Utility.Wait(20.0) ; Watch the final scene, and then...

PlayerREF.SetAlpha(1)

PlayerREF.SetGhost(False)

Game.EnablePlayerControls()

EndIf

EndEvent

 

How to use this script: Make a new trigger box, and then add this script to it. Make 3 XMarkers, and define them in the Properties Window. Enter your new trigger, and see your cool cut-scene!"

 

 

 

 

 

My question is, what does it mean 'define them in the Properties Window'? I named all xmarkers Point1, Point2 and Point3 if that's what I was supposed to do. But I may (and most probably) be wrong.

 

Overall, what I did was I added a new Trigger box, with a new script (all that^^). Then I added the 3 x markers and named them.

 

Also, I am assuming that 'Enter your new trigger' refers to in-game when you walk as the player into the place where the box is. Might that be where I'm going wrong and skipping a step?

Link to comment
Share on other sites

what does it mean 'define them in the Properties Window'?

From the triggerbox's window (the same place you added the script to it) you should be able to right-click on the script and select "edit properties", or something to the same effect.

PlayerREF, Point1, Point2 and Point3 are all declared in your script but you have to tell the script exactly what they are to refer to. Here, in the Properties window, you can use the drop-down boxes to match up your properties to the markers you've made. Don't forget to define PlayerREF as the player as well!

 

Also, I am assuming that 'Enter your new trigger' refers to in-game when you walk as the player into the place where the box is.

Correct. Walking into the trigger with that script attached will provoke the OnTriggerEnter event.

 

 

~Hope this helps.

Link to comment
Share on other sites

Is the drop-down you're talking about the one in the 'Add script property' window?

 

I'm a tiny bit confused, because the 'player' isn't in that list, and I'm not too sure how I would go about 'matching up' the markers to the points... :)

 

Thanks a lot for helping me by the way! really appreciated :)

 

Also, what property type should I use for the actual points?

Link to comment
Share on other sites

http://www.creationkit.com/images/e/ec/Properties_Tooltip.jpg

This shows the script property window. I presume you can already get this far.

 

Here you should see a list of all the properties declared within the script. In the screen-shot, these properties are box1, box2 and box3. You need to select each property in turn and click the 'Edit Value' button at the right of this window. You will then be presented with a drop-down list of all the relevant objects from which you must select the objects corresponding to your properties. Whenever you refer to a property within the script, you are actually referring to the value that you have selected here.

 

I have never used properties for the player before so, if you can't refer to the player this way, try adding this to your script, just underneath the OnTriggerEnter line:

PlayerREF = Game.GetPlayer()

This makes use of the Actor Property, PlayerREF, as a variable. Game.GetPlayer() returns the player's actor reference, which is what you would have been selecting within the properties window.

Edited by LtMattmoo
Link to comment
Share on other sites

Ah, I see where the problem was, I think. :) For me, that window is empty and I have to add the properties manually. And what I don't know is what type the properties needed to be. I get what kinda stuff should be happening from what you said, unfortunatelly I suppose the problem is the property adding. Any idea what type it should be? I see a rather large drop-down list, when I make it, default being 'Int' and having things such as 'action' and 'activator'.

 

 

 

 

(also, the adding of "PlayerREF = Game.GetPlayer()" crashes the CK for me. Not sure why, it's a simple line, i recognise it from when I use a similar thing in-game in the console.

 

 

 

http://www.creationkit.com/images/e/ec/Properties_Tooltip.jpg

This shows the script property window. I presume you can already get this far.

 

Here you should see a list of all the properties declared within the script. In the screen-shot, these properties are box1, box2 and box3. You need to select each property in turn and click the 'Edit Value' button at the right of this window. You will then be presented with a drop-down list of all the relevant objects from which you must select the objects corresponding to your properties. Whenever you refer to a property within the script, you are actually referring to the value that you have selected here.

 

I have never used properties for the player before so, if you can't refer to the player this way, try adding this to your script, just underneath the OnTriggerEnter line:

PlayerREF = Game.GetPlayer()

This makes use of the Actor Property, PlayerREF, as a variable. Game.GetPlayer() returns the player's actor reference, which is what you would have been selecting within the properties window.

Link to comment
Share on other sites

Actor Property PlayerREF Auto

ObjectReference Property Point1 Auto

ObjectReference Property Point2 Auto

ObjectReference Property Point3 Auto

 

The properties are already defined in the script, type ObjectReference. If the properties window is empty for you, the script probably needs to be re-compiled.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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