Giving players Dyamic Health based on stregnth
by Michael Branin · in Torque 3D Professional · 12/16/2009 (2:40 am) · 5 replies
Anyone know how to give the players dynamic health instead of the standard 100 health that T3D gives?
For Example:
Say I have given my players a new stat Names strength
and I want to determine a Dynamic health of (Strength * 2)
So with
50 Strength the player would have 100 Health
75 Strength the player will have 150 Health
100 Strength the player would have 200 Health
Ect I just need to find a way to dynamiclly adjust the players max health instead of every player starting with a standard 100 health.
I have tried this Resource here but for the life of me can not figure out where to make the correct changes
www.torquepowered.com/community/resources/view/9774
For Example:
Say I have given my players a new stat Names strength
and I want to determine a Dynamic health of (Strength * 2)
So with
50 Strength the player would have 100 Health
75 Strength the player will have 150 Health
100 Strength the player would have 200 Health
Ect I just need to find a way to dynamiclly adjust the players max health instead of every player starting with a standard 100 health.
I have tried this Resource here but for the life of me can not figure out where to make the correct changes
www.torquepowered.com/community/resources/view/9774
#2
12/16/2009 (2:41 pm)
That resource doesn't look like it accounts for networking. There is an old resource called "variable player stats" or something similar, and that gets you variable stats for players without messing with the datablock (because any changes to the datablock affect all players who use that datablock).
#3
12/16/2009 (7:42 pm)
Good point Ted. I had forgotten about that with the datablocks.
#4
You could add variables to Player to store and network a new non-datablock health value, but I find it much easier to just scale the incoming damage based on your desired health.
For example, if the player has 100 health in the datablock, but you'd like him to have 1000 health, scale all damage by 0.1 in player.cs (scripts/server) and you're done. No code edits, no extra network traffic.
I should note this won't work if you want to display numerical health.. I use % bars, so it's not a concern.
01/18/2010 (12:57 am)
Sort of 30 days too late, but I often see cases where people are making things harder than they need to be.You could add variables to Player to store and network a new non-datablock health value, but I find it much easier to just scale the incoming damage based on your desired health.
For example, if the player has 100 health in the datablock, but you'd like him to have 1000 health, scale all damage by 0.1 in player.cs (scripts/server) and you're done. No code edits, no extra network traffic.
I should note this won't work if you want to display numerical health.. I use % bars, so it's not a concern.
#5
02/09/2010 (6:00 am)
20 days late - What Henry says + For numerical values, just calculate based on the player.cs value and your own nondatablock value
Torque Owner Chris Sargent
Glorious Software