NWN2 Toolset

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Lever Puzzle

 
Post new topic   Reply to topic    NWN2 Toolset Forum Index -> NWN2 Script Vault
View previous topic :: View next topic  
Author Message
Hellcow



Joined: 17 Jan 2007
Posts: 100
Location: Denmark

PostPosted: Sun Feb 25, 2007 10:26 am    Post subject: Lever Puzzle Reply with quote

Since Christoph077 confirmed this script works, I suppose I should post it here in the vault for all to use.

The request for the puzzle was to have ten levers, the PC needs to spell a word to unlock the door, if misspelled the script will reset and the door will of course not open.

Example: 10 levers each lever has a letter assigned to it A,D,E,T,W,Y,S,U,R,L: The PC has to pull only the levers that spell W,A,T,E,R.

You need to place a variable on each of your levers that spell: WATER
The lever named W needs to have a int variable named: Lever_W sat to 1
The lever named A needs likewise to have a variable named: Lever_A sat to one - and so on with the rest of your levers, each a variable with the letter they are named. Then place script below in the OnUsed script of all your levers.

The script can easily be modified to spell other words, you'll just have to change the variable name in the script and the letter you place on your levers.

Code:

//23.02.07 Lever puzzle by Hellcow
void main()
{

object oPC = GetLastUsedBy();

if (!GetIsPC(oPC)) return;

if (GetLocalInt(OBJECT_SELF, "Lever_W")== 1)
   {
   SetLocalInt(oPC, "spelling", 1);
   FloatingTextStringOnCreature("You hear a click as you pull the lever", oPC);
   return;
   }

if (GetLocalInt(OBJECT_SELF, "Lever_A")== 1)
   {
   if (GetLocalInt(oPC, "spelling")== 1)
   {
     SetLocalInt(oPC, "spelling", 2);
     FloatingTextStringOnCreature("You hear a click as you pull the lever", oPC);
    return;
   }
   FloatingTextStringOnCreature("You pull the lever but nothing happens", oPC);
   SetLocalInt(oPC, "spelling", 0);
   return;
   }

if (GetLocalInt(OBJECT_SELF, "Lever_T")== 1)
   {
   if (GetLocalInt(oPC, "spelling")== 2)
   {
     SetLocalInt(oPC, "spelling", 3);
     FloatingTextStringOnCreature("You hear a click as you pull the lever", oPC);
    return;
   }
   FloatingTextStringOnCreature("You pull the lever but nothing happens", oPC);
   SetLocalInt(oPC, "spelling", 0);
   return;
   }   

if (GetLocalInt(OBJECT_SELF, "Lever_E")== 1)
   {
   if (GetLocalInt(oPC, "spelling")== 3)
   {
     SetLocalInt(oPC, "spelling", 4);
     FloatingTextStringOnCreature("You hear a click as you pull the lever", oPC);
    return;
   }
   FloatingTextStringOnCreature("You pull the lever but nothing happens", oPC);
   SetLocalInt(oPC, "spelling", 0);
   return;
   }   

if (GetLocalInt(OBJECT_SELF, "Lever_R")== 1)
   {
   if (GetLocalInt(oPC, "spelling")== 4)
   {
   FloatingTextStringOnCreature("You hear a click as you pull the lever and the door opens.", oPC); 
 
    //Open door
   object oDoor = GetObjectByTag("door_tag");

   SetLocked(oDoor, FALSE);

   AssignCommand(oDoor, ActionOpenDoor(oDoor));   
     return;
   }   
   FloatingTextStringOnCreature("You pull the lever but nothing happens", oPC);
   SetLocalInt(oPC, "spelling", 0);
   return;
   }
   
   FloatingTextStringOnCreature("You pull the lever but nothing happens", oPC);
   SetLocalInt(oPC, "spelling", 0);
   return;
   
   }
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    NWN2 Toolset Forum Index -> NWN2 Script Vault All times are GMT
Page 1 of 1

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum





Powered by phpBB © 2001 phpBB Group

Chronicles phpBB2 theme by Jakob Persson (http://www.eddingschronicles.com). Stone textures by Patty Herford.

Abuse - Report Abuse
Powered by forumup.com free forum, create your free forum!
Created by Raulken of Hyarbor S.r.l.
TOS & Privacy.

Page generation time: 0.03