How to get hull value in code ?
-
yes its time in seconds for every regen
[FTLRestrictions] li_freighter means on that ship can ftl
FTL timers is seconds as well the higher the long it takes to charge
the ftl comands are
/ftl 0 0 0 is the default when you target a jh or gate it will dock with it and then you jump to chords 0 0 0
/sftl 0 0 0 will let you jump around in the system your in
/chords will give you exact chords of a object you want to jump to -
"Settings.cpp void LoadSettings()" IniGetSection(set_scCfgFile, "HullRegens", lstRegenDevice); "Settings.cpp setting variables" list <inisectionvalue>lstRegenDevice; "global.h // setting variables" extern list <inisectionvalue>lstRegenDevice; "HKFuncplayers.cpp" HK_ERROR HkInitArmourRegen(uint iClientID) { ClientInfo[iClientID].bCanRegen = false; wstring wscCharname = Players.GetActiveCharacterName(iClientID); list <cargo_info>lstEquipment; int iRemaining; if (HKHKSUCCESS(HkEnumCargo(wscCharname,lstEquipment,iRemaining))) { foreach(lstEquipment, CARGO_INFO, it) { if((*it).bMounted) { foreach(lstRegenDevice,INISECTIONVALUE,it2) { uint iRegenDevice = CreateID((*it2).scKey.c_str()); if ((*it).iArchID == iRegenDevice) { set_ArmourRegenTime = atoi(Trim(GetParam((*it2).scValue, ',', 0)).c_str()); ClientInfo[iClientID].tmRegenTime = timeInMS() + set_ArmourRegenTime; ClientInfo[iClientID].bCanRegen = true; }}}}} return HKE_OK; } "HKCbIServerImpl.cpp PlayerLaunch" HkInitArmourRegen(iClientID); "Hook.h // HkFuncPlayers" HK_ERROR HkInitArmourRegen(uint iClientID); "CLIENT_INFO" //Armour Regen bool bCanRegen; mstime tmRegenTime; "// HkTimers" void HkTimerArmourRegen(); "HkCbIServerImpl.cpp TIMER Timers[] =" {HkTimerArmourRegen, 500, 0}, "HkInit.cpp clear the clientinfo" ClientInfo[iClientID].tmRegenTime = 0; "HkTimers.cpp" //Armour Regen void HkTimerArmourRegen() { try { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientID = HkGetClientIdFromPD(pPD); if (ClientInfo[iClientID].bCanRegen) { if(timeInMS() > ClientInfo[iClientID].tmRegenTime) { ClientInfo[iClientID].tmRegenTime = timeInMS()+ set_ArmourRegenTime; uint iShip; float HullNow; float MaxHull; float Regen; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetHealth(iShip , HullNow, MaxHull); Regen = (HullNow / MaxHull); if (Regen<0.1f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.2f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.3f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.4f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.5f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.6f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.7f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.8f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;} if (Regen<0.9f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} }}}}catch(...) { AddLog("Exception in %s", __FUNCTION__);}}</cargo_info></inisectionvalue></inisectionvalue>
-
Hi kosacid:
Thanks for your reply and time.
You mean that the regen function only can let a ship hull regen, its not an item that can equipment to any ship, and let the ship has regen function ?
If is, how to change it to an item to achieve above function ?
My mod players love your work, we are appreciate your hard work, and I will add your name to my mod let everyone know that’s your help to make the game has more funny.
Here is link that thanks your work in my forum:
-
I was read your code and now I understand all of function.
Your code can let an item regen ships armour.
Thanks for your hard work, now I will try to add your code and make a test.
Great job kosacid !
-
I find if you change HkTimers.cpp code:
void HkTimerArmourRegen() { try { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientID = HkGetClientIdFromPD(pPD); if (ClientInfo[iClientID].bCanRegen) { if(timeInMS() > ClientInfo[iClientID].tmRegenTime) { ClientInfo[iClientID].tmRegenTime = timeInMS()+ set_ArmourRegenTime; uint iShip; float HullNow; float MaxHull; float Regen; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetHealth(iShip , HullNow, MaxHull); Regen = (HullNow / MaxHull); if (Regen<0.1f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.2f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.3f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.4f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.5f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.6f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.7f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.8f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;} if (Regen<1.0f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} } } } } catch(...) { AddLog("Exception in %s", __FUNCTION__);} }
to:
void HkTimerArmourRegen() { try { struct PlayerData *pPD = 0; while(pPD = Players.traverse_active(pPD)) { uint iClientID = HkGetClientIdFromPD(pPD); if (ClientInfo[iClientID].bCanRegen) { if(timeInMS() > ClientInfo[iClientID].tmRegenTime) { ClientInfo[iClientID].tmRegenTime = timeInMS()+ set_ArmourRegenTime; uint iShip; float HullNow; float MaxHull; float Regen; pub::Player::GetShip(iClientID, iShip); pub::SpaceObj::GetHealth(iShip , HullNow, MaxHull); Regen = (HullNow / MaxHull); /*if (Regen<0.1f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.2f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.3f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.4f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.5f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.6f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.7f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.8f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;}*/ if (Regen<1.0f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} } } } } catch(...) { AddLog("Exception in %s", __FUNCTION__);} }
will be better.
-
whats up with slowly regenerating the hull i though that what you ment lol
that way its going right to the top
with a slight change to it you can heal the device its self if you want -
I change those code because some time when my ship get hull danger, the regen item doesn’t regenerating hull, until I get more hull danger.
What’s your next code ? like make an item can add cargo hold ?
Do you think that’s possible ?
-
if (Regen<0.19f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.2f); return;} if (Regen<0.29f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.3f); return;} if (Regen<0.39f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.4f); return;} if (Regen<0.49f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.5f); return;} if (Regen<0.59f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.6f); return;} if (Regen<0.69f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.7f); return;} if (Regen<0.79f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.8f); return;} if (Regen<0.89f) {pub::SpaceObj::SetRelativeHealth(iShip, 0.9f); return;} if (Regen<0.99f) {pub::SpaceObj::SetRelativeHealth(iShip, 1.0f); return;} ```how about that ill look into the extended hold
-
here a way i thought about doing it
using a command
say like /compress cargo
hook will then right it to the players file and destroy the cargo in the hold
then you can load up again with more
when you get to where your going sell the cargo then
do the command /uncomprss cargo
then hook will read the players file and put the cargo back in the hold
this way you can double you cargo holds capacity
all you have to do is make sure a device is on board for the player to be able to do it
you want to give it a go ??? -
Oh, I mean that make a function like hull regan, you can use an item to add your ship cargo hold, not use flhook command.
Think about that can make the game more funny.
17/17