Archvile
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > Switch Scripting Question
 
Author
All times are GMT. The time now is 11:29. Post New Thread    Post A Reply
White
Green Marine


Posts: 35
Registered: 06-02


I was wondering if anyone could help me with this problem. I have a door and two switches. I want the player to have to flip both switches in order to open the door. I don't want the door to partially open or anything however. Upon clicking on the first switch it will seem as though nothing happens but after clicking the second the door will open. I'm naive when it comes to scripting, (as some of you can probably see), so I ask the populace of Doomworld for help. Thank you.

Black/White

__________________
-The King of Thieves-

Old Post 10-26-02 22:16 #
White is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3626
Registered: 05-00


I guess you're using ZDoom, if not... well blah. Anyways, I did not do any ACS for quite some time, but this script should work:

--- snip ---

int door_counter;

script 1 (void)
{
door_counter++;

if(door_counter >= 2) {
Door_Open(tag_id_of_your_door, 100);
}
}

--- snip ---

Then assign script 1 to both switches and make sure they can only be activated once (if you don't know how to do it, read it up in your editor's manual). tag_id_of_your_door is the... um... tag id of the sector that's supposed to be the door, for example 1. The second argument of Door_Open is the speed, I just took 100, I don't really know how fast it is :) Just play around with it a bit to get a good speed.

__________________
this sig is in my pants | WIP - WADs In Progress: post your WADs!

Old Post 10-26-02 22:39 #
boris is online now Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
The Ultimate DooMer
(former) /newstuff Chronicler


Posts: 4701
Registered: 03-02


Or, if you want something like those switches in Quake, try this:

----start of code----

int switchcount;

script 2 (void)

{
switchcount++;
switch (switchcount)
{
case 1:
print(s:"only 1 more to go..");
break;
case 2:
print(s:"sequence completed!");
Door_Open (tag, speed);
}
}

----end of code----

The tag is the tag on your door.
As for speeds, 16 is normal door speed and 32 is turbo door speed.

The only disadvantage of this method is that it can only be used once in a map - I found that out by trying to have 3 of them in one of my maps.

(unless there is a way that I don't know about)

Old Post 10-27-02 00:31 #
The Ultimate DooMer is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Ichor
The Mysterious Red Square


Posts: 6934
Registered: 07-02


There is a way to use that more than once. Try this:


At the top, before the first script, put this in:

int mapvar0;

Then do this:

script 1 (int arg0)
{
mapvar0++;
if(mapvar0 == 1)
{
print(s:"only one more to go");
}
else if(mapvar0 == 2)
{
print(s:"sequence completed");
Door_Open(arg0, 15);
mapvar0 = 0;
}
}

Now, for both of the switch lines, set it to ACS_Execute, with the tags 1, 0, 1, 0, 0.
The first '1' is the script number, and the second '1' is the arg0 variable, which refers to the door that will be opened.

If you want to make another two switch door somewhere else in the map, all you need to do is make two more switch lines, but this time, change the second '1' to, say, '2':

ACS_Execute(1, 0, 2, 0, 0)

__________________
0.666 - The number of the Millibeast

Old Post 10-27-02 01:03 #
Ichor is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
ReX
Senior Member


Posts: 1743
Registered: 05-00



Ultimate DooMer said:
(unless there is a way that I don't know about)
This example, with 3 switches works just fine:

//////////////////////////////////////////////////////////////////////
// Script 8: Sets sequencer charges //
// Begins countdown to destroy ICF //
//////////////////////////////////////////////////////////////////////

int switchcount1;
script 8 (void)
{ switchcount1++;
switch(switchcount1)
{case 1:
print(s:"\ccOne of three sequencer charges has been set.");
Delay(105);
break;
case 2:
print(s:"\ccTwo of three sequencer charges have been set.");
Delay(105);
break;
case 3:
print(s:"\ccThree of three sequencer charges have been set.");
Delay(105);
print(s:"\ccProceed to evacuate the installation.");
Delay(105);
print(s:"\ccAuto-destruct of all major systems will occur...");
Delay(105);
print(s:"\cc...in one minute.");
Delay(35);
print(s:"\ccRepeat. Proceed to evacuate the installation.");
Delay(105);
sequencer=1;
Thing_Spawn(55,T_CACODEMON,90);
ACS_Execute(24,0,0,0,0);
break;
}
}

__________________
We hate what we fear

Old Post 10-27-02 03:19 #
ReX is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
mmnpsrsoskl
Spasmolytic


Posts: 1787
Registered: 06-01


So Ichor, you would just use that script? You won't have to change arg0 to anything else? Just provide the arg0 in the script excution?

__________________
You know, I never really updated this thing right here, so I thought i'd better put something in here, such as this annoying and stupid sentence. Yeehaw.

Old Post 10-27-02 09:48 #
mmnpsrsoskl is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
The Ultimate DooMer
(former) /newstuff Chronicler


Posts: 4701
Registered: 03-02


So with this I can have more than 1 switchcount in a map? (as I had a timed destruction sequence, a 2 switch door and a 6 switch secret in my map. But I had to modify the last two to leave the important one intact)

Last edited by The Ultimate DooMer on 10-27-02 at 11:51

Old Post 10-27-02 11:39 #
The Ultimate DooMer is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Ichor
The Mysterious Red Square


Posts: 6934
Registered: 07-02


Yes, although you could change 'arg0' to 'door' to simplify things a bit.

__________________
0.666 - The number of the Millibeast

Last edited by Ichor on 10-27-02 at 14:28

Old Post 10-27-02 14:23 #
Ichor is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
The Ultimate DooMer
(former) /newstuff Chronicler


Posts: 4701
Registered: 03-02


Thanks ReX, it works now. I've restored the 2-switch door and 6-switch secret to their original states.

Old Post 10-27-02 17:00 #
The Ultimate DooMer is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
ReX
Senior Member


Posts: 1743
Registered: 05-00



Ultimate DooMer said:
So with this I can have more than 1 switchcount in a map?
Yes, indeed, you can have more than 1 switchcount as you've discovered.

__________________
We hate what we fear

Old Post 10-27-02 18:37 #
ReX is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
mmnpsrsoskl
Spasmolytic


Posts: 1787
Registered: 06-01



Ichor said:
Yes, although you could change 'arg0' to 'door' to simplify things a bit.

So the linedef would still be set too:

ACSExcute (1,0,1,0,0);

?

__________________
You know, I never really updated this thing right here, so I thought i'd better put something in here, such as this annoying and stupid sentence. Yeehaw.

Old Post 10-28-02 04:06 #
mmnpsrsoskl is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
Ichor
The Mysterious Red Square


Posts: 6934
Registered: 07-02


Both of the switch linedefs would be, yes.

__________________
0.666 - The number of the Millibeast

Old Post 10-28-02 12:03 #
Ichor is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
mmnpsrsoskl
Spasmolytic


Posts: 1787
Registered: 06-01


Oh ok, cool. I just thought for stuff like this you'd have to use a new script over and over again, and never thought about having a parameter in there and yeah. This is cool. Thanks.

__________________
You know, I never really updated this thing right here, so I thought i'd better put something in here, such as this annoying and stupid sentence. Yeehaw.

Old Post 10-28-02 22:51 #
mmnpsrsoskl is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 11:29. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > Switch Scripting Question

Show Printable Version | Email this Page | Subscribe to this Thread

 

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 OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.