Spawning an actor in front of an actor (by tapping a different actor)

mguniversemguniverse Member Posts: 12
edited November -1 in Working with GS (Mac)
This is a pretty complicated problem so read carefully.

Basically there is an object in the middle of the screen (let's call him Robot). I am trying to make it so when I click on an actor (let's call it button) it spawns an actor (called Box) in front of robot. Here is how I am doing this:

I have an integer involved called triggerBox. When touch is pressed on the button, it changes triggerBox to 1 and when it is released it changes it back to 0. Robot has a rule that when triggerBox = 1 it spawns the actor Box in front of actor relative to actor. I don't understand what I am doing wrong. I have a visible text box displaying the triggerBox integer and that is working correctly however when triggerBox is = 1 it does not spawn the Box in front of Robot.

Any thoughts?

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    Have you tried using a Boolean?

    Have you tested by doing the display text triggerBox to see if it's changing to the correct number?

    Darren.
  • Rob2Rob2 Member Posts: 2,402
    is your attribute game, scene or actor?
  • mguniversemguniverse Member Posts: 12
    @rob2 game.
  • mguniversemguniverse Member Posts: 12
    @rob2 I mean scene.
  • mguniversemguniverse Member Posts: 12
    @rob2 actually game lol ignore my lat reply.
  • Rob2Rob2 Member Posts: 2,402
    put a display text on the robot to see if IT can see triggerBox ?
  • mguniversemguniverse Member Posts: 12
    There is another actor already there (let's call it TextDisplay) and it is displaying the text and it is working fine.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    do you want the box to go away when you release? Otherwise why not just leave trigger box at 1? it may not stay at 1 long enough for the robot to read it. If it has to go back to 0 then you might try setting a timer before it switched back.
  • mguniversemguniverse Member Posts: 12
    @tenrdmer When the button is pressed, it sets triggerBox to 1. That's how the robot knows that the button is being pressed, because it only spawns a box when the button is pressed.
  • Rob2Rob2 Member Posts: 2,402
    post the project and it will be fixed in seconds :)
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    mguniverse said:
    @tenrdmer When the button is pressed, it sets triggerBox to 1. That's how the robot knows that the button is being pressed, because it only spawns a box when the button is pressed.

    Right thats my question. as soon as you let go of the button do you want the box to destroy? If thats how you have it setup then you probably just need to rearrange the order your rules are in. Ive found that sometimes just moving a ruleset up or down can make something work. also I have noticed if i have several actions or behaviors in a rule set it wont always do all of them so you may try making two rulesets with the same conditions and split your behaviors up between them. good luck
  • mguniversemguniverse Member Posts: 12
    I still don't seem to have the problem resolved...
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    What else have you tried?
    Also have you have never really answered the question of does the box destroy when the button is released or does it stay in front of the robot? I think that would be important for anyone to know to be able to offer you advice.
  • mguniversemguniverse Member Posts: 12
    I've done it a different way, where you directly tap part of the cieling and a box spawns from there.
Sign In or Register to comment.