Author Topic: Save and Load maxhealth  (Read 3032 times)

My bad, I meant a player variable for vce that represents health, since you can't save the maxhealth or the health variable (well, you can but you can't load it)

Aw dang, that sucks so I can only save but not load. So there's no other way?

Would it be possible for the Health mod that you made to have its own health variable? Like instead of (health and maxhealth), like (zhealth and zmaxhealth) or something?
« Last Edit: March 29, 2015, 09:07:57 AM by YounqD »


What do you mean?

Like some mods come with there own variable, would this health mod be able to make its own health variable that can change a players health or maxhealth.

Like

onActivate - client - modVariable - (custom not default)maxhealth - add/set - 1000

You could easily add them with the mod, but it seems these variables exist:
function MaxHealth_registerVariables()
{
   if(isPackage(VCE_Main))
   {
      registerSpecialVar(Player,"health","%this.getHealth()");
      registerSpecialVar(Player,"maxhealth","%this.getMaxHealth()");
      registerSpecialVar(Vehicle,"health","%this.getHealth()");
      registerSpecialVar(Vehicle,"maxhealth","%this.getMaxHealth()");
   }
}

We can make the same ones, except it sets them. You can replace this code with
function MaxHealth_registerVariables()
{
   if(isPackage(VCE_Main))
   {
      registerSpecialVar(Player,"health","%this.getHealth()","setHealth");
      registerSpecialVar(Player,"maxhealth","%this.getMaxHealth()","setMaxHealth");
      registerSpecialVar(Vehicle,"health","%this.getHealth()","setHealth");
      registerSpecialVar(Vehicle,"maxhealth","%this.getMaxHealth()","setMaxHealth");
   }
}

At the moment I am lazy to even fix up the health add-on

You could easily add them with the mod, but it seems these variables exist:
function MaxHealth_registerVariables()
{
   if(isPackage(VCE_Main))
   {
      registerSpecialVar(Player,"health","%this.getHealth()");
      registerSpecialVar(Player,"maxhealth","%this.getMaxHealth()");
      registerSpecialVar(Vehicle,"health","%this.getHealth()");
      registerSpecialVar(Vehicle,"maxhealth","%this.getMaxHealth()");
   }
}

We can make the same ones, except it sets them. You can replace this code with
function MaxHealth_registerVariables()
{
   if(isPackage(VCE_Main))
   {
      registerSpecialVar(Player,"health","%this.getHealth()","setHealth");
      registerSpecialVar(Player,"maxhealth","%this.getMaxHealth()","setMaxHealth");
      registerSpecialVar(Vehicle,"health","%this.getHealth()","setHealth");
      registerSpecialVar(Vehicle,"maxhealth","%this.getMaxHealth()","setMaxHealth");
   }
}

At the moment I am lazy to even fix up the health add-on


Okay, well I mean i'm not sure how replace them and use it exactly. I mean i can give it a shot but if you are ever feeling up to making it and explaining how to use it exactly, then by all means go ahead, and thank you a lot you've helped me a lot.



Okay so i did this, but now i'm not sure what to do with it.

Also sorry for early bump.

i think you put them in the server.cs or something in vce

i think you put them in the server.cs or something in vce

Yeah I already added it to the mod, saved it and everything, but I just need to know how would I use it in game now. Like how do I use what ever it was I just did.

When you make the VCE events, you can now set health, example:

OnActivate > Player > VCE_modVariable > health set 0

When you make the VCE events, you can now set health, example:

OnActivate > Player > VCE_modVariable > health set 0

Okay I just tried that and it didn't work for multiple things. Couldn't save or load, couldn't even actually set the health, and it wouldn't show up on screen on the VCEhud mod.

There's no way to specifically make a mod for saving and loading maxhealth? Example


OnActivate - client - saveMaxHealth

or

OnActivate - client - loadMaxHealth



Sorry if i'm being difficult, I just want it to work right.

I've made one for my RPG using the max health mod (except I made a different max health mod), but loads health and saves it in case people leave when they are being killed by something. I can make a mod attachment for the health mod to save/load health.

I've made one for my RPG using the max health mod (except I made a different max health mod), but loads health and saves it in case people leave when they are being killed by something. I can make a mod attachment for the health mod to save/load health.

If you can do that, that would be perfectly fine. As long as it loads health when they leave the server and come back, or if they die and respawn.

If you can do that, that would be perfectly fine. As long as it loads health when they leave the server and come back, or if they die and respawn.
All I did was add the events of Player::addHealth and Player::loadHealth, you'll have to do the rest of the events, but there is also a toggle if you don't want the saver on. It will also remove the events in-game, /toggleHealthSaver. I didn't test this, but it should work.

Zzerver_NewHealth

All I did was add the events of Player::addHealth and Player::loadHealth, you'll have to do the rest of the events, but there is also a toggle if you don't want the saver on. It will also remove the events in-game, /toggleHealthSaver. I didn't test this, but it should work.

What do you mean I have to do the rest of the events? Also I toggled it and it said that it added the events from the event list but I don't see it. Once again i'm sorry for not understanding completely.

Okay I see it in the event list, but the text says that it was disabled, and when its enabled its not in the event list. Also it doesn't work either lol sorry.
« Last Edit: April 06, 2015, 12:03:57 AM by YounqD »

I think I made the toggle backwards. If it says it's off is on.