reading states from other actors

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
Hey all,

I just need some quick help...

I have the usual weapon class with its two classes for primary and secondary fire. I'm wondering if it's possible to read a state from the secondary fire class actor into the primary fire class actor, and how to do this?

Also if anyone knows of a good resource on referencing actors, that would be great cos i don't really know what i'm doing with it. I wish it was as easy as referencing classes!

cheers
 

Loqa

New Member
Dec 13, 2001
117
0
0
the low lands
Visit site
FireMode[m] = Spawn(FireModeClass[m], self);
In PostBeginPlay of Weapon shows that the FireMode array holds the spawned FireClass
GetStateName() function tells you the state of any actor

Also if anyone knows of a good resource on referencing actors, that would be great cos i don't really know what i'm doing with it. I wish it was as easy as referencing classes!

Every variable that holds a spawned class is an Actor reference. It is easier than referencing classes.
 

pospi

New Member
Jun 30, 2003
298
0
0
www.pospi.cjb.net
Hooray!

however, if this is the case i will only have access to that variable from within the weapon class.. how do i reference from the other fire class?

I remember seeing somewhere the function to return an actor's owner, or parent.. i'm not sure of the correct terminology.. but anyway can i do something like

Code:
this.owner.FireMode[1].GetStateName();
to return the state from the other fireclass?

I guess i just need to know the correct function or variable to return an actor's owner, but i cant find the damn thing no matter where i look :)

cheers
 

[SAS]Solid Snake

New Member
Jun 7, 2002
2,633
0
0
40
New Zealand
www.digitalconfectioners.com
Type casting my also be an issue. Remember that Owner is an Actor/Object (I can't recall) and it won't know what FireMode[x] is. So something like Weapon(Owner).FireMode[x].GetStateName(); is required.

Typecasting/Referencing is quite a hard concept to explain, and it is really an understanding of OOP which really helps here. I think the Wiki has a good explanation on what it is.
 

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
the firemode has a variable weapon
so it would be
weapon.firemode[x].getStateName();

This variable is a reference to the weapon which is a real actor in the level.
Which actor contains in turn other reference to other existing actors.
 
Last edited: