constraining actor problem

allc1865allc1865 Member, PRO Posts: 777

I have an actor that is constrained to the player actor.
The player actor is spawned, however, the constrained actor will only constrain to one of those spawned actors.

Any idea on how to fix this?

Also, if I can get help on this problem also, please...
When the enemy shoots the actor constrained to the player actor, it kills and destroys all of my spawned player actors, which I do not want...
Any ideas?

The project file is includes. Thanks guys :)

https://www.dropbox.com/s/68iq5izvw1m279k/Constrain objects above actor_1.zip?dl=0

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer

    @allc1865 said:
    I have an actor that is constrained to the player actor.
    The player actor is spawned, however, the constrained actor will only constrain to one of those spawned actors.

    Any idea on how to fix this?

    How to fix what? Constraining an attribute to an actor's position has nothing to do with whether or not that actor was spawned. Can you describe a little more about what it is you're trying to do and how it's not working?

    The second problem is going to be related to how you have the rule set up for destroying the actor. I don't have time now to look at your project file but adding a screenshot might be a quicker method for most people here to lend a hand (a project file is ALWAYS helpful though :) ).

    My guess is that you need to pass a custom value to a game attribute from the actor that has been shot (each instance would need its own unique value) and then have the prototype actor's rules check to see if its attribute matches the value of the actor that was shot. If so, destroy the actor. Since you are spawning the instances, one way to assign a custom value is to increment a game attribute like this:

    Spawner actor:
    Change attribute game.spawnID to game.spawnID+1
    Spawn actor [actor name]

    Spawned actor:
    Change attribute self.spawnID to game.spawnID

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

Sign In or Register to comment.