Respawn Instance of Actor

bkhoward2001bkhoward2001 Member, PRO Posts: 86

I am a newbie.... It seems like when you respawn the actor in a scene, it respawns the prototype but not the instance version... Is this correct? Because in my instance, I had rules which made him shoot, but when he responds he is no longer shooting.. Help?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Yes, when you spawn an actor, it spawns the prototype with the prototype rules. There is no* way to spawn a copy of an instance.

    *You _can_ transfer attribute values from one actor to another by doing something like this in the spawner actor:

    Change Attribute game.hitPoints to self.hitPoints
    Spawn Actor [enemy]

    And then this in the spawned (prototype) actor:
    Change Attribute self.hitPoints to game.hitPoints.

    That will effectively copy the hitPoints from the spawner to the spawned actor.

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

  • bkhoward2001bkhoward2001 Member, PRO Posts: 86

    Now I see what they say, only use prototype unless can do anyway else.... trying to avoid instance... Thanks.

  • bkhoward2001bkhoward2001 Member, PRO Posts: 86
    edited March 2018

    Also, how do you wait to spawn until the 'coast is clear' so to speak.... Alot of times it will use up extra lives as the object passes through it or two objects are hitting it at same time.?

    Can you do something that says no enemy objects are within a certain radius of hero before it respawns?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @bkhoward2001 said:
    Can you do something that says no enemy objects are within a certain radius of hero before it respawns?

    You can. It's a little complicated but there is a magnitude function that determines the distance between two points (e.g. game.heroX, game.heroY and self.Position.X, self.Position.Y of the enemy). You would constrain heroX and heroY to the hero actor's position attributes and then have the enemy or spawner actor check.

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

Sign In or Register to comment.