GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Which attribute should I use instead of Index on PC version?!

I was looking into this video to figure out how to make my enemy patrol left and right but the only problem I have is that I don't have an index attribute since I'm using a PC version and the tutorial is only showing how to do this on a Mac. I've heard that integer is similar to index but there may be a small difference according to this post: http://forums.gamesalad.com/discussion/12697/difference-between-integer-and-index

This is the tutorial I was trying to follow:

I decided to use integer rather than index while still doing everything shown in the video but the results did not turn out exactly as I hoped. I am unable to make my enemy patrol from left and right because I am missing the index attribute but if there is some other alternate way to do this on the PC it would help me alot!!

Comments

  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,542Member

    I don't know that exact tutorial but the only difference between Index and Integer is that Index will never be negative.

  • MoikMoik Posts: 257Member, PRO

    When I go to add a new game or scene attribute on PC Game Salad, index is available at the bottom of the dropdown list. I use index in a number of places in my current project using PC Game Salad and it seems to have the expected effect. It may be a bug in the version you're on if it isn't there.

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @Moik said:
    When I go to add a new game or scene attribute on PC Game Salad, index is available at the bottom of the dropdown list. I use index in a number of places in my current project using PC Game Salad and it seems to have the expected effect. It may be a bug in the version you're on if it isn't there.

    Okay so I just found out that in the old version of Gamesalad Index is not found but in the new one it's literally there. I'm probably using an old version then, it makes perfect sense now. The only problem is I don't have enough money to purchase Gamesalad and I'd rather use the old one which was the one that used to be free. I am however planning to buy the Pro version once I am satisfied with using this software, but for now I want to stick with the one I'm using right now. I guess I'll look into other tutorials that don't use the index attribute!

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @jamie_c said:
    I don't know that exact tutorial but the only difference between Index and Integer is that Index will never be negative.

    Can you provide me with an example of the difference between Index and Integer so I know how it looks like?!

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

    You can use an integer attribute with the max() function like this:

    max(game.health,0)

    The max function returns the higher of the two values so if game.health is negative, the result will be zero. If game.health is positive, the result will be positive. For example:

    max(-5,0)=0
    max(0,0)=0
    max(3,0)=0
    max(89,0)=0

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

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @tatiang said:
    You can use an integer attribute with the max() function like this:

    max(game.health,0)

    The max function returns the higher of the two values so if game.health is negative, the result will be zero. If game.health is positive, the result will be positive. For example:

    max(-5,0)=0
    max(0,0)=0
    max(3,0)=0
    max(89,0)=0

    Okay thanks. But I'm also trying to figure out how to make my enemy stop chasing the player while it's shooting at it and then chase him again without shooting this time when the player is out of the range (I'm using magnitude). I'd like the enemy to patrol left and right on its own then when the player gets near, the enemy starts shooting but doesn't chase him yet until he tries to get away! I would like for the shooting and the chasing to happen one at a time.

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

    I unfortunately am not familiar with that tutorial either so I'm not sure how much help I can be. If you want to post a screenshot of the rules you're using, someone can help you troubleshoot what's not working.

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

  • Chestosneako IncChestosneako Inc Posts: 25Member
    edited January 2017

    @jamie_c said:
    @Chestosneako Inc, here is a link to an explanation of the attributes types from Gamesalad:

    https://help.gamesalad.com/windows-cookbook/2-advanced-techniques/1-attributes/

    I found another video about jumping on top of enemy and was wondering what else was I suppose to do now since I've followed everything in the tutorial but I am unable to destroy the enemy after I jump on top of it and I just keep taking damage when colliding on the sides and on top as well. Here's the video I was watching:

    I was also wondering if maybe it had to do with the size of my image or something so I here's a screenshot of my image size I was using: https://drive.google.com/open?id=0B-lJpxbDBNVocXgxeHhPM1paWE0

    If there's anything else I need to do I it would help if you could explain!

    EDIT: okay I think I got it to work so never mind about everything I said, however, I would like to know how I can make it so that when I jump on top of my enemy it takes multiple hits before it gets destroyed as I bounce off from the enemy's head. That's the last thing I'm trying to figure out how to do!!

  • SocksSocks London, UK.Posts: 12,822Member

    @Chestosneako Inc said:
    how I can make it so that when I jump on top of my enemy it takes multiple hits before it gets destroyed as I bounce off from the enemy's head.

    Make an attribute, give it a starting value, every time the player collides with the enemy reduce or increase the attrbute's value, when the attribute reaches a specific value destroy the enemy.

  • Chestosneako IncChestosneako Inc Posts: 25Member
    edited January 2017

    @Socks said:

    @Chestosneako Inc said:
    how I can make it so that when I jump on top of my enemy it takes multiple hits before it gets destroyed as I bounce off from the enemy's head.

    Make an attribute, give it a starting value, every time the player collides with the enemy reduce or increase the attrbute's value, when the attribute reaches a specific value destroy the enemy.

    Okay, what's the name of the attribute I should use though?! It helps if I can see a screenshot of how I'm suppose to set it up or to be specific about the name of each rule/behavior I'm suppose to use and describe how that goes together.

    EDIT: I got it to jump on top of my enemy except when I do, I end up taking damage which shouldn't happen when jumping on top but only when colliding from the side! I'll need to fix that next!

  • SocksSocks London, UK.Posts: 12,822Member
    edited January 2017

    @Chestosneako Inc said:
    Okay, what's the name of the attribute I should use though?!

    I would probably go with "my favourite enemy head kill points totalizer attribute", or if you prefer more abstract mathematical affectations maybe go with the classic "X", or perhaps even "DeathPoints" or "Hits" or "SkullDamage" or everyone's favourite "Health".

    @Chestosneako Inc said:
    It helps if I can see a screenshot of how I'm suppose to set it up or to be specific about the name of each rule/behavior I'm suppose to use and describe how that goes together.

    When colliding with player
    --Change Danny DeVito to Danny DeVito +1

    When Danny DeVito = 5
    --Destroy

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @Socks said:

    @Chestosneako Inc said:
    Okay, what's the name of the attribute I should use though?!

    I would probably go with "my favourite enemy head kill points totalizer attribute", or if you prefer more abstract mathematical affectations maybe go with the classic "X", or perhaps even "DeathPoints" or "Hits" or "SkullDamage" or everyone's favourite "Health".

    @Chestosneako Inc said:
    It helps if I can see a screenshot of how I'm suppose to set it up or to be specific about the name of each rule/behavior I'm suppose to use and describe how that goes together.

    When colliding with player
    --Change Danny DeVito to Danny DeVito +1

    When Danny DeVito = 5
    --Destroy

    Okay this is how I did it. I decided to use =3: https://drive.google.com/open?id=0B-lJpxbDBNVoOVo4c2R0aUhfaWs

    I'm not sure if I did it right cause I'm still taking damage. I also can't make it stop jumping when it collides to the side of the enemy, I only want it to jump when it jumps from the top.

  • SocksSocks London, UK.Posts: 12,822Member

    @Chestosneako Inc said:
    Okay this is how I did it. I decided to use =3: https://drive.google.com/open?id=0B-lJpxbDBNVoOVo4c2R0aUhfaWs

    I can't see the whole rule, you appear to have cropped off the top section.

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @Socks said:

    @Chestosneako Inc said:
    Okay this is how I did it. I decided to use =3: https://drive.google.com/open?id=0B-lJpxbDBNVoOVo4c2R0aUhfaWs

    I can't see the whole rule, you appear to have cropped off the top section.

    Okay here is the complete screenshot, I had to take two separate and put them together cause it couldn't take the whole image in one shot: https://drive.google.com/open?id=0B-lJpxbDBNVoNFZCT2JVbUNkMG8

    And this is the attribute I did: https://drive.google.com/open?id=0B-lJpxbDBNVoV01xSzlDT09hRGM

    This rule was done on the enemy!

  • SocksSocks London, UK.Posts: 12,822Member

    I would drag the Destroy enemy rule out of the Kill Enemy rule, as it stands the Destroy enemy only has the very moment of impact to trigger, there's no real need to have this rule inside the parent rule.

  • Chestosneako IncChestosneako Inc Posts: 25Member
    edited January 2017

    @Socks said:

    I would drag the Destroy enemy rule out of the Kill Enemy rule, as it stands the Destroy enemy only has the very moment of impact to trigger, there's no real need to have this rule inside the parent rule.

    Okay so then how would you describe the way you would do it?!

    Here are the settings for my player which is causing him to jump when colliding from the side of the enemy but I need him to jump only when he's on top of it: https://drive.google.com/open?id=0B-lJpxbDBNVoaVJNWno4aUxRY0k

  • SocksSocks London, UK.Posts: 12,822Member

    @Chestosneako Inc said:

    @Socks said:

    I would drag the Destroy enemy rule out of the Kill Enemy rule, as it stands the Destroy enemy only has the very moment of impact to trigger, there's no real need to have this rule inside the parent rule.

    Okay so then how would you describe the way you would do it?!

    When colliding with player
    --Change Danny DeVito to Danny DeVito +1

    When Danny DeVito = 5
    --Destroy

  • SocksSocks London, UK.Posts: 12,822Member

    @Chestosneako Inc said:
    Here are the settings for my player which is causing him to jump when colliding from the side of the enemy but I need him to jump only when he's on top of it: https://drive.google.com/open?id=0B-lJpxbDBNVoaVJNWno4aUxRY0k

    I don't know what the attributes refer to.

  • Chestosneako IncChestosneako Inc Posts: 25Member
    edited January 2017

    @Socks said:

    @Chestosneako Inc said:

    @Socks said:

    I would drag the Destroy enemy rule out of the Kill Enemy rule, as it stands the Destroy enemy only has the very moment of impact to trigger, there's no real need to have this rule inside the parent rule.

    Okay so then how would you describe the way you would do it?!

    When colliding with player
    --Change Danny DeVito to Danny DeVito +1

    When Danny DeVito = 5
    --Destroy

    So I took the destroy rule out of the other rule and made it a rule of its own, so here's how it was done: https://drive.google.com/open?id=0B-lJpxbDBNVodW9TNkx1clZTWFk

    The only issue is that when I click preview the enemy is not there but when I put in "=0" then it shows up again. This only happens when I have my health "3" but if I put "0" then it shows up in preview.: This is how I have it: https://drive.google.com/open?id=0B-lJpxbDBNVoV01xSzlDT09hRGM

  • SocksSocks London, UK.Posts: 12,822Member

    @Chestosneako Inc said:
    The only issue is that when I click preview the enemy is not there but when I put in "=0" then it shows up again. This only happens when I have my health "3" but if I put "0" then it shows up in preview.

    Your rule says 'if 3 then destroy', so if you set your health attribute to 3 then the enemy actor will be destroyed before you ever get to see it ("the enemy is not there").

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @Socks said:

    @Chestosneako Inc said:
    The only issue is that when I click preview the enemy is not there but when I put in "=0" then it shows up again. This only happens when I have my health "3" but if I put "0" then it shows up in preview.

    Your rule says 'if 3 then destroy', so if you set your health attribute to 3 then the enemy actor will be destroyed before you ever get to see it ("the enemy is not there").

    Okay that makes sense. I decided to put "self.health -1" when colliding with player and kept health attribute as 3 but this time instead of "if 3 then destroy" I changed it to "0" which works now. NOW... I need the player to not take damage when jumping on top of the enemy and I also need to make it so it doesn't jump when colliding it to the side. Here are my rules for the player: https://drive.google.com/open?id=0B-lJpxbDBNVoaVJNWno4aUxRY0k

  • SocksSocks London, UK.Posts: 12,822Member
    edited January 2017

    //

  • Chestosneako IncChestosneako Inc Posts: 25Member

    @Socks said:
    //

    So you have any clue?!

Sign In or Register to comment.