| Author | Message | 
        
			| Darlos9D 
					Joined: Mon Jul 16, 2007 9:50 am
 Posts: 1512
 Location: Tallahassee, FL
   |   Checking enumerationsI 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 enumerationsCode: if not actor:GetController():IsState(Controller.BODY_IDLE) thenThat, 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 enumerationshttp://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 enumerationsI'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 enumerationsI 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 enumerationsI 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 enumerationsYou 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 enumerationsThose 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 enumerationsAh, 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 enumerationsIf 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 enumerationsBut 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 | 
					
					     | 
	
	
		|  | 
	
	
		|  |