Ouchface
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 > ZDoom Scripting Question
 
Author
All times are GMT. The time now is 13:09. Post New Thread    Post A Reply
II XII I III XI
Warming Up


Posts: 14
Registered: 12-02


I have a series of questions concerning scripts for one of my maps. If you could write an example script or point me to somewhere that explains how to do this I'd appreciate it.

First, is it possible to make a linedef impassable initially but passable later? Obviously I'm using ZDoom, and although I want a player to be able to jump, I don't want the player to be able to reach areas until they've done something else.

Second, how do I make four switches execute a script? I used the switchcount but for some reason it doesn't work.

Third, can I spawn an item in a previously tagged sector? I attempted spawning a soul-sphere in a floor_raise sector but to no avail.

And finally, is it possible to switch a texture sw1garg to another texture sw1satyr and make it an exit switch? The sw1garg previous is a switch that initiates a script. Later in the map however, I'd like the exact same switch to act as an exit switch.

Thank you for your time.

Old Post 08-29-04 03:35 #
II XII I III XI is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Darkhaven
Banned


Posts: 1127
Registered: 07-04


To do the 4-switch trigger thing, you need to do something to this effect:

code:
#include "zcommon.acs" int Switches=0; Script 1 (void) { Switches=(Switches+1); if Switches=4 then Effect Effect Effect }


This is mostly IIRC, mind you, my ACS Scripting knowhow is a little rusty. Some of it's probably falsified, but that's the gist of it.

As for you passable/impassable lines, you do this:

code:
#include "zcommon.acs" Script 1 (void) { SetLineBlocking(666, FALSE); }


I'm absolutely positive that's the right code. And, of course, where 666 is, your line number goes (NUMBER IN EDITOR, NOT TAG NUMBER!), and FALSE can be either TRUE or FALSE, which sets the Impassable flag.

And as for spawning an object in a sector, you can do one of the following:

code:
//blah blah blah Script 1 (void) { SpawnSpot("Ettin", 666); } //blah blah blah


Where Ettin is the name of your monster as you would summon it from ZDoom's console, and 666 is a tagged map spot where you want the monster to spawn.You can also move a tagged enemy directly to a map spot:

code:
//blah blah blah Script 1 (void) { Thing_Move(666, 667); } //blah blah blah

Where 666 is the monster's thing tag, and 667 is the map spot's tag.

Last edited by Darkhaven on 08-29-04 at 03:58

Old Post 08-29-04 03:50 #
Darkhaven is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
II XII I III XI
Warming Up


Posts: 14
Registered: 12-02


Thank you. I appreciate it. Hopefully someone can answer the other two in one way or another.

Old Post 08-29-04 04:07 #
II XII I III XI is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Darkhaven
Banned


Posts: 1127
Registered: 07-04


Also, it's very much possible to make the same exact switch into an exit switch, and you don't need scripting to do it. When you want the switch to change, simply have a 1-unit thick sector with the floor/ceiling reach the ceiling/floor with any tag number set to lower/raise when one crosses a linedef.

Old Post 08-29-04 04:13 #
Darkhaven is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3743
Registered: 05-00



II XII I III XI said:
And finally, is it possible to switch a texture sw1garg to another texture sw1satyr and make it an exit switch? The sw1garg previous is a switch that initiates a script. Later in the map however, I'd like the exact same switch to act as an exit switch.


http://www.zdoom.org/wiki/index.php...=SetLineSpecial
http://www.zdoom.org/wiki/index.php...=SetLineTexture


Darkhaven said:

#include "zcommon.acs"

int Switches=0;

Script 1 (void)

{

Switches=(Switches+1);

if Switches=4 then
Effect
Effect
Effect

}



With correct syntax:

code:
#include "zcommon.acs" int Switches=0; // not too sure if you can initialize with a value script 1 (void) { Switches++; if(Switches == 4) { // do something here } }



Darkhaven said:
Also, it's very much possible to make the same exact switch into an exit switch, and you don't need scripting to do it. When you want the switch to change, simply have a 1-unit thick sector with the floor/ceiling reach the ceiling/floor with any tag number set to lower/raise when one crosses a linedef.


Hmm, it's probably better to make the first switch such a 1 unit wide sector and let it disappear, since you probably would trigger the new switch before the original one. Doom doesn't care if you actually see the switch, you can trigger it always. That's pretty clear in Doom2 map02 in that blue floor room, where you can still hit the switch to open the secret door even after the platforms lowerd into the ground.

Last edited by boris on 08-29-04 at 09:32

Old Post 08-29-04 09:26 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Darkhaven
Banned


Posts: 1127
Registered: 07-04



boris said:

Hmm, it's probably better to make the first switch such a 1 unit wide sector and let it disappear, since you probably would trigger the new switch before the original one. Doom doesn't care if you actually see the switch, you can trigger it always. That's pretty clear in Doom2 map02 in that blue floor room, where you can still hit the switch to open the secret door even after the platforms lowerd into the ground.



Ah, good point. It's probably better to do it with scripting instead of my idea, but my way is one way to do it without scripting or if you think ACS scripts are a pain in the ass.

Last edited by Darkhaven on 08-30-04 at 05:57

Old Post 08-29-04 17:34 #
Darkhaven is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
The Ultimate DooMer
(former) /newstuff Chronicler


Posts: 4449
Registered: 03-02



II XII I III XI said:
I have a series of questions concerning scripts for one of my maps. If you could write an example script or point me to somewhere that explains how to do this I'd appreciate it.

First, is it possible to make a linedef impassable initially but passable later? Obviously I'm using ZDoom, and although I want a player to be able to jump, I don't want the player to be able to reach areas until they've done something else.

