Setting Armor Max Energy?
Yes, I know how to do this in the datablock.
But I was wondering if I can set the maximum energy of a Specific Player at any time, I am going to use this for my 'Powers Mod'.
What I mean by this is that if there was some function that was like: %obj.setMaxEnergyLevel(blah);
Also in here, I was wondering if Max HP could be changed as well.
But I was wondering if I can set the maximum energy of a Specific Player at any time, I am going to use this for my 'Powers Mod'.
What I mean by this is that if there was some function that was like: %obj.setMaxEnergyLevel(blah);
Also in here, I was wondering if Max HP could be changed as well.
Comments
I'm not even going to comment on the above function.
I'm kind of scared this question even came up. But regardless, a rough way to do this:
%obj.setEnergyLevel(%obj.getDatablock().maxEnergy);
I suggest using the Function Library for more useful functions:
http://www.tribesnext.com/forum/index.php?topic=854.0
Well...
You gave a function that restores a lot more than just energy, the function setMaxEnergy() doesn't exist, you're missing a closing brace, you referenced the same object indirectly (%obj is assumed to be the player, but could be any object, therefore if the object is a StaticShape, this call would fail as the StaticShape has no client member variable), the function is named energy (not maxEnergy or anything that hints at it's actual functionality, and this only works for light armors? Why? You even set the armor as "light", what function could that possibly have?
A function that would do what he asked for would be:
[code] maxEnergy = 60;
There is no such functionality in the script system as is, but it would be fairly easy to add, if you're clever.
Thought!: Powers Mod Eh? Well why not have the powers be weapons/packs that if you have a variable set by a chat command will choose in an onMount function what happens. Like when the energy pack is mounted it does why not change that to That makes it so that a specific player with that 'power' uses less energy when jetting, instead of having more energy. And you could edit it, like the chat command could be and in the pack So Something like that I think, probably a wrong way to do it, but I'm out of my mind at this point in time.
It's funny because it's true. Regardless, I will admit I didn't read the original post very well.
But, it's certainly possible to do what Phantom asked, independent of datablock manipulation. I'm just interested to see if he's clever enough to figure out how. I think it can be done in under 40 lines of code.
40 lines, rofl.
EDIT:
Apparently this doesn't quite work.. Energy just resets after a few seconds, or use of it.
What happens when I use a weapon that takes up 90 energy (Shadow Bomb Power)?
It takes 90 energy no matter what, so changing the jet energy drain is pointless to me.
Doing it without usage of getDatablock() seems hard to do, if not impossible. Maybe I should have a peek at the RPG mod's mana system, because the mana system is pretty much what I am trying to accomplish, only, doing it differently.
Edit:
I'm wondering, when I do figure this out, will the energy bar be modified to fit the new energy level, or just reach max (100 for my armor), while the energy continues to rise to the new maximum?
Edit 2:
I've rebuilt the RPG mod's Mana system, all credit to the RPG mod if you use this.
However I wouldn't know why you would want to use it, it still doesn't quite work yet. It properly takes energy as if you had the new max. But it still doesn't set it properly to the new maximum (Goes to 100, and stays there).
Basically large max energies that stop at a level specified place with the recharge rate taken away when its reached.
:P
So, I will still work on getting it to work that way.