Jump to content

Scripting issues


Lolz1234567

Recommended Posts

Im working on a mod where you need to 'investigate' certain objects to progress the story.

 

A couple years ago I created a script that allowed the player to activate any object and have it show a message, I've tried to emulate this effect but with no success.

Unfortunately the original mod files with said scripts were deleted on my old computer.

This is my current script

 

ScriptName tsTestScript
ref testref
begin gamemode
set testref to REFNukaLamp.getlinkedref
end
begin OnActivate testref
ShowMessage tsInvestigateWall
end

 

I understand there's an activator object type, however i'd rather leave figuring out BSA's until the very last.

Any help appreciated, thanks.

Link to comment
Share on other sites

"begin OnActivate testref" is interpreted by the game as "Run this block when I am activated by testref", which will never happen since 'testref' is not an actor. You need to add a script to 'testref' with an OnActivate block, so something like this:

begin OnActivate Player
	ShowMessage MESGMyMessage
end
Link to comment
Share on other sites

 

"begin OnActivate testref" is interpreted by the game as "Run this block when I am activated by testref", which will never happen since 'testref' is not an actor. You need to add a script to 'testref' with an OnActivate block, so something like this:

begin OnActivate Player
	ShowMessage MESGMyMessage
end

Ah okay, so what activates the object goes after Onactivate.

What exactly do you mean by 'add a script to 'testref'? Is there some weird function required to connect the ref to the onactivate?

Link to comment
Share on other sites

You need to create a unique activator using the same mesh as the object you want to be investigated. For the sake of example, let's say you want the player to find fingerprints on a bottle.

 

You need to go to Misc. Items in the left pane of the Object Window, find the empty Nuka Cola bottle, double click it to open up its properties and make a note of the Model's file path. In our case, it's Clutter\Junk\SodaBottle01.NIF

 

Next, you need to scroll down to Activator in the left pane of the Object Window, right-click on the list of activators in the right pane and click 'New'. When the new window pops up, give your activator a unique Editor ID (like, MyModClueBottleActivator, or something), and then select Clutter\Junk\SodaBottle01.NIF as the activator's model. (You may have to extract the bottle's NIF mesh from the Fallout - Meshes.bsa before the GECK will allow you to select it) Click OK to create your new activator. Then, you write your object script with the OnActivate block, like I gave you earlier.

 

Save your script, then open up the Activator that you just created. There is a drop-down list named Script, beside which should be written NONE. Click that drop-down menu and find the name of the script you just wrote. Click OK, and now your new activator will have your script attached.

 

In the Cell View window, load the worldspace where you want the clue to be found, then drag and drop your new bottle activator into the world. Save your plugin and use your mod manager of choice to enable it. Now, when you visit that location in the game, you will find your new bottle activator, and when you target it and press the Use key, your script with run and show your message.

Link to comment
Share on other sites

 

What exactly do you mean by 'add a script to 'testref'? Is there some weird function required to connect the ref to the onactivate?

 

 

No ... they mean just add a script to the base-id , which "testref" would be based on.

But the results of a script will be specific to the reference that runs the code block.

Hence a variable stored for "MyActivator01Ref" won't be the same for "MyActivator02Ref"

Since the instance of the script storing the variable won't be the same instance.

Hope that helps ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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