Jump to content

Help me to understand!


Recommended Posts

I'm a noob to modding but I thought I knew something about scripting and normally I can get by but I'm having a rough time.

 

I made basically a blank workbench,.. I can place it in game ect. Menu shows nothing.. I expected that.

 

I've just now wrapped my mind around registering events. Do I basically have to register an event for any function I run? Or do I have to load every function I call into the item function list ahead of time?

 

Also how would I find the reference of an object? I realize how to do it with an object I place in the editor but how to I get like unique references of an object that could be placed wherever.

 

What are the rules for looping through an array? Where in my script is it legal? The wiki doesn't explain these rules. This language is crazy formal, I'm assuming is like one layer away from c++, but geez c++ isn't this formal.

Link to comment
Share on other sites

I would like to help, but the questions are rather generalised with too many entry points.

 

Suggest you describe what it is you would like to do as an outcome to frame context for more helpful answers.

Link to comment
Share on other sites

Event OnInit() ; Register for Activate event from the secret door

 

RegisterForRemoteEvent(SecretDoor, "OnActivate")

EndEvent Â

 

; Special event to receive when the door is activated

; Note the type in the event name matches the type of the first parameter, and is also the script where the

; event is originally defined.

 

Event ObjectReference.OnActivate(ObjectReference akSender, ObjectReference akActionRef)

 

Debug.Trace(akSender + " was activated by " + akActionRef) EndEvent

 

Ok so in the above example anyone would assume SecretDoor was previously declared as objectreference property SecretDoor Auto. Where does the value for SecretDoor come from? I'm assuming that this script would be on the form of the SecretDoor. Does the game automatically assume that the item that the script is attached to is the SecretDoor?

Edited by markyrocks
Link to comment
Share on other sites

There are sooooo many different ways of doing stuff you need to be clear about the outcome before getting granular on the implementation:

 

As a < type of user >, I want < some goal > so that < some reason >.

 

As a quest script I want to know every time a specific door has been opened so I can spawn a hostile radroach nearby.

 

PS this is trying to be helpful not difficult.

Link to comment
Share on other sites

I have a workbench, I want to open the menu...have it do stuff.

 

Does the registerforremote event basically define the reference. Like

Objectreference ref Auto

registerforremoteevent(ref,"event") ;this like essentially defines ref as the unique object reference associated with the object the script is attached to? Am I correct in saying this?

Link to comment
Share on other sites

I have a pretty good understanding of how other languages operate. The reason this bothers me is bc of the way the variable is defined. The only way I can describe it in every language I've used it is usually clear where a variable definition comes from. You can literally track a variable from the moment its defined to the moment its deleted. I guess the part that was/is confusing is the fact that it's not possible for the variable to be defined until runtime. Even in a situation like that the data would be coming from a user input or a iniread, something that you could physically see in the script.
Link to comment
Share on other sites

Ok I'm carefully reading though the reference literature and I think the issue I'm have is that I need to set the property of the script to point at the specific object that I created...omg I'm so dumb. I have no idea how I overlooked that. I was even using that some last night. Me personally I'd rather just type in the ID of the object inside the script, it would be less confusing for me. But whatever.
Link to comment
Share on other sites

You'll soon learn that it's pretty dumb to hard-code FormIDs into a script. In a perfect world, your script doesn't contain any values by itself. Maybe some local variables.

 

 

have it do stuff.

 

Please specify "stuff". Do you need a crafting workbench or do you need the workbench to do something besides making new items?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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