Jump to content

Custom enemies tutorial?


Scimajor
 Share

Recommended Posts

OK, clearly I am completely new to this by asking this question so please keep that in mind.

 

I am testing out making my own "enemies" rather than simply grabbing in a prefab. I figured, incorrectly it seems, that I could simply make an object, apply the MonsterA lua script and voila. When I do that I get nothing out of my object/enemy. It sits there and does nothing (Yes I have Nav paths and the prefab monster works just fine).

 

What I'm actually trying to do is to setup a predator/prey (carnivore/herbivore) simulation. I thought I'd begin simply by assigning the MonsterA script and altering it as necessary. Clearly it's a wee bit more complex than I was hoping for.

 

Can someone point me towards a good tutorial that might assist me in this endeavour?

Link to comment
Share on other sites

Did you assign it's physics correctly under the physics tab. Is it set to character? Your enemy needs to have a character controller to be able to move. I think it may need a mass too, but don't recall and not at PC that has LE atm.

  • Upvote 1
Link to comment
Share on other sites

Yes, do that, and then just make sure your animations have the same name as the sample enemy. You can rename them in the model editor. Once you do that, any model can just be popped in and it works really easily.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Added: If I do everything below except without the pivot the cylinder sinks halfway into the ground (due the to axis being in the centre of the model) and it approaches me and bounces off.

 

This might be easier if I explain in detail what I am trying (just as a simple test).

 

Note: I am not interested in having character animations (other than moving) or sounds at this point.

 

Starting conditions:

 

I have a simple box (as a platform to walk around on) and a character controller which allows me to walk around on the box. The nav model is already setup covering the entire platform.

 

Steps:

 

1. Add a pivot

2. Add a cylinder (Rigid body, Prop)

3. Make the pivot the parent for the cylinder (to compensate for the fact that the cylinder's axis will be in the centre of the model) with the pivot at the bottom of the cylinder.

4. Make the following changes to the pivot

- Physics Mode = Characeter Controller

- Collisoin Type = Character

- Mass = 10

- Character Angle = 0

- Scipt file = MonsterAI.lua

- Swept Collision = unchecked

- Nav obstacle = unchecked

 

 

Running the program results in the cylinder and presumeably the pivot doing nothing at all. If I add in the "Crawler" prop he works just fine and attacks me.

Link to comment
Share on other sites

I'm not sure if parenting changes this but normally if you have CSG and it doesn't have a mass or a script attached then it's not an entity and you can't access it or change anything about it. So that might explain this. Try putting an empty script on the CSG as a test to see if that helps.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...