Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  


Recommended Posts

Can someone explain what the numbers represent in this script?

script 3 (int lineID) { // Force Field deactivation -Risen
for (int i = 180; i >= 0; i = i-2) {
TranslucentLine(lineID, i, 1);
SetLineBlocking(LineID, BLOCK_NOTHING);

Its the script to make the forcefield in knee deep in zdoom fade away after a certain amount of tics. I'd like to use this feature but having not really used hexen format before it never hit me.

What is the script saying?


Share this post

Link to post

Just taking a peek here, it looks line 2 describes a basic loop, initializing i at 180, and reducing it by 2 each iteration; the loop keeps running until i is less than zero, at which point it stops.

Lines 3-4 are what run during each iteration, and line 3 is the one that changes the translucency. As can be seen from the TranslucentLine page, the second parameter specifies the opacity amount, and since that parameter is i here, it will lower from 180 to 0 in 2 unit increments as described above. The delay in line 4 means that each iteration will pause for one tic after lowering the opacity, and the whole thing should take a little over 3 seconds to finish. Line 6 just makes the line passable once the forcefield has 'vanished'.

Assuming you understand the basic concept of a programming loop, you could see this section for an example of how this kind of loop is structured in C-based languages. If you don't know what loops are at all, you should read that whole article.

Anything you're specifically unclear about?

Share this post

Link to post

Ah I get it now, thanks for that Mithran I can see it clearly. I'll have to read it some more for it to sink in though!

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this