• Advertisement
Sign in to follow this  

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

This topic is 1784 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement