Thread Tools
Old January 8, 2004, 06:30   #31
Jamski
Alpha Centauri Democracy GameAlpha Centauri PBEMACDG Planet University of TechnologyACDG The Cybernetic Consciousness
Deity
 
Jamski's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
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
__________________
1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
Taht 'ventisular link be woo to clyck.
Jamski is offline  
Old January 8, 2004, 06:34   #32
Jamski
Alpha Centauri Democracy GameAlpha Centauri PBEMACDG Planet University of TechnologyACDG The Cybernetic Consciousness
Deity
 
Jamski's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
Whoops. Change the last block to :

Code:
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
SetLocalInt(oPC, "leverone", 1);
Its an Int, not a sString
__________________
1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
Taht 'ventisular link be woo to clyck.
Jamski is offline  
Old January 8, 2004, 06:40   #33
Jamski
Alpha Centauri Democracy GameAlpha Centauri PBEMACDG Planet University of TechnologyACDG The Cybernetic Consciousness
Deity
 
Jamski's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
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
__________________
1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
Taht 'ventisular link be woo to clyck.
Jamski is offline  
Old January 8, 2004, 07:09   #34
Jamski
Alpha Centauri Democracy GameAlpha Centauri PBEMACDG Planet University of TechnologyACDG The Cybernetic Consciousness
Deity
 
Jamski's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
Just tested this last one - it works PERFECTLY. Ok, the levers don't animate, but that's not my problem. Use buttons instead or add an animation

-Jam
__________________
1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
Taht 'ventisular link be woo to clyck.
Jamski is offline  
Old January 9, 2004, 00:45   #35
DaShi
Emperor
 
DaShi's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Sep 2000
Location: The Taste of Japan
Posts: 9,611
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.
__________________
“As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
Civ V Civilization V Civ5 CivV Civilization 5 Civ 5 - Do your part!
DaShi is offline  
Old January 9, 2004, 02:16   #36
DaShi
Emperor
 
DaShi's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: Sep 2000
Location: The Taste of Japan
Posts: 9,611
I got help from the Bioware boards. It seems that you can't use GetNearestObjectByTag() to refer to the object running the script. By just changing them all to GetObjectByTag(), it worked.
__________________
“As a lifelong member of the Columbia Business School community, I adhere to the principles of truth, integrity, and respect. I will not lie, cheat, steal, or tolerate those who do.”
Civ V Civilization V Civ5 CivV Civilization 5 Civ 5 - Do your part!
DaShi is offline  
Old January 9, 2004, 04:25   #37
Jamski
Alpha Centauri Democracy GameAlpha Centauri PBEMACDG Planet University of TechnologyACDG The Cybernetic Consciousness
Deity
 
Jamski's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
Mine works for me. I've used it in the DoA with you wondering how the door opens Perhaps you mixed up the renaming when you made your four copies?

I see you wanted each lever to have an on-off state. Mine are off until used and then stay used forever. When the fourth one is used, the door opens. Yours is more of a puzzle. I may steal it, if that's ok

-Jam
__________________
1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
Taht 'ventisular link be woo to clyck.
Jamski is offline  
Old January 9, 2004, 05:16   #38
Jamski
Alpha Centauri Democracy GameAlpha Centauri PBEMACDG Planet University of TechnologyACDG The Cybernetic Consciousness
Deity
 
Jamski's Avatar
 
Local Time: 14:57
Local Date: November 2, 2010
Join Date: May 2002
Location: lol ED&D is officially full PvP LOL
Posts: 13,229
Heh, just saw you on the bioware boards

-Jam
__________________
1) The crappy metaspam is an affront to the true manner of the artform. - Dauphin
That's like trying to overninja a ninja when you aren't a mammal. CAN'T BE DONE. - Kassi on doublecrossing Ljube-ljcvetko
Check out the ALL NEW Galactic Overlord Website for v2.0 and the Napoleonic Overlord Website or even the Galactic Captians Website Thanks Geocities!
Taht 'ventisular link be woo to clyck.
Jamski is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:57.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team