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.
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