Jump to content

Help with a script please


Job4aCowboy

Recommended Posts

Per fifty's note, I think you need to look back at where you got that example script and figure out what actronaut is supposed to be. Then, you need to declare that property and link it up in the CK.

 

Also, I would not use states for this. I think you can do everything you need just using the onactivate event.

 

I'm sorry, I would edit your script to give a better idea what I mean, but I'm on a qwerty keyboard right now.

 

Thanks for the reply, I got it working. Like you said it didn't need states, I just removed the reference to the player and used the "else" then activate(actronaut).

 

Thanks again

Link to comment
Share on other sites

Per fifty's note, I think you need to look back at where you got that example script and figure out what actronaut is supposed to be. Then, you need to declare that property and link it up in the CK.

 

 

No, no, no, that is not how variable declaration works in function definitions! :p

 

When you are declaring a function, everything in parentheses is a parameter of the function. Based on the script's base type (whatever it "extends") you should be using the same parameters that the base class uses... the best reference for all of these is of course the Wiki. For example, here is the page on Event OnActivate for the ObjectReference script.

 

Properties are completely different. They exist outside your functions, enabling you to refer to forms (actors, weapons, miscobject's, formlists, etc).

 

Hope that clears things up a little. :D

Link to comment
Share on other sites

I don't want to pick on this topic, but let me try to better explain.

 

Here is a function declaration:

 

EVENT onActivate(objectReference actronaut)

 

This is the OnActivate event, which is declared in the base class for ObjectReference. When you "override" the base class with your version of an event, you must use the same types of parameters, but you can name them whatever you want.

 

Most people would declare OnActivate like this:

 

Event OnActivate (ObjectReference akActionRef)

 

See how it has the same parameter? A single ObjectReference. You can name it however you want though, and you use that name inside of the function (or event) when you need to refer to it. Properties can be used in any function anywhere in your script, because they're defined outside of the functions.

 

"actronaut" is just some programmer's joke. Get it? :p

Link to comment
Share on other sites

Scriptname SEEGraveRobbersScript extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto
{Message to say why you can't use this without RequiredWeapon}

Keyword Property linkedRefKeyword Auto
{Chest that is linked to Grave Activator}

Event onActivate(objectReference akActivator)
if (akActivator as Actor) == game.getPlayer()
if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1
SEEMESSAGEGraverobfailure.Show()
else
getLinkedRef(LinkedRefKeyword).activate(akActivator)
endIf
endIf
endEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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