Giving HP to an actor?

jilliansjillians Member Posts: 33
edited November -1 in Working with GS (Mac)
So i have an actor that is moved just by the arrow keys. He currently has a tool that allows him to destroy a particular obstacle by touching it. I would like just one collision to remove 1HP from the obstacle, and press the arrow key in the direction of the obstacle in order remove an additional HP.

MY HP value is also not working.

I would also like there to be a small time lag in between each hit, so i can leave room for my hit animation.

Does this make any sense to anyone? : D

Thanks in advance!

Comments

  • jilliansjillians Member Posts: 33
    Anyone?

    How do i give an actor and HP attribute, and then use something like a sword to remove HP?

    No matter what i do, i can neither deal damage, or make the actor appear.

    Right now i have HP set as an attribute... i want to give the actor 3 HP, i have a weapon that i want to remove only 1 HP at a time. Each time the actor looses HP, i want to change them to a different image. Right now i have the weapon overlapping with the actor when i press the action key. I just want to be able to make the actor lose HP when it's overlapping, without destroying it right away.

    Thanks!

    Thanks!
  • jilliansjillians Member Posts: 33
    Also my grammar sucks, sorry about that : D
  • RedlerTechRedlerTech Member Posts: 1,583
    hey jillians email me at matthewredler@gmail.com
  • jilliansjillians Member Posts: 33
    So currently, i have HP as an integer attribute in the game tab, .... it's set to 1. The actor it'self has an HP integer set to 1...

    I have a rule that when actor overlaps or collides with the equipped weapon, it will:

    change attribute to (game.HP-1)

    and when HP = 0, then the actor(enemy) is destroyed...

    I still cannot get this to work : /
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Ok you dont need a game and a self attribute. Just make a self attribute in the enemey

    So have a rule when it overlaps or collides with whatver

    change attribute self.HP to self.HP-1

    then make another rule when attribute self.HP is equal to or less then 0
    destory actor

    dont put the brackets around the attributge either, and make sure your selecting from the drop down menu
  • jilliansjillians Member Posts: 33
    Thanks John... however it's still giving me problems : /

    i put:

    Rule:

    Actor overlaps or collides with Weapon,
    and Weapon is equipped,
    Change Attribute: Self.HP to Self.HP-1

    Rule: When Self.HP is equal to or less than 0,
    Destroy this actor

    HP is set to 0 in both game and scene attributes.. and the actor has an HP attribute of 3.

    I've tried all the combinations i can think of with this, and it's still not working.
  • RedlerTechRedlerTech Member Posts: 1,583
    Jillians, I'll take a look for free to see the problem :)

    Email me at matthewredler@gmail.com
  • jilliansjillians Member Posts: 33
    Hi NextGen,

    I appreciate your efforts, however i'd still like to see if anyone else has any ideas.

    Thanks!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi jillians, off the top of my head, try this maybe:

    Rule:

    When Actor overlaps or collides with Weapon,
    and Weapon is equipped, (I'm guessing this is an attribute here)
    and HP > 0

    Change Attribute: Self.HP to Self.HP-1
    otherwise
    Destroy this actor

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jilliansjillians Member Posts: 33
    Thanks,

    Though that just made all the enemies dissapear : D
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Woah, I wonder why?! Destroy this actor should only destroy that particular one...strange...

    It's a bit late (or should I say a bit early) here in the UK, so I'll have another think after sleep - although hopefully your prob. will be solved by then by someone else... sorry I couldn't help more at the moment. :-(

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    yeah thats weird. why i posted should have worked, and what gyro said should have worked to
  • jilliansjillians Member Posts: 33
    Yea i always seem to find the special way to break something... here be a screen shot... any insights?
    http://soylentworks.com/salad/hpees.png
  • quantumsheepquantumsheep Member Posts: 8,188
    Where you have the 'destroy' behaviour:

    Add another rule that says 'if self.hp is less than or equal to 0'
    Destroy actor.

    That should do it.

    Cheers,

    QS :D

    Edit - to clarify, what you had going on was a rule saying if you're being hit by a pickaxe and your HP is more than 0, then reduce hp by 1.

    The 'Otherwise' section with just 'destroy' in it essentially was destroying your actor if it *wasn't* being hit by a pickaxe - i.e. all the time! :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • jilliansjillians Member Posts: 33
    Thanks Quantum,

    However, although now i cannot destroy it again... it's as if the HP attribute isn't working... or i am missing something retarded...
  • quantumsheepquantumsheep Member Posts: 8,188
    Try adding a timer into the main rule:

    So:

    If pickaxe is used
    and hits enemey

    Timer: After .1 seconds
    change self.hp to self.hp -1

    See if that helps?

    QS :D

    Edit - also, add a separate display behaviour to show the self.hp of the actor - then you can see if it's changing at all.

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • ozboybrianozboybrian PRO Posts: 2,102
    If you have Skype i'll show you exactly how to do it.

    Skype: ozboybrian
  • jilliansjillians Member Posts: 33
    OKKKKaaay....

    Well i figured out a way to do it... i am making it collide with the player vs. the weapon.... which is weird... but it works.

    Ship it!

    Thanks guys!
Sign In or Register to comment.