Second, how do I make four switches execute a script? I used the switchcount but for some reason it doesn't work.

Third, can I spawn an item in a previously tagged sector? I attempted spawning a soul-sphere in a floor_raise sector but to no avail.

And finally, is it possible to switch a texture sw1garg to another texture sw1satyr and make it an exit switch? The sw1garg previous is a switch that initiates a script. Later in the map however, I'd like the exact same switch to act as an exit switch.

Thank you for your time.



1. Flag it impassible in the editor, and give it the Line_SetIdentification type. Then to make it passable later, do this:

code:
script 1 (void) { setlineblocking (lineid, off) }

lineid is the number you put in the box when you gave it the Line_SetIdentification.

2. Set all four switches to run this script:

code:
int switchcount; script 2 (void) { switchcount++; switch (switchcount) { case 1: print(s:"3 more to go..."); break; case 2: print(s:"2 more to go..."); break; case 3: print(s:"1 more to go..."); break; case 4: print(s:"sequence complete"); Do_StuffHere } }


3. You don't need to use sector tags to spawn things - place a mapspot in the sector, give that a tag and spawn it there.

4. Give the switch a lineid like before, and use this script to change the switch:

code:
script 4 (void) { setlinetexture (lineid, SIDE_FRONT, TEXTURE_MIDDLE, "sw1satyr"); setlinespecial (lineid, 243, 0); }

Old Post 08-29-04 17:42 #
The Ultimate DooMer is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
boris
meow


Posts: 3743
Registered: 05-00



Darkhaven said:
but my way is one way to do it without scripting if you think ACS scripts are a pain in the ass.

... or if you don't have access to scripting, like in classic Doom.

Old Post 08-30-04 00:48 #
boris is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Darkhaven
Banned


Posts: 1127
Registered: 07-04


Edited to make more sense. :/

Old Post 08-30-04 05:57 #
Darkhaven is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
EvisceratoR
Member


Posts: 263
Registered: 01-02


hmm, i thought i couldn't do this scripting in zdoom, but now i see it's more or less identical to programming in C++....funky

Old Post 08-30-04 12:22 #
EvisceratoR is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
II XII I III XI
Warming Up


Posts: 14
Registered: 12-02


I thank all of those whom responded. Everything works except for the soul-sphere spawn.

I previously did, indeed, use a mapspot, but the soul-sphere still fails to spawn in the floor_raise sector. I'm not sure why but I will explain it thoroughly in case something was missed.

-You are in a pit that has a floor height of 0 and a ceiling height of 160 with a switch directly in front of you with a floor height of 64. Once you activate the switch, it recesses into the pit floor (0) and goes on to lift the entire pit to 128 which is level with an outside room. I am attempting to spawn the soul-sphere on top of where the switch would have stood. The switch is tagged 1 and the pit-room surrounding it is 2. The soul-sphere / mapspot is tagged 8. I'm positive that the soul-sphere is tagged correctly (8,25,0) but it fails to work.

???

Old Post 09-01-04 15:36 #
II XII I III XI is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
AgentSpork
Agent Spork is a resourceful agent for the Country


Posts: 2126
Registered: 09-02



II XII I III XI said:
I thank all of those whom responded. Everything works except for the soul-sphere spawn.

I previously did, indeed, use a mapspot, but the soul-sphere still fails to spawn in the floor_raise sector. I'm not sure why but I will explain it thoroughly in case something was missed.

-You are in a pit that has a floor height of 0 and a ceiling height of 160 with a switch directly in front of you with a floor height of 64. Once you activate the switch, it recesses into the pit floor (0) and goes on to lift the entire pit to 128 which is level with an outside room. I am attempting to spawn the soul-sphere on top of where the switch would have stood. The switch is tagged 1 and the pit-room surrounding it is 2. The soul-sphere / mapspot is tagged 8. I'm positive that the soul-sphere is tagged correctly (8,25,0) but it fails to work.

???



Hmm.. I have only one suggestion: You could possibly make a gravity affected map spot instead? That might solve the problem with it not spawning.

Old Post 09-01-04 19:22 #
AgentSpork is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit/Delete || Quote
II XII I III XI
Warming Up


Posts: 14
Registered: 12-02


I'll use this thread for any future ZDoom questions that I may have.

The question I have now regards screen-displayed text. Is it possible to change the color / size / location of messages? Suppose I have a script that operates after you open a door that says "Welcome to the UAC research facility"; could I make this appear as red or white/gray in the lower left hand corner rather than the yellow mid-screen default?

If you could direct me to a tutorial that would suffice. Thank you again for your time.

Old Post 09-20-04 14:22 #
II XII I III XI is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
Graf Zahl
Why don't I have a custom title by now?!


Posts: 7130
Registered: 01-03



II XII I III XI said:
I'll use this thread for any future ZDoom questions that I may have.

The question I have now regards screen-displayed text. Is it possible to change the color / size / location of messages? Suppose I have a script that operates after you open a door that says "Welcome to the UAC research facility"; could I make this appear as red or white/gray in the lower left hand corner rather than the yellow mid-screen default?

If you could direct me to a tutorial that would suffice. Thank you again for your time.



For this specific question look here:

http://www.zdoom.org/wiki/index.php?title=HudMessage
and here
http://www.zdoom.org/wiki/index.php?title=SetFont

For questions in general, look here:

http://www.zdoom.org/wiki/index.php?title=Main_Page

Old Post 09-20-04 14:47 #
Graf Zahl is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 13:09. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Doom Editing > ZDoom 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.

Forums Directory