Change Tag Attribute

921creative921creative Member, PRO Posts: 140
edited January 2012 in Working with GS (Mac)
I am assuming you can change an actor's Tag attribute through the use of a rule, correct? Thereby, if I have an actor who collides with an object that's tagged with a specific tag, and then I change that object's tag through a rule, the actor will no longer collide with the object...correct? I tried this and the actor still collided. Is there a special way to change the Tag attribute?

Comments

  • 921creative921creative Member, PRO Posts: 140
    OK...seems strange to be able to select self.Tags under the Change Attribute behavior without the ability to actually change self.Tags to something else.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    well you can access a bunch of attributes threw the change attribute behavior, that cant be changed at runtime. Such as visiblilty, moveable and the other physics attributes. SO yeah i wouldnt be surprised if it cant be changed at runtim

    cheers
  • MotherHooseMotherHoose Member Posts: 2,456
    edited January 2012
    … you can change self.tags at runtime in GS Preview

    I can't get an expression to retain an old tag and add to that …

    but, just typing something in works
    and the events initiated by a collision do not occur after that change in tags

    seems to work flawlessly, in Preview

    @};- MH
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    thanks for the info MH, good to know!
  • MotherHooseMotherHoose Member Posts: 2,456
    John, it saves a lot of booleans! gameAttributes!

    @};- MH
  • HymloeHymloe Member Posts: 1,653
    edited November 2012
    I'm using this technique to make things catch fire.

    I have a TAG called FLAMING.

    I can shoot things with my flame thrower, and anything that the fireballs touch go...
    Change Attribute > self.Tags = Flaming

    Then if anything else touches any actor that is FLAMING, then they also catch fire.

    :)

    - Murray

  • HymloeHymloe Member Posts: 1,653
    I think I've made a breakthrough.

    I've figured out how to add tags to an actor that already has existing tags.

    I have a wooden crate, with tags CRATES and HARD.

    I have a rule, if overlap an actor containing tag FLAMING, then change attribute self.tags to CRATES HARD FLAMING

    It works, if I use a TAB between each tag.

    I made it so it isn't using an expression, it's just straight text in the right hand box.

    Then I type the first tag, then press OPTION & TAB, type the second tag, press OPTION & TAB, then the third tag. Done!

  • HymloeHymloe Member Posts: 1,653
    Wow, that has really cleared up some fantastically annoying issues for me, now that I've got that working. It's a real shame these things don't seem to be documented anywhere.


    For my purposes, I'm just explicitly specifying which tags the actor should have in each case.


    But for those who are keen, you might find you can use expressions to add a new tag to existing tags. I'm imagining that you might be able to go...

    Change Attribute self.tags to self.tag + " Flaming"

    (where that's an OPTION & TAB before the new tag name)

    Not sure how you would remove tags with an expression.


    I'm so pleased and relieved to have got my hard-coded cases working, I'm just going to run away, and not try the expression-approach myself.

  • vernr1vernr1 Member, PRO Posts: 5

    I was using something similar to this. Setting self.tag = "dead".
    Basically wanted to stop all collisions once the actor was dead (changed the image).

    In theory, things worked fine.
    However, with further development and testing I came full circle back to this as a source of some horrible memory issues.
    I started getting mystery, invisible actors spawning and blocking the shots fired from the avatar.

    It might have had something to do with my spawn-pools to control actor spawn/destroys.
    But now I am very reluctant to change any tag at run-time.

    I would love to see some GS-documented use of this feature, as it would be great if I could change this data safely.

  • HymloeHymloe Member Posts: 1,653

    Yeah, I get the feeling it's not really a reliable way to do things.

Sign In or Register to comment.