Jump to content

Need help getting a Script to work


chitokusan

Recommended Posts

Ive been working on a mod that involves using doors to join custom factions ive made. the idea is that by activating a door, it will join the faction i want it to and teleport you to the desired area. problem is, when i actually script the door with my makeshift script, it doesnt even teleport the player, or make the player leave or join the desired faction. this is a sample of the script i made:

 

Scriptname Soonsoforth

Begin OnActivate

 

Player.SetFactionRank 0teamred0 0

 

Player.SetFactionRank 0teamyellow0 -1

 

End

 

any idea what im doing wrong? i treid switching the script to just an activator but that didnt work either

Link to comment
Share on other sites

Well, for one, don't use numbers at the beginning of an identifier. The compiler might mistake it with the start of an actual hexadecimal FormID and then will not find it. Naming a Faction "0teamred0" is a sure-fire way to get into trouble.

 

Then, for an activatable object still to activate when using an OnActivate block you need to explicitly call "activate" at the end of the block. You might want to make that block an "OnActivate player", so it only fires when it's the player activating it, and as such you can call "activate player" at the end, to explicitly tell it's the player activating the teleport door (might be necessary for the teleport to know "who" to teleport).

Link to comment
Share on other sites

Well, for one, don't use numbers at the beginning of an identifier. The compiler might mistake it with the start of an actual hexadecimal FormID and then will not find it. Naming a Faction "0teamred0" is a sure-fire way to get into trouble.

 

Then, for an activatable object still to activate when using an OnActivate block you need to explicitly call "activate" at the end of the block. You might want to make that block an "OnActivate player", so it only fires when it's the player activating it, and as such you can call "activate player" at the end, to explicitly tell it's the player activating the teleport door (might be necessary for the teleport to know "who" to teleport).

will i have to make a new faction with a new ID? i dont think you can change IDs for factions

Link to comment
Share on other sites

will i have to make a new faction with a new ID? i dont think you can change IDs for factions

 

The EditorIDs are the internal names you give the records yourself. Those can be changed at all time, and for everything as far as I know, and it will only ask if you want to rename the one or create a new one each time. What's created internally and you can't change is the FormID, the hexadecimal number your EditorIDs get translated into, for example in a compiled script. I think, if you rename an EditorID, the FormID will even remain totally untouched.

 

I'm not sure about factions, and I've got no way to access my game drive right now to check it myself. But I'm pretty sure you can change their EditorIDs as well at any time. For what it's worth, the entry fields you can change the content are the EditorIDs, the ones which are read-only the FormIDs. This alone tells something already I guess.

Link to comment
Share on other sites

You can change faction names, but not in the conventional way. Scroll through the faction list until you find one you need to change, click on it ONCE, wait one second, then click on it again. A cursor should appear at the end of the faction name, at which point you can change it. Once you've renamed it, click somewhere else on the list. You'll still get the "yes" or "no" option to create a new faction entry. Select "No" and your faction will be renamed.

 

Doors don't activate in scripts the same way other objects do. To activate a door with a script, it will need to look like this:

 

Scriptname YaddaYaddaYadda
Begin OnActivate Player ;makes sure the following bits only happen when the Player activates the door

 Player.SetFactionRank AATeamred0 0

 Player.SetFactionRank AATeamyellow0 -1

 TeamRedDoorRef.Activate Player, 1 ;makes sure the door teleports the Player

End

Link to comment
Share on other sites

  • Recently Browsing   0 members

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