View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:48 pm



Reply to topic  [ 10 posts ] 
 Checking enumerations 
Author Message
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Checking enumerations
I can't seem to figure out how to check an enumeration if an object has it. For instance, say I have an AHuman, and I want to see if his MovementState enumerator is set to WALK. How would I do that?


Mon Aug 08, 2011 12:10 am
Profile YIM
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Checking enumerations
Code:
if not actor:GetController():IsState(Controller.BODY_IDLE) then


That, however just checks if hes not doing anything at all. Not just to check if hes walking.

If you want to be specific then heres a list of enumerations
http://wiki.datarealms.com/index.php/Lu ... ntrolState


Mon Aug 08, 2011 12:14 am
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Re: Checking enumerations
I'm not asking how to check his controller state. I'm asking how to check other states defined in other objects.


Mon Aug 08, 2011 12:16 am
Profile YIM
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Checking enumerations
I don't understand. You're asking how to check if an object HAS a certain enumeration?


Mon Aug 08, 2011 12:19 am
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Re: Checking enumerations
I don't need to know if its there because I already know its there. I KNOW, for instance, that AHuman has the UpperBodyState enumerator. I just want to find out what it's currently set to.


Mon Aug 08, 2011 12:23 am
Profile YIM
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post Re: Checking enumerations
You might have to have separate checks and see if any of them are true.

Or you could try a kind of debuging method just to see if you can get it by itself.
Code:
print(actor:GetController().ControlState)


I don't know if thats the right way to check that though, might be something else.


Mon Aug 08, 2011 12:39 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Checking enumerations
Those enumerations are set in the AI script itself, so it can only be accessed from an Entity's Lua state. If you're accessing it from another object, you can use this. The variables are defined at the top of the AI scripts.


Mon Aug 08, 2011 2:14 am
Profile WWW
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Re: Checking enumerations
Ah, yeah, I see what you mean. If I have something print one of its own enumerators it actually gives something besides nil.

I'll give that hack a shot. Well, either that or just run off of controller states.


Mon Aug 08, 2011 4:00 am
Profile YIM
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post Re: Checking enumerations
If you're doing this for the darkstorm guns, you could always just intersect it with the human AI.


Mon Aug 08, 2011 4:14 am
Profile
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post Re: Checking enumerations
But I want darkstorm guns to work with any actor, not just darkstorm units. Well, unless they're Oni weapons, but most of them aren't. I'm currently working on the regular assault rifle.

EDIT: I tried that hack to get the "true" pointer to the actor, and I still couldn't access enumerators through it. I guess they're just off limits unless they're referenced from the actual object they belong to.


Mon Aug 08, 2011 6:17 pm
Profile YIM
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.048s | 13 Queries | GZIP : Off ]