Jump to content

[LE] Help with Scripting


Recommended Posts

I am new to skyrim modding, but have some experience with Java. I would like to create a script that does a few things.

  1. Check a players inventory for an item (should be an if statement i would think)
  2. if an item is there, then I want it to open a portal to a custom cell. (Moving an object to a new location)
  3. I also want the portal in the custom cell to link to the portal opened (Change where the portal places the player upon activation?)
  4. When the player goes back through the portal I want the portal to "close" and to restock the custom cell.

I would like to be able to understand the way to code myself but at least at the moment it is a bit confusing.

If anyone could help me out, and possibly explain in detail how I could go about making this script, or even part of it, I would be very grateful.

Link to comment
Share on other sites

GetItemCount is the function required to check if an object is within a container or inventory. An example usage:

If PlayerRef.GetItemCount(myObject) >= 1
; do something
EndIf

This says, check the player's inventory and if there is at least one or more of myObject do our designated thing.

NOTE: PlayerRef and myObject are example variable names. You would need to declare and define your own variables as needed whether they be properties or local variables. It should be noted that if used as a property PlayerRef will auto-fill when said button is pressed on the property window in the Creation Kit.

 

However, before you can use that, you must decide what event will trigger it. Will the player be activating an object? Will they be walking near or into a specific location? Will they be casting a spell?

 

As far as teleporting from one location to another, I'll defer to others as I have not done much with that and do not wish to steer you the wrong way.

Link to comment
Share on other sites

The way that i would do such a thing is :

1) Create a script that upon checking and finding the specific object from player inventory it would "remove" the item & "activate" (this mean have a remove from inventory & activate function) an xMarker activator that it has an on/off Ref script (enable/disable).


2) The xMarker activator will be Linked to the portals in both cells, the xMarker activator it's going to have a disable/enable Ref or add item to container script (if you are using container) for adding-placeing your item somewhere in the second cell.


3) In the second cell you will have to put a Trigger box or some sort of activator somewhere that upon activating it, it'll enable a trigger box in your first cell's portal exit that upon entering it, it'll disable or delete the portal (this mean having a script on/off or delete Ref on the trigger box).


* I don't know what you mean restock cell.

Edited by maxarturo
Link to comment
Share on other sites

well by restock, i mean, to reload the loot chests and what not. And the way that the player will activate this, is by opening a chest that has it, when they do a diaglog box will pop up and give them 2 options, one will open a door/portal to the secret room. Atm I am playing around with the scripting to get comfortable with the new language. It is similar to java, but still different enough to be a tad confusing at first.

 

Thank you all for your help, I will work a ton more on this in a little bit and see what I can get working.

On another note, is there a way to move static objects, incluing the rotation, (like doors) uising scripts?

Link to comment
Share on other sites

There is a mod that does that "kuaxes positioning" or something like that, i don't remember it's exact name, but you can see how the mod does it.

- Restock = use the "respawn" option in the container's edit base menu.

Link to comment
Share on other sites

Ok, so my mod at the moment, has a door stored in the secret room, and when a chest is opened that has the item in is (this script is only on the chest outside the riverwood in) it moves the door to the player and then the player can use the door to get into the secret room. However there are a few issues,

  1. the door is rotated at an angle that is kinda odd
  2. when the player goes back through the door to go to skyrim, Instead of the door taking me to the other door it is linked to, it takes me to some giants camp, same place every time
  3. And the door isnt moved back when using the door in the secret room.

I have the mod on dropbox for now while I am working on it. Feel free to take a look and tell me what im doing wrong, I am sure there is a lot lol.

 

https://www.dropbox.com/s/lh7km5gg5rh3a72/SecretRooms.esp?dl=0

 

 

Link to comment
Share on other sites

#1 Have it move the door to an Xmarker orientated to how you wish the door to appear.
#2 Is funny ... probably stumbled upon the default spawn in point when it has no defined spawn point.
When you moved the door you lost that ...
#3 Sound like something isn't triggering or set in the script to reset the door hard to say not looking at the script.
Could also be related to the fact you moved it ... idk

 

I can't see your script(s) so it's hard to help here without just creating it myself ...
I take it what you are looking to do is:
When you add a special item to this chest a door appears.
When you take the item out the door disappears ... Is that right?

Off the top of my head I'd say just put the door down where you want it by the chest and use

Door Property SecretDoor Auto
...
SecretDoor.Enable(true) / SecretDoor.Disable(true) ... commands to fade it in and out, the (true) = fade rather than pop.
You can't use it or see it if it's not enabled. Also on the door object check so it starts disabled ...


Also, I noticed you moved something in the aaaMarkers Cell ... you will need to use TE5TEdit and remove that.

Edited by NexusComa
Link to comment
Share on other sites

Actually, the goal would be to have a single container (not just a chest) in each dungeon to have an item. that item would trigger a door/portal to spawn (move to) the player, after they open the container, and remove the item, then allow them into a secret loot room. Then when the player leaves the room, it puts the door/portal back in the secret room cell. so it "closes".

Link to comment
Share on other sites

I've never tested this before but I'm sure you will have problems teleporting to a location that was not already defined as a teleport location on load with load doors. I may be wrong...
Considering you wish to add this to many places ... You may want to reconsider my 1st option. Mods like Home in a Bottle with a few modifications could pull this off pretty easy
and automatically know right where to teleport you back to where ever that may be. It all comes down to one spell you create and a dropped Xmarker to port you back when you leave.
It looks hard at first but it actually super simple stuff. You would have to edit the trigger that kicks off the spell but that should be easy enough.


Link to comment
Share on other sites

  • Recently Browsing   0 members

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