Making lines transparent in a script?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Making lines transparent in a script?

Post by Xenaero »

Topic
User avatar
Enjay
 
 
Posts: 27164
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

Make a line type 121, give it an id and use...

TranslucentLine(lineid,value);


lineid Line ID of lines to make translucent (0 for this line)
amount How translucent the line should be [0..255].


From the old manual...

Sets the amount of translucency for all matching lines (including itself). If lineid is 0, it only sets the translucency of the line it is on. Like Line_SetIdentification, this special sets the line's id. Amount controls how opaque the line is. 0 is nearly invisible. 255 is opaque. Intermediate values are somewhere in between.
killingblair
Posts: 937
Joined: Mon Oct 04, 2004 9:16 pm

Post by killingblair »

Ditto
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Post by Xenaero »

I think you missed the last couple words. IN A SCRIPT. :)
User avatar
Chilvence
Posts: 1647
Joined: Mon Aug 11, 2003 6:36 pm
Contact:

Post by Chilvence »

Hey, I think you can use action specials in ACS now. What a cool feature :)
User avatar
Enjay
 
 
Posts: 27164
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

DD_133 wrote:I think you missed the last couple words. IN A SCRIPT. :)
Nope, that's how you do it in a script.

Use this in a script

TranslucentLine(lineid,value);

The lineid is set in the editor, but the above command is used in a script.

eg...

Code: Select all

script 1 OPEN
{
	
	setlinespecial(2, 80, 2, 0, 0, 0, 0);
	TranslucentLine(2,128);
}
That script (I think) gives lines with id 2 the run script special (in this case they will run script 2) and then makes them translucent with a value of 128.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

DD_133 wrote:I think you missed the last couple words. IN A SCRIPT. :)
I think you need to learn to script. :roll:

Line type 121 simply sets a line's ID. You would then use the command Enjay mentioned to make the line(s) with that id transparent whenever you like. You can even use multiple commands to cause their transparency to fluctuate, or turn them solid again.

Happy?

[EDIT]BAH!!!!![/EDIT]
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Post by Xenaero »

Heh, thanks Enjay. :) Not only for the help but a kinder responce too. :D

Edit: Hmm it sure doesn't like the void types of script, I can't get it to run on a push of a switch :/
User avatar
Enjay
 
 
Posts: 27164
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Post by Enjay »

Works for me™ :D

Try the attached.

The script is just...

Code: Select all

#include "zcommon.acs"

script 1 (void) 
{ 
    
   print (s: "Script.");
   TranslucentLine(1,128); 
}
[edit]attachment removed[/edit]
Last edited by Enjay on Mon Apr 04, 2005 7:52 pm, edited 1 time in total.
User avatar
Kirby
Posts: 2697
Joined: Thu Aug 26, 2004 1:23 pm

Post by Kirby »

makedy suredy itedy isedy setedy toedy Playeredy pressesedy usedy

Make sure the line using the script is set to Player press use :P
User avatar
Wasted Youth
Posts: 358
Joined: Mon Jan 05, 2004 9:59 pm
Location: Earth

Post by Wasted Youth »

You could create a Window Fog or Ice Effect.

Say you had an Snow/Ice map and an indoor area windows have Ice on them. You have to restore power and that will turn the heat on so the ice on the windows will melt.

Code: Select all

Script 1 (void)
{
  TranslucentLine(1,215);
  Delay(5);
  TranslucentLine(1,210);
  Delay(5);
  TranslucentLine(1,205);
  Delay(5);
  TranslucentLine(1,200);
  Delay(5);
  TranslucentLine(1,195);
  Delay(5);
  TranslucentLine(1,190);
  Delay(5);
  TranslucentLine(1,185);
  Delay(5);
  TranslucentLine(1,180);
  Delay(5);
  TranslucentLine(1,175);
  Delay(5);
  TranslucentLine(1,170);
  Delay(5);
  TranslucentLine(1,165);
  Delay(5);
  TranslucentLine(1,160);
  Delay(5);
  TranslucentLine(1,155);
  Delay(5);
  TranslucentLine(1,150);
  Delay(5);
  TranslucentLine(1,145);
  Delay(5);
  TranslucentLine(1,140);
  Delay(5);
  TranslucentLine(1,135);
  Delay(5);
  TranslucentLine(1,130);
  Delay(5);
  TranslucentLine(1,125);
  Delay(5);
  TranslucentLine(1,120);
  Delay(5);
  TranslucentLine(1,115);
  Delay(5);
  TranslucentLine(1,110);
  Delay(5);
  TranslucentLine(1,105);
  Delay(5);
  TranslucentLine(1,100);
  Delay(5);
  TranslucentLine(1,95);
  Delay(5);
  TranslucentLine(1,90);
  Delay(5);
  TranslucentLine(1,85);
}
You could also Reverse this effect as well. Here is an example wad I made:
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Umm.... Hate to tell you this, but you wasted a whole lot of time.

Use a For loop. you see your giant script 1? see my 99% shorter one? They both do the same thing.

Code: Select all

script 1 (void)
{
   For(int i=215;i>85;i=i-5)
   {
      TranslucentLine(1,i);
      Delay(5);
   }
}
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

oh dear lord! why so much code? you could do all that in this:

Code: Select all

script 1 (void){
	for(int i=215;i>=85;i-=5){
		TranslucentLine(1,i);
  		Delay(5);
	}
}
and you could even make it reuseable like this:

Code: Select all

script 1 (int line,int time){
	for(int i=215;i>=85;i-=5){
		TranslucentLine(line,i);
  		Delay(time);
	}
}
for that one, just run ACS_EXECUTE(1,0,*LINE*,*SPEED*); whenever you needed this effect

EDIT: not fast enough... :\
at least mine was dynamic too :)
User avatar
Wasted Youth
Posts: 358
Joined: Mon Jan 05, 2004 9:59 pm
Location: Earth

Post by Wasted Youth »

heh, I knew there had to be an easier way. :)
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Beat you.

Heh. Forgot about the -=. I also like your re-usable version. It's best if you can make everything as generic, simple, and as re-usable as you can.
Locked

Return to “Editing (Archive)”