is it possible to pass actor attribute to another actor without using a game attribute?

goonergooner Lancaster, PAMember Posts: 135
edited September 2015 in Working with GS (Mac)

For example, say I have four actors called "checkpoint", and 10 spawned actors called "soldier". The "soldier" actor will have attributes of a boolean "hasClearance" and an integer "rank".

When "soldier" (movable) collides with any of the "checkpoint" actors (not movable), I want the "checkpoint" to have it's attributes ("visitorClearance", "visitorRank") set to the values of the "soldier" actor that is currently colliding with it (each soldier will have different "hasClearance" and "rank" values).

I found previous posts that suggested using a game attribute to pass the values along. However, I am afraid there would be a race condition if more than one "soldier" was colliding with a different "checkpoint" at approximately the same time. If I could guarantee accuracy I would use a game attribute, but was hoping there was an easy and error proof way already established.

(only thing I can think of is multiple game attributes but then you have to track which "checkpoint" is being visited and then line it up with the corresponding game attribute, and then I'd have to repeat the process for the second attribute)

I appreciate any advice, suggestions, or links to old posts covering this topic.

Thanks!

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Yep. It involves, unfortunately, having the checkpoint actors unlocked on the screen. You'll need be able to access attributes of actors on the scene. If you need more explanation, I can whip up a demo for you.

    The trouble you may encounter, though, is knowing which "soldier" actor to reference.

  • goonergooner Lancaster, PAMember Posts: 135

    @Braydon_SFX said:
    Yep. It involves, unfortunately, having the checkpoint actors unlocked on the screen. You'll need be able to access attributes of actors on the scene. If you need more explanation, I can whip up a demo for you.

    The trouble you may encounter, though, is knowing which "soldier" actor to reference.

    Thanks! I'll try this tomorrow and report back in case I need that demo.

  • goonergooner Lancaster, PAMember Posts: 135

    Ugh, I'm back. Unfortunately, I can't find the attributes for the unlocked actors anywhere. I've unlocked a "checkpoint" but could not find where to change the attribute for this actor.

  • frdfrd Member Posts: 191

    When you are in the unlocked actor any rules or behaviours can use attributes from otber actors in the current scene. Look under current scene.attributes

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited September 2015

    @ellison said:
    Ugh, I'm back. Unfortunately, I can't find the attributes for the unlocked actors anywhere. I've unlocked a "checkpoint" but could not find where to change the attribute for this actor.

    Hang on Recooked one of my videos just for you!

  • goonergooner Lancaster, PAMember Posts: 135

    @frd said:
    When you are in the unlocked actor any rules or behaviours can use attributes from otber actors in the current scene. Look under current scene.attributes

    Thank You!

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276

    Remember that any changes you make in the actor prototype will not transfer to the unlocked instance. So be very careful not to break your game.

    Mental Donkey Games
    Website - Facebook - Twitter

  • goonergooner Lancaster, PAMember Posts: 135

    @Lost_Oasis_Games said:
    Hang on Recooked one of my videos just for you!

    Wow, really helpful, much appreciated!

  • goonergooner Lancaster, PAMember Posts: 135

    @NipaDidIt said:
    Remember that any changes you make in the actor prototype will not transfer to the unlocked instance. So be very careful not to break your game.

    Yes, I'll have to be aware of that! thanks.

  • goonergooner Lancaster, PAMember Posts: 135

    First off, thanks everyone for the replies (this was all helpful and kept me motivated and moving along trying new things ... grateful!)

    Unfortunately, I'm still having trouble finding the "soldier" actor's attributes. I'm guessing they are not in the Current Scene since they don't exist (not yet spawned). Would it be best to use a game attribute (set by the spawned "soldier") and constrain attribute(on the "checkpoint") set to the game attribute at this point or am I still missing something with unlocked actor/current scene attributes?

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276

    Yes, you can only access actors that you already have on the scene.

    Mental Donkey Games
    Website - Facebook - Twitter

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    For anything to show up it must be on the scene. That's why they are called scene attributes. You can't access actors in the pallet. This is why we have game level attributes. Most times building logic means we mix and match the various methods of doing things in the most efficient way.

Sign In or Register to comment.