Author |
Message |
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
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 |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
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 |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
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 |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
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 |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
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 |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
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 |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
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 |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
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 |
|
|
Darlos9D
Joined: Mon Jul 16, 2007 9:50 am Posts: 1512 Location: Tallahassee, FL
|
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 |
|
|
|