Jump to content

Script Request


TheSKPwningest1992

Recommended Posts

Hi. I'm not very good with scripting so could someone lend me a hand making a script?

 

I need one for a door that will only open to people with a level of at least 10, and message box appearing if the player is below the required level.

 

If it works and I get around to uploading the mod, you will be credited.

 

P.S. I'm not sure if this is the correct section for this request, if it is not, could you indicate which section it needs to be moved to?

Link to comment
Share on other sites

Not exactly a request for a mod, but I digress.

 

Basically you need to put an Object Script onto the door with code similar to the following:

Begin OnActivate player
   if player.GetLevel >= 10
       Activate player
   else
       MessageBox "You can only open this door at a level of at least 10!"
   endif
End

Looks pretty simple and straight-forward.

 

- The OnActivate block gets executed when someone tries to activate the object, in this case it's limited to when the player activates it only.

- Inside an OnActivate block you always have to call Activate, if you want it to activate ever again, or it will always only execute the script and never open.

- So I simply put this Activate call inside a quick level check for the player. The call works on the object the script is running on and passes who is activating it through the parameter.

 

(People often confuse this with activating the object passed, so "Activate player" does not mean activating the player, nor does "kill player" kill the player. Both are the same as "self.Activate player", "self" only being to represent the reference, so it's itself which gets activated/killed and "player" is only passed so the statistics know it's a kill counting to the player and such things.)

 

I hope it works.

 

(no credits necessary, it's way too simple)

Edited by DrakeTheDragon
Link to comment
Share on other sites

  • Recently Browsing   0 members

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