Jump to content

Door Script Trouble


Recommended Posts

So I'm trying to get a door to unlock if a player is at a certain stage of a quest and a certain NPC is inside a certain room, but, for some reason, it won't do anything. When I go to activate the door in-game to test it, even after I am 100% positive that the conditions have been met, nothing happens. Here's the code I'm using:

 

scn ppMS29ICDoorSCRIPT

 

begin OnActivate

if (player.getStage PalacePolitics >= 10 && DracniKuldir.getInCell ICPalaceMausoleumPP == 1)

Unlock 1

MessageBox "The door is unlocked. Dracni must be inside."

player.setFactionRank ElderCouncilFaction 0

Activate

endif

else

Activate

endif

end

 

It's an object code that I attached to the door itself, if that information is crucial.

If anyone can tell me what I need to change to enable a person to actually...walk THROUGH this door...it'd be very helpful.

 

Thanks in advance.

Link to comment
Share on other sites

Ditch one of the endifs and the parentheses and see if it'll work. Personally I don't like &&s, but it should work.

Ah, the GetStage function is used improperly..I almost missed it :). It doesn't need the player.

 

begin onactivate
if GetStage PalacePolitics >= 10 && DracniKuldir.getInCell ICPalaceMausoleumPP == 1
	Unlock 1
	MessageBox "The door is unlocked. Dracni must be inside."
	player.setFactionRank ElderCouncilFaction 0
	Activate
else
	Activate
endif
end

Link to comment
Share on other sites

GetInCell is an unreliable function in my eyes. Sometimes it does not work for me. Some ideas:

(1) Can you restructure your mod so that DracniKuldir is always where he is supposed to be at Stage 10? Then the line would only need one condition:

begin OnActivate
if GetStage PalacePolitics >= 10
Unlock 1...

(2) Can you make it so the door opens at stage 11 and stage 10 advances to stage 11 when DracniKuldir is in position?

begin OnActivate
if GetStage PalacePolitics >= 11
Unlock 1...

(3) Can you have it so DracniKuldir has an AI package that makes him walk into the room and thereby automatically unlock it on the way? You would have to have the script close the door after he opened it, and the script would be there just for the messagebox.

 

(4) Can you make the door into a reference and have another script unlock it when DracniKuldir is if position? (Like with If GetDistance DracniKuldir <= 1000)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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