Jump to content

  • Log In with Google      Sign In   
  • Create Account

Unrealscript: assigning an AI Controller/Pawn to an actor?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Sammieo   Members   -  Reputation: 147

Like
0Likes
Like

Posted 02 March 2013 - 05:02 PM

Hey guys, hope you can help clear this one up for me. This is probably a really basic question, but I'm actually having trouble finding syntax and confirmation for this problem I have.



So in UDK, I have an NPC in my game, and I have MyAIController, MyAIPawn (these two extend AIController and AIPawn), GameInfo and NPCActor classes all set up. The problem is, I don't know how to say that the NPCActor has the MyAIController and the MyAIPawn as its controller and pawn.

I can do it for the PlayerActor, MyPlayerController and MyPlayerPawn classes just fine - I just set values to the DefaultPawnClass and PlayerControllerClass values in the defaultproperties section of my GameInfo class. But what should I do for an NPC character? Is this set in the NPCActor class, or GameInfo, or somewhere else? Is it actually not possible, and I just have to stuff everything into the NPCActor class?

I'd really appreciate clearing up this issue of mine; a little goes a long way for a newbie!


Edited by Sammieo, 02 March 2013 - 05:09 PM.


Sponsor:

#2 ratrace135   Members   -  Reputation: 445

Like
2Likes
Like

Posted 02 March 2013 - 09:10 PM

Probably the easiest way to get an NPC would be to extend a placeable pawn (from your existing MyAIPawn class) instead of using a separate NPCActor class. In the DefaultProperties, you can set the "ControllerClass" variable to class'MyAIController' if you haven't done so in the MyAIPawn class.

 

The Example NPC section of http://udn.epicgames.com/Three/CharactersTechnicalGuide.html should help you out. Assuming you'll be using the same AIController for all NPCs, there's no need to create a separate variable for the controller class.



#3 Sammieo   Members   -  Reputation: 147

Like
0Likes
Like

Posted 03 March 2013 - 12:14 PM

Ratrace, thanks for the help!

I've tried it out, and the pawn appears just fine! However, I'm having trouble with the AIController class: although I believe I've followed the example correctly, it's still not connecting to it. I go into more detail here: http://www.gamedev.net/topic/639690-why-is-my-npc-controller-never-appearing/

Thanks again!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS