Data Realms Fan Forums
http://45.55.195.193/

Checking enumerations
http://45.55.195.193/viewtopic.php?f=73&t=25021
Page 1 of 1

Author:  Darlos9D [ Mon Aug 08, 2011 12:10 am ]
Post subject:  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?

Author:  Coops [ Mon Aug 08, 2011 12:14 am ]
Post subject:  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

Author:  Darlos9D [ Mon Aug 08, 2011 12:16 am ]
Post subject:  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.

Author:  Coops [ Mon Aug 08, 2011 12:19 am ]
Post subject:  Re: Checking enumerations

I don't understand. You're asking how to check if an object HAS a certain enumeration?

Author:  Darlos9D [ Mon Aug 08, 2011 12:23 am ]
Post subject:  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.

Author:  Coops [ Mon Aug 08, 2011 12:39 am ]
Post subject:  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.

Author:  TheLastBanana [ Mon Aug 08, 2011 2:14 am ]
Post subject:  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.

Author:  Darlos9D [ Mon Aug 08, 2011 4:00 am ]
Post subject:  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.

Author:  Lizardheim [ Mon Aug 08, 2011 4:14 am ]
Post subject:  Re: Checking enumerations

If you're doing this for the darkstorm guns, you could always just intersect it with the human AI.

Author:  Darlos9D [ Mon Aug 08, 2011 6:17 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/