Need Help Making Custom Stats

RipTheJacker

New Member
Reaction score
0
Hello. Im trying to implement four custom stats for everyones single unit in a game. I need help figuring out how to label and manipulate the variables right. Im trying to use Radiation, Food, Thirst, and Fatigue. The first three all happen over time so it would be easier to explain those and I could work from there.
Ex. Radation (Array?) 0-1000 +1 rad p/s being anywhere. Per/Second
Food + Water 0-100 + 1 point p/10s
Radiation = 1000 Action - 1 hp p/s
Food or water = 100 Action - 5 hp p/s
Also wondering how i could put those into the interface so they can keep track of them. kind of like kobold tribes. Thanks for the help community :D much love.
 

Jokker

Member
Reaction score
16
Firstly you need to have all the values as global variables in map initialization. Create an array for every stat (radiation x, food x, water x) or create one three dimentional array (stats x, y, z) (might be harder for a beginner). The default values can be 0. The array size / length should be the number of players as you want to have a radiation number holder for every player. So radiation 1 is player 1 current radiation, radiation 2 is player 2 current radiation and so on.

After that you would need periodic events.
For radiation: Periodic event - Every 1 sec -> local variable x = 1 -> for every player (I hope you understand the logics of 'for loop'. If not, you could google it :) ) if [radiation x] < 1000, take [radiation x] and add +1, else deal 1 dmg to the players unit (as radiation is 1000), then raise x by one (x = x + 1) to have the loop pick the next player (as now x is 2, so it takes [radiation 2] and player 2 into account)

(Note that local variable initial value might be 0.. I am not sure if player numbers started from 0 or 1, use whichever is most convenient)

With this information you could also create another trigger for Water + Food +1 (p/10s) that also checks if someones food or water is at 100 and deals 5 damage if it is.

I would help you write the trigger basics (if you don't do it yourself, how would that help : D) but unfortunately I am at work and don't have access to the map editor at the moment. We'll see, maybe later.

After that you want to display these values for every player. This can be done by dialogs. But I think you should start with the values first and then continue with dialogs / food&water&radiation bars.

Cheers mate, I hope this is not too complicated and helps at least someway through the problem.
 

Dave312

Censored for your safe viewing
Reaction score
269
Alternatively to Jokker's idea, you could create attributes to store the Radiation/Food/Water values. By doing it this way, these values will automatically show up in the units info panel. You can also set each Attribute to modify the units life regen rate if need be (i.e make radiation do damage etc) without doing it via triggers.
 

RipTheJacker

New Member
Reaction score
0
Thank you guys! exactly what help i was looking for. ill have to dabble a little but I will definitely let you guys know what progress is happening. And Jokker if you are looking to spend a little freetime helping develop this map that would be awesome. I think a second view and feedback could help improve the development. plus you seem to know what your doing :D
 

RipTheJacker

New Member
Reaction score
0
Okay so i believe i have the variables created correctly and have them going up p/s but im not exactly sure. i tried messing with dialogs to get some kind of box to tell what the variables are currently at. also im not sure how to tie these variables to the unit or if they are already tied to the players just through creating the array
 

X-maul

AKA: Demtrod
Reaction score
201
I know you are currently working with another system, but I just wanna leave a suggestion here :)

The way I would do it, would be to have an attribute behavior for each of your stats, give those attributes to your units. This would make the attribute show a number, as defualt it would show 0. Now you create a buff behavior and name it Attribute Increaser, go to the modification part and make it increase each of your Attributes with 0. (this is so you can refer to this location).
Now also give your unit this Attribute Increaser behavior (make it hidden).

Now you go to the trigger editor, and create a Global Variable, 1 for each attribute, and make it have an array of 16 (1 for each player).

Now create a trigger which periodically increases the Global Variable by the amount you want each second. I just made this trigger, which works for me.
Code:
Periodic Trigger
    Events
        Timer - Every 1.0 seconds of Game Time
    Local Variables
        X = 0 <Integer>
    Conditions
    Actions
        Player Group - For each player X in (All players) do (Actions)
            Actions
                Variable - Modify Radiation[X]: + 1
                Catalog - Set value of Behaviors AttributeIncreaser Modification.AttributeChangeArray[0].Points for player X to (String(Radiation[X]))
