Jump to content
  • 0

ACS - player type constant?


smeghammer

Question

Greetings editing gurus - I'm having trouble finding a decent reference for certain constants -  maybe my Google-fu isn't so good today...

 

Anyway, I am using the ACS function ThingCountSector(actortype, actorTID, tag). to determine a 3D floor sector to drop on shooting a line (i.e. a trap) and ensure I drop the 3D platform the player is currently on. It is triggered when you shoot a wall (basically, if you miss a monster and hit the wall behind it - hence the trap aspect).

 

The code I have works just fine:

Spoiler



/*
floor will drop if player is standing on a platform and shoots the wall behind
imp ambush room. First shot will drop the floor by 8, second shot will drop all the way.

dropfloor = sector tags of the metal plates
dropfloorctl = tags of control sectors
dropfloorstate = drop state of platform;
	0 = not dropped
	1 = triggered once
	2 = fully dropped
*/
int numdropfloors = 21;
int dropfloor[21] = {60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80};
int dropfloorctl[21] = {160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180};
int dropfloorstate[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};


script 4 (void){
    int a;

    for(a=0; a<numdropfloors; a++){
        if(ThingCountSector (T_NONE, 0, dropfloor[a])){
            if(dropfloorstate[a] == 1){
                //kill drop
                FloorAndCeiling_LowerByValue(dropfloorctl[a], 128, 256);
                dropfloorstate[a] = 2;
                a = numdropfloors;
            }
            if(dropfloorstate[a] == 0){
                //first drop
                FloorAndCeiling_LowerByValue(dropfloorctl[a], 128, 8);
                dropfloorstate[a] = 1;
                a = numdropfloors;
            }
        }
    }
}

 

 

BUT: The issue is of course is the use of the T_NONE constant. According to the zdoom ref above, this is 'any actor'. This is OK if there are definitely no other actors involved...

 

What I need is the constant that refers to the PLAYER. I can't seem to find any reference to this.

 

Any help or suggestion gratefully appreciated.

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 1

Looks like you should be able to assign the player a TID and then use T_NONE. Or if you are using a custom player class, you might could assign the class a SpawnID and use that number in place of T_NONE, if I'm understanding this function and what you are trying to do correctly. My ACS is a bit rusty.

Share this post


Link to post
  • 0

Ah yes, I see. A quick search got me to this page. This looks just the job. Thank you.

 

FYI: The player can be on one of 21 3D floors (with instagib lava underneath). There are monsters in a side room shooting at you. Behind THEM  is a wall that activates the code if a projectile hits it (i.e. your bullets). The code does indeed check which platform the player is on, and drops that one if you miss the monsters and hit the wall.

Share this post


Link to post
  • 0
1 minute ago, Kronecker–Capelli said:

Careful, this line
if(ThingCountSector (T_NONE, 0, dropfloor[a]))
would triggers every time it find any alive thing in sector with dropfloor[a] tag.

Yes I know. That is why I asked my question.

Share this post


Link to post
  • 0
Just now, smeghammer said:

Yes I know. That is why I asked my question.

To make sure you understand, any alive (any actor which have more then zero health) thing, not only player. So monsters, barrels, shootable decoration, etc.
If it just empty sectors that it wouldnt cause any problems. Otherwise it would lower them too.

Share this post


Link to post
  • 0

If I set the TID of the player as per @Nevander's suggestion, then my function call becomes specific to only the player, because only the player has that TID:

Script 1 ENTER { 
    Thing_ChangeTID(0, 1000 + PlayerNumber()); // This assigns the TID to the player - is unique
}

/*this becomes 'any actor with TID of 1000'. As 1000 is the player TID is unique, I no longer have the ambiguity problem */
if(ThingCountSector (T_NONE, 1000, dropfloor[a])){
    ...
}

If it turns out that conflicts with a TID of another thing, I can always change it.

I'll test all this tomorrow

Edited by smeghammer

Share this post


Link to post
  • 0

OK I tested this.

 

The suggestion by @Nevander is correct.

 

The behaviour noted by @Kronecker–Capelli is of course true - I tested by placing some dormant monsters on the platforms and then shooting the wall, making sure the player is not on any platform. Sure enough, the platforms with the dormant monsters dropped.

 

Adding the above code to set the player TID on ENTER and then testing for that new TID prevented the code returning TRUE unless the player is on the platform. 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...