Forum rules - please read before posting.

Making spawned enemy behavior via trigger

I used my own code to spawn enemies. I know I can't use things like a trigger or hotspot in multiple instances - basically I can't attach a trigger to a clone, right? If I have an enemy spawn, is it possible to use adventure creator to give that enemy behavior that is sent from  attached an actionScript? Attach the actionScript to the clone somehow... Ultimately, I would like the enemy to die and drop coins or something.
Something like, after the enemy spawns, it attacks you if you're in it's range, but does nothing if you don't come too close. I could achieve this part with code, but because AC handles keeping a record of inventory items, if in the end, my goal is to drop a coin, how can I make AC register the collectible that came from a (clone) spawned during Update()?

Comments

  • The only thing you can't clone is scene-based Actions - i.e. those that live in Cutscenes, Interactions and Triggers.  However, you can set the Interaction source of a scene-based ActionList to Asset File - this will let you use the Actions from an ActionList Asset instead, which should allow the scene-based ActionList to be clone-able.

    To add the coin to your inventory, create an ActionList asset with an Inventory: Add or remove Action.  You can run this asset through script by running the following line (assuming "myActionListAsset" is a reference to the asset file):

    AC.AdvGame.RunActionListAsset (myActionListAsset);

    Have a look at section 12.7 of the manual - that's got a list of common script functions that AC has available.
  • Thanks, very easy to understand! I will check out that section right now as well.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.