Door won't open
Zephirius
Member Posts: 419
I feel really silly asking this, but why won't the door in this script open? It's locked -
The test character has a strength score of 20, so I don't know what's happening...
void main() { object oPC = GetLastOpenedBy(); if (!GetIsPC(oPC)) return; object oDoor = GetObjectByTag("STRENGTH_DOOR"); if (GetAbilityScore(oPC, ABILITY_STRENGTH, 17)) { SetLocked(oDoor, FALSE); ActionOpenDoor(oDoor); } }
The test character has a strength score of 20, so I don't know what's happening...
0
Comments
TR
TR
Doing it this way unlocks and opens the door, but anyone can bypass the strength test for some reason.
The probable reason why it is currently not working is because GetAbilityScore() only returns the ability score which means that it will always equate to TRUE (only a zero equates to FALSE). Also the third parameter of that function should be either TRUE or FALSE.
TR
I'm trying anything with no luck. God, I can't code worth s**t!
By changing the event to OnFailToOpen() -
So do I use object oPC = GetLastOpenedBy()? If so I already tried it with no luck.
The Lexicon for OnFailToOpen tells us that GetClickingObject() is the function to use.
The strength test looks OK to me.
You might want to give feedback in the chat log (or whatever) otherwise the player will never know that their strength opened the door - or that a stronger player could have opened it.
BTW did you ever bother to look at and grab the things I pointed to in the Tutorial List and Essential Downloads (especially if you are new to scripting) thread from a week or 2 ago?
TR
I've downloaded them, that's all so far.
I changed it to a generic trigger that starts a conversation -
Try reading them. It'll help you. Without doing so you are only hampering yourself by trying to run before you can walk.
In the controls above the edit box that you type in, starting from 'B' go to the right. You'll see a number of dropdown box controls (upside down triangle). Click on the first one to open a menu with 3 choices including code. What you do is post your code in here, highlight it and select code from that menu.
TR
thanks. Edit: nvm. Fixed my op now
Oh, I can honestly say that I excel at running - and what's this thing you call "walking" - never heard of it.