Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
ArrivedHero

ZScript: Custom Pointers

Question

Posted (edited)

I'm sorry I keep asking the same questions over and over again but I'm struggling with another thing with ZScript. I am trying to make a custom pointer for the player for the player's children and weapons to access. I made a public Actor class variable of targetSights, that constantly updates to whatever is underneath the players crosshairs in an overridden Tick function.

 

{

Actor targetSights;

 

override void PostBeginPlay()

{

 

Super.PostBeginPlay();

//other stuff

 

targetSights = null;

}

 

override void Tick()

{

// if/else statement to make sure that this is not a voodoo of the player.

 

GetTarget();

}

 

void GetTarget()

{

targetSights = GetPointer(AAPTR_PLAYER_GETTARGET);

}

}

 

For the weapon I am using the fist for experimentation but the code I got for it to use is in a custom action function A_PlayerPunch()

 

the code is this.

 

Actor fistOwner = NewMarine(invoker.owner);
    
    if(fistOwner != null)
    {
        if(fistOwner.targetSights !=null)
        {
            Actor fistTarget = fistOwner.targetSights;
        
            A_PrintBold(fistTarget.Species);
        }
    }

 

I keep getting an error that it does not know what targetSights is in the ZScript I typed up for the custom melee attack. What am I doing wrong?

Share this post


Link to post

2 answers to this question

Recommended Posts

  • 0

Partially resolved. Instead of using "let" I used "actor" in the attack function; however, it is still not printing out the intended target. It only "sees" the player and not what the player is looking at.

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
×