RPG Set HP?
Nov 22 2007, 10:18 pm
By: DevilOfDuce  

Nov 22 2007, 10:18 pm DevilOfDuce Post #1



Ok, so i've been working on an RPG lately and i was wondering how you would make units so they have a set amount of HP that gets higher as they lvl up. so something like this

Lvl 1: 85/6550 hp. but! when they heal they cant heal more than 85 hp so it is a set amount

Lvl 2: 165/6550 hp. and again if they try to heal it cant go above 165 hp.

see what i mean? however i have no idea how i would do this. PLEASE HELP :D



None.

Nov 22 2007, 10:48 pm Roy Post #2

An artist's depiction of an Extended Unit Death

It depends on the method of healing.

Basically, you will need a "limit" trigger. You need to use switches or (preferably) death counters. I'll use a death counter as an example.

Trigger
Players

  • Current
  • Conditions

  • (Healing triggers)
  • Current Player has suffered exactly 1 death of "Hero Level"
  • Actions

  • Modify health for units owned by current player at anywhere: set to %*
  • Preserve Trigger


  • Trigger
    Players

  • Current
  • Conditions

  • (Healing triggers)
  • Current Player has suffered exactly 2 deaths of "Hero Level"
  • Actions

  • Modify health for units owned by current player at anywhere: set to %*
  • Preserve Trigger


  • Etc. You will need a seperate trigger for each level, using a death counter to mark what level they are.

    *Note: This percentage will vary depending on how much hp you want them to have. 1% of 6550 hp is 66.


    I would recommend a different method of monitoring unit health points, because you can't set the hp to a particular number, nor can you detect their hp with conditions. My suggestion is Virtual HP.

    Virtual HP:

    Quote from Tuxedo-Templar
    There are several methods for this, depending on the application. The reason you would use this is to control in your triggers how much HP a unit has, besides just setting HP % to specific amounts (like if you wanted to add or subtract certain amounts of HP, or even make monsters of the same type inflict differing amounts of damage at points of your map).

    One way, for computer players, as shown in my Trigger Happy D map, is to have them cycle through different players for each hit, eventually dying when they hit the end of the cycle. This works good for units that only take a few hits, as the max HP is limited to the maximum number of available computer players in the game. An alternative that can be used to extend this, however, would be to replace the unit with a new one (like it's hero equivalent) when it reaches the end of its cycle, setting the new unit to the beginning player in the cycle, and killing it when it in turn reaches the end of that cycle (or else making yet a new one with a different unit, as long as other units are available to do this.)

    Kill and replace. Basically, have a location that follows a given unique unit around wherever it goes (as long as it still exists), and when it dies, simply create a new unit at its location, and subtract 1 from a counter representing its HP. When the counter hits 0, the unit is dead, and will not be replaced.
    Stacked burrowed units. This particular method is best suited for stationary units like buildings and stuff, as it is typically a pain to both have them constantly repositioned under the mobile unit and suffer through slow movement for that mobile unit (a side effect of constantly moving a unit over or under another one, regardless of whether its burrowed or not). You can count HP by the number of burrowed stacked units under the current unit. Hits can be registered in whatever way you choose, except not the normal way, though you can use the above technique of replacing the unit after it dies. The best way to handle hits, though it requires a special setup, is to have the current unit with a very high HP or armor, and set the stacked burrowed units as weak, one-hit-kill units, but allowing only one at a time from the stack to be uninvincable, and then restrict hits to the building from splash damage-only units. The splash hits will hurt the stacked burrowed units, and as they die off, reset their invincabilities so one is always non-invincable, but the rest are not (unless there is only one, which is always uninvincable).

    Okay, it's not the best description of virtual hp, but you should be able to pull out a reasonable method from it.




    Nov 22 2007, 10:58 pm DevilOfDuce Post #3



    i dont understand tuxedos method. i couldnt use yours tho because i would need 100+ switches :\ any other ideas? or maybe explain tuxedos more?



    None.

    Nov 23 2007, 12:10 am NudeRaider Post #4

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Quote from Braydo7
    i dont understand tuxedos method. i couldnt use yours tho because i would need 100+ switches :\ any other ideas? or maybe explain tuxedos more?
    Roy showed the best method to increase a unit's max hp. You only get problems if you allow medics to heal those units.

    He didn't use switches, he used death counters. Do you know what they are?
    If not, we can explain it to you since this is vital for xp limiting dependent on level up.

    If you are relatively new to mapmaking you shouldn't use virtual hp anyway. This may be subjective, but imo its relatively difficult to set up, has many drawbacks and is not very intuitive.




    Nov 23 2007, 12:17 am ZugZugZealot Post #5



    Quote from NudeRaider
    Roy showed the best method to increase a unit's max hp. You only get problems if you allow medics to heal those units.
    An addition not as critical as a medic healing the unit, but also if the unit is zerg.



    None.

    Nov 23 2007, 9:57 pm DevilOfDuce Post #6



    some units are zerg :\ im not new to map making. ive been making maps for like 4 years. the only thing i dont understand is the death counters? i can think of my own way to set it up using cacoons and a grid system but it would take me a few hours to make and maybe a week to work out problems. can you explain death counters



    None.

    Nov 23 2007, 10:24 pm Roy Post #7

    An artist's depiction of an Extended Unit Death

    Damn...

    Death counters are just like switches. Think of a switch for a second. A cleared switch is the same as 0 deaths. A set switch is like 1 death. But death counters can go beyond 1 death. It's like many switches. Here's a comparison:

    Condition: Switch 1 is set
    Action: Create 1 unit at location 0

    Condition: Switch 2 is set
    Action: Center view for current player at location 0
    Action: Preserve trigger

    VS

    Condition: Player 7 has suffered exactly 1 deaths of unit
    - Create 1 unit at location 0

    Condition: Player 7 has suffered exactly 2 deaths of unit
    Action: Center view for current player at location 0
    Action: Preserve trigger

    ---

    So, instead of using two switches, you use one death counter. Instead of using the action "Set switch 1" you use "Set deaths for player 7: set to 1"

    *Note: It doesn't have to be player 7, I just used player 7 as an example.

    Death Counter Summary Link




    Nov 23 2007, 11:45 pm DevilOfDuce Post #8



    i figured it out. so bassicly i have already made all the switches for P1 so heres how i got it

    Trigger
    Players

  • Player 1
  • Conditions

  • Player 1 Kills and Razing Score is at least 1500
  • Actions

  • Display Text: Level Up +10 Minerals +5 Vespene Gas
  • Create 1 Mutalisk (aka Death Counter) at location Red Death Counter



  • Trigger
    Players

  • Player 1
  • Conditions

  • Player 1 Has suffered death of at least 1 Mutalisk (aka Death Counter)
  • Actions

  • Modify All Unit Hp at Location Anywhere owned by player 1 to 10% HP



  • when the mutalisk is created for P1 there is a turret under it that kills the muta which then sets off the second trigg.

    when a unit is going to heal there will be another trigg i will make that will heal the unit to a certain hp % depending on the how many mutalisks have been killed which will allow the level % to work.


    any flaws you see?



    None.

    Nov 24 2007, 3:06 am Fwop_ Post #9



    Yes, you don't need to have the mutalisk actually killed in game. There is an action that lets you modify the death values. Also, you have to make sure you aren't using units that can actually die from the player while in game.



    None.

    Nov 24 2007, 4:18 am Roy Post #10

    An artist's depiction of an Extended Unit Death

    ...Ignoring the last sentence by Fwop_, your system does work. One flaw, though. "Player 1 Has suffered death of at least 1 Mutalisk (aka Death Counter)" It should not use "at least." It should use "exactly." Otherwise it'll conflict with the second level trigger.




    Nov 24 2007, 11:57 am NudeRaider Post #11

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    There's another flaw. As soon as the hero reaches level 2 he will constantly be healed by the 2nd trigger. Below I describe how to avoid that.

    Do not ignore Fwop_.
    It is correct, that your system works (except for at least to exactly) but Fwop_ has an important point (actually several).

    The power of death counters (DCs) is that they can be completely virtual, can be completely real or a mixture of both because there is an action that modifies the DC of any unit by adding, subtracting or setting.

    In your case you would not want that a random kill (for example from a custom spell explosion) would modify the hero's level.
    That's why you should choose a unit that isn't used ingame. When using ScmDraft you find in Units -> Neutral -> Neutral some of the units that would even crash the map if placed. Those are perfect for virtual counters. Rename "Cave" into LEVEL DC.

    Then modify your triggers: Instead of creating a muta (and let it be killed) set the deaths for CURRENT PLAYER ** by adding 1 for LEVEL DC (aka Cave). In this same trigger you can set the hero's hp. (I guess he's healed on level up?)

    In the trigger that heals the hero (when stepping on a beacon or w/e) check for exactly x deaths of LEVEL DC and heal x % of hp.
    Obviously you will need 1 trigger for each level, but you can use it for every player (current player!).


    ** Some general info on DCs:
    Another useful feature of DCs is that every player has his own count thus making it possible to use one DC for different players even with the same trigger when using current player.

    Or you can simplify text display across multiple players triggered by a global event: Set DC Text to 1 for Force 1 // If current player has suffered 1 of DC Text -> Display text, set DC Text to 0 for current player.
    You can set it to 1 for the first message, to 2 for the second message and so on. Everytime using only 1 DC and thus only 1 string.




    Nov 24 2007, 12:06 pm NudeRaider Post #12

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Oh and in your case Level is completely dependent on Kills and Razings Score. So you wouldn't even need DCs just always refer to the points. Example for healing trigger on Level 3:

    Human Players
    Conditions:

    Current Player brings at least 1 [men] to Heal
    Current Player's K&R Score is at least 3000
    Current Player's K&R Score is at most 4499
    Actions:
    Set HP for all [men] of Current Player at Heal to 30%
    Preserve Trigger




    Nov 24 2007, 12:09 pm NudeRaider Post #13

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Quote from Braydo7
    some units are zerg :\
    Where's the problem? Do you know how long it takes a zerg unit to regenerate 5000 HPs?!
    No sane player would wait that long just to come to battle "fully healed" (and get his HP set back to 30% or w/e on the next level up).




    Nov 24 2007, 9:06 pm DevilOfDuce Post #14



    lol ya i guess your right nude. it takes like 3 seconds to heal 1 hp for zerg anyways. oh and ya i changed the at least to exactly, well actually it was always exactly but w/e. and i tried just using the kills and razings thing but the only problem is that i tried it with the heal system and it doesnt work :\ then i used the muts as death counters and it simplified it i guess? oh and none of the units the players fight are mutas.



    None.

    Nov 24 2007, 11:01 pm NudeRaider Post #15

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Quote from Braydo7
    and i tried just using the kills and razings thing but the only problem is that i tried it with the heal system and it doesnt work :\
    Well I posted how your trigger would have to look like. Just copy it and it WILL work.
    If not, there must be a trigger that modifies the K&R Score thus spoiling the heal trigger (and any other trigger that has K&R Score in the conditions. You can make a leaderboard that shows the K&R Score to check that.
    If that is the case (and necessary) you would need the LEVEL DC.

    Btw. Killing a Muta with a turret adds to the turret owner's K&R Score. Modifying the DC by triggers does not affect K&R Score.

    Quote from Braydo7
    then i used the muts as death counters and it simplified it i guess? oh and none of the units the players fight are mutas.
    Ofc if you are lazy you CAN stick to using a muta as DC. It's just a recommendation not to do so because it's safer. Later on you might want to use a Muta for something that you haven't thought of yet. In the worst case you don't remember using muta as DC and get strange bugs.

    And seriously, its not that much work to rename a unit and change this unit in a few triggers...
    If you have many triggers you can use the text trigger editor and find and replace to guarantee you didn't forget one instance.




    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [01:35 am]
    Ultraviolet -- Vrael
    Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
    Gonna put deez sportballs in your mouth
    [01:24 pm]
    Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
    [2024-4-30. : 5:08 pm]
    Oh_Man -- https://youtu.be/lGxUOgfmUCQ
    [2024-4-30. : 7:43 am]
    NudeRaider -- Vrael
    Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
    Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
    [2024-4-29. : 6:36 pm]
    RIVE -- Nah, I'm still on Orange Box.
    [2024-4-29. : 4:36 pm]
    Oh_Man -- anyone play Outside the Box yet? it was a fun time
    [2024-4-29. : 12:52 pm]
    Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
    [2024-4-29. : 11:17 am]
    Zycorax -- :wob:
    [2024-4-27. : 9:38 pm]
    NudeRaider -- Ultraviolet
    Ultraviolet shouted: NudeRaider sing it brother
    trust me, you don't wanna hear that. I defer that to the pros.
    [2024-4-27. : 7:56 pm]
    Ultraviolet -- NudeRaider
    NudeRaider shouted: "War nie wirklich weg" 🎵
    sing it brother
    Please log in to shout.


    Members Online: Moose, Roy