Jump to content

[LE3] Spawning : How to


YouGroove
 Share

Recommended Posts

I would like to have some spawning object.

It would spwan a goblin each time , when the player destroy one, it would spawn a new one.

And it would stop spawning when it has reached to spwan for example 5 Goblins.

 

I know how to load a model by code, but how to make it run with "animation manager" and "goblin" scripts ?

Stop toying and make games

Link to comment
Share on other sites

There is no way o say :

Load this model.

Than call This list of scripts on it ?

like script names with relative folders ?

 

Nevermind i have a solution :

Spawner script contains functions to manage the goblin AI , animations etc ...

 

But i think it must exist a solution ?

Stop toying and make games

Link to comment
Share on other sites

lol

No i will make it.

 

I found a solution is to have the code that manages the goblin simply in the spawner.

The spawner will just call functions it has on the goblin, and will manage the load and destroy of goblins.

 

I just thaught it was some way to load a model like Goblin and attach a script to it by code.

Like this we could have some general Spawner that could spawn goblins or other stuff , scripts to call and mesh name would just be parameters in the panel.

Stop toying and make games

Link to comment
Share on other sites

Yeah, prefabs are supposed to do that and Prefab:Load() will load a new instance. However, I'm finding that it doesn't seem to be running the scripts (even though I told it to load the scripts as well in the second param to the Load function). I'm working on a PrefabFactory that you pass in a prefab file and it'll create an instance of whatever you pass in (like a goblin).

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...