News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 13th Mar 2004, 03:22 AM   #1
pospi
Registered User
 
pospi's Avatar
 
Join Date: Jun. 30th, 2003
Posts: 298
reading states from other actors

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
pospi is offline   Reply With Quote
Old 13th Mar 2004, 06:57 AM   #2
Loqa
Registered User
 
Join Date: Dec. 13th, 2001
Location: the low lands
Posts: 117
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

Quote:
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.
Loqa is offline   Reply With Quote
Old 13th Mar 2004, 07:08 PM   #3
pospi
Registered User
 
pospi's Avatar
 
Join Date: Jun. 30th, 2003
Posts: 298
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
pospi is offline   Reply With Quote
Old 13th Mar 2004, 07:11 PM   #4
[SAS]Solid Snake
Registered User
 
[SAS]Solid Snake's Avatar
 
Join Date: Jun. 7th, 2002
Location: New Zealand
Posts: 2,633
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.
__________________
I make the impossible possible ... ... ... to some extent.

Digital Confectioners
[SAS]Solid Snake is offline   Reply With Quote
Old 13th Mar 2004, 07:20 PM   #5
TaoPaiPai
Commisaire Van Loc
 
TaoPaiPai's Avatar
 
Join Date: Jun. 13th, 2000
Location: Matnik
Posts: 1,623
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 by TaoPaiPai; 13th Mar 2004 at 07:23 PM.
TaoPaiPai is offline   Reply With Quote
Old 13th Mar 2004, 09:49 PM   #6
pospi
Registered User
 
pospi's Avatar
 
Join Date: Jun. 30th, 2003
Posts: 298
awesome! that seems to work, thanks very much.

and yeah, i remember typecasting from java and C. it gets horrendus pretty quickly
pospi is offline   Reply With Quote
Old 14th Mar 2004, 05:09 AM   #7
Loqa
Registered User
 
Join Date: Dec. 13th, 2001
Location: the low lands
Posts: 117
In Uscript typecasting is pretty easy, just remember to test that it is actualy the class you are casting to, like this:

if(Weapon(AnActor)!=none)
Loqa is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 09:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer