 |
|  |
 |
|
Jamski
|
 |
lol ED&D is officially full PvP LOL
May 2002 time: 05:32
|
|
code:
//Created by Jamski
//Put this OnUsed for each lever
//(leverone, levertwo leverthree, leverfour)
//Make four copies, one for each lever
//Change the text in bold for each lever
//Call the door to be opened DOOR_TO_OPEN
void main()
object oTarget;
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
int nInt;
nInt=GetLocalInt(oPC, "leverone");
if (nInt == 1)
{
nInt=GetLocalInt(oPC, "levertwo");
if (nInt == 1)
{
nInt=GetLocalInt(oPC, "leverthree");
if (nInt == 1)
{
nInt=GetLocalInt(oPC, "leverfour");
if (nInt == 1)
{
oTarget = GetObjectByTag("DOOR_TO_OPEN");
SetLocked(oTarget, FALSE);
AssignCommand(oTarget, ActionOpenDoor(oTarget));
}
}
}
}
}
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
SetLocalString(oPC, "leverone", "1");
}
This checks each time you pull a lever if all 4 have been pulled, and if so opens and unlocks the door called DOOR_To_OPEN. If not, it sets that lever to "pulled".
Clear?
-Jam
|
|
|  |
 |
|
Jamski
|
 |
lol ED&D is officially full PvP LOL
May 2002 time: 05:32
|
|
Bleh, sorry, forget all that. This one is better :
code:
//Created by Jamski
//Put this OnUsed for each lever
//(leverone, levertwo leverthree, leverfour)
//Make four copies, one for each lever
//Change the text in bold for each lever
//Call the door to be opened DOOR_TO_OPEN
//Best Version
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
SetLocalInt(oPC, "leverone", 1);
if (!GetIsPC(oPC)) return;
int nInt;
nInt=GetLocalInt(oPC, "leverone");
if (nInt == 1)
{
nInt=GetLocalInt(oPC, "levertwo");
if (nInt == 1)
{
nInt=GetLocalInt(oPC, "leverthree");
if (nInt == 1)
{
nInt=GetLocalInt(oPC, "leverfour");
if (nInt == 1)
{
object oTarget = GetObjectByTag("DOOR_TO_OPEN");
SetLocked(oTarget, FALSE);
AssignCommand(oTarget, ActionOpenDoor(oTarget));
}
}
}
}
}
-Jam
|
|
|  |
 |
|
DaShi
|
 |
The Taste of Japan
Sep 2000 time: 05:32
|
|
I couldn't get that one to work either. 
Here is the script I've been using:
code:
void main()
{
object oPC=GetLastUsedBy();
int nUsed1 = GetLocalInt(OBJECT_SELF, "LEVER_STATE");
int nUsed2;
int nUsed3;
int nUsed4;
//
// nUsed1 and nUsed2 are used to temporarily hold the states of the two levers.
// 0 is off, 1 is on
// LEVER_STATE is the permanent holding spot for the variables.
// Each lever stores its own LEVER_STATE
//
if(nUsed1 == 0)
{
ActionPlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
SetLocalInt(OBJECT_SELF, "LEVER_STATE", 1);
ActionSpeakString("You hear the sound of a metal pin being released.");
PlaySound("as_sw_metalop1");
nUsed1 = 1;
}
else
{
PlayAnimation(ANIMATION_PLACEABLE_DEACTIVATE);
SetLocalInt(OBJECT_SELF, "LEVER_STATE", 0);
ActionSpeakString("You hear the sound of a metal pin being reset.");
PlaySound("as_sw_metalcl1");
nUsed1 = 0;
}
object oLever1=GetNearestObjectByTag("DLEVER1");
object oLever2=GetNearestObjectByTag("DLEVER2");
object oLever3=GetNearestObjectByTag("DLEVER3");
object oLever4=GetNearestObjectByTag("DLEVER4");
nUsed1 = GetLocalInt(oLever1, "LEVER_STATE");
nUsed2 = GetLocalInt(oLever2, "LEVER_STATE");
nUsed3 = GetLocalInt(oLever3, "LEVER_STATE");
nUsed4 = GetLocalInt(oLever4, "LEVER_STATE");
string sUsed1=IntToString(nUsed1);
string sUsed2=IntToString(nUsed2);
string sUsed3=IntToString(nUsed3);
string sUsed4=IntToString(nUsed4);
SendMessageToPC(oPC, "Use1 is "+sUsed1);
SendMessageToPC(oPC, "Use2 is "+sUsed2);
SendMessageToPC(oPC, "Use3 is "+sUsed3);
SendMessageToPC(oPC, "Use4 is "+sUsed4);
if ((nUsed1 == 1) && (nUsed2 == 1) && (nUsed3 == 1) && (nUsed4 == 1)) // Are all levers on?
{
AssignCommand(oPC, ActionSpeakString("That should be all of them."));
object oDoor=GetNearestObjectByTag("VCD_DOOR2");
SetLocked(oDoor, FALSE);
}
}
When I pull lever 1, all the numbers read 0. When I pull lever 2; lever 1 reads 1, but lever 2 reads 0. If I then pull lever 1 again; lever 1 reads 0, and lever 2 reads 1. So each lever activates the previous lever pulled at the same time reseting itself to 0. Pulling the same lever twice does nothing.
|
|
|  |
All times are GMT. The time now is 05:32. Apolyton Time is 00:32. |
top of page
|
| archivepost |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|