(The action is named Catalog Field Value Set

The Attribute Increaser buff behavior modification part, looks like this:
9hqZTUf.jpg

Also, I tested it on a marine ingame, it looks like this, I assume this is how you want it to look;
sRz8L6L.jpg
 

Jokker

Member
Reaction score
16
I would like to point out that the suggestions made by others are excellent

If you are any good with the data editor then using the way others pointed out would almost always be better. Not as messy and a lot forgiving on the map (loading times, lag and so on). But if you feel you can't manage the data editor, then triggers are fine.

If you still are doing it on triggers, you can test your values by printing them on the screen with periodic triggers. If you search for "text" in the triggers you should find something to show text on screen /in the chat area..

To tie the players to the unit - as you said it is the only unit the player has: When dealing damage pick every unit for that player and deal damage to "all" picked units (so actually you will deal to 1 unit)
 

RipTheJacker

New Member
Reaction score
0
You guys are awesome. Thanks for all the help. Ill probably continue to put updates on what im doing as I stumble upon this editor lol. Pretty new to the editor but I think its coming along great.
 

RipTheJacker

New Member
Reaction score
0
X-Maul Thanks for your idea. Was really simple and easy to put those into my game that way. took about 20 minutes. I couldnt find where you hide the gain attribute though. Also i tried to make it so when the attribute would get to 1000 that it would give you a negative buff that gives a effect of -1hp p/s. but thats not as easy as i imagine lol And i guess the next step would be to create consumables and an inventory for the players to keep these status's low
 

X-maul

AKA: Demtrod
Reaction score
201
For the Hidden part, there is a flag in the behavior data prt, which is named Stats: Flags then you check the flag which says Hidden.

The debuff, which would deal -1hp p/s could be done in two ways:
  1. You could have a buff behavior, make it give the unit -1 hp regeneration. This would be simple, but would also cause increased health regeneration to be able to negate it.
  2. The other way would be to create a behavior which deals damage to the source unit (the unit holding the behavior), using a damage effect as a periodic effect for the buff behavior.
I would use option 2, which really, is very simple :)
To make it only deal damage when you reach an attribute count of 1000, is actually super simple, and can be achived with the data type called Validators, they are basically conditions for the data editor. What you wanna do is to go to the validator tab, create a new validator of the type Unit Compare Behavior Count.
  • Now set the Validator: Behavior field to your Radiation attribute behavior.
  • Set the Validator: Value to 1000
  • Set the Validator: Compare to Greater than or equal to (not really needed if it can not go above 1000)
Now go to the Behavior tab again, and find your Damage Debuff behavior, and set the Behavior: Validators (Disable)+to your new validator.
This should do it :)
Your Damage Debuff should look like this when you are done:
psRM7Lz.jpg


(This would make the damage debuff be shown at all time, you CAN actually make it only show when it's activated, but this would need a workaround, by making another behavior which checks a few times a second, if the radiation level is 1000, and then apply the damage debuff, and make it last only a little while (make it last 0.3 seconds, and apply it every 0.2 sec, to make it look as if it were permanent - Tell me if you want me to help you make this instead, not hard, just another way to do it).
 

RipTheJacker

New Member
Reaction score
0
Awesome. its coming along great. Thanks for your help man. Probably will start another thread to start working with consumables today or tomorrow. Definitely will put your name in the credits. I got the buffs working properly. If you would like to help me make it so they are hidden it would make the game look more detailed and help from any confusion from players as to why they are taking damage
 

X-maul

AKA: Demtrod
Reaction score
201
To be able to make it show, only when you have 1000 radiation points, you will have to have another behavior applied to the unit, which will check once every 0.2 sec (lower wont make a difference that you'll be able to notice) and apply the damage behavior, which has a duration of 0.3 (just needs to be something like 0.1 higher to make it seem permanent).

  • First you go and create a new effect of the type Apply Behavior and name it Apply Behavior.
    • Now set the Effect: Behavior field to your Damage Debuff.
  • Now go to your damage debuff and set the Stats: Durationfield to 0.3, and remove the validator.
    • You can also change the UI: Icon and UI: Description to something you like, and set the Behavior: Allignment to Negative.
It should look like this
VxW69b5.jpg

  • Now you'll have to create a new behavior of the type Buff and name it Apply Damage Debuff.
    • Set the Behavior: Validators (Disable)+ to your validator that checks for behavior stacks.
    • Set the Stats: Flags to Hidden.
    • Set the Effect: Effect - Periodic to your Apply Behavior effect.
    • Set the Stats: Period to 0.2
It should look like this
2wU16RJ.jpg

  • Now go to your unit, and replace your damage behavior with your new Apply Damage Debuff behavior.
It should look like this
VmV0gbV.jpg

Ingame it should look like this
qmtg2Lr.jpg

(I've just modified the validators number to 10, to test it)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top