Lort Krassbeter
Chieftain
Hi,
working on a mod that has to disable the user to move units at specific times during the turn. Currently I am doing this by setting the units movement points to 0. However, I noticed that this prevents a unit that actually hasn't moved to heal at the end of the turn. So I implemented a functionality that sets the movement points back to maximum movement points OnActivePlayerTurnEnd for the units that would normally have healed, since I assumed that that is causing them not to heal. Since it still didn't work I took a look into the DLL to figure out what a unit that will heal has to be like:
Okay, so the unit will only heal if it has not moved as I assumed. But this whole function is called in the setTurnActive function of CvPlayer and is in fact called before DLLUI->PublishActivePlayerTurnEnd();
Do I assume correctly that PublishActivePlayerTurnEnd() will trigger the lua event?
If so this means I can not use ActivePlayerTurnEnd to fix my problem. Are there any other events in that case that can perhaps be used?
Alternatively, it would also be possible to deny the player to select the units that have to heal, so I do not have to set their movement points to 0. However I could not figure out any way to do so yet. Any help is appreciated
working on a mod that has to disable the user to move units at specific times during the turn. Currently I am doing this by setting the units movement points to 0. However, I noticed that this prevents a unit that actually hasn't moved to heal at the end of the turn. So I implemented a functionality that sets the movement points back to maximum movement points OnActivePlayerTurnEnd for the units that would normally have healed, since I assumed that that is causing them not to heal. Since it still didn't work I took a look into the DLL to figure out what a unit that will heal has to be like:
Code:
if(!pLoopUnit->isEmbarked())
{
if(pLoopUnit->hasMoved())
{
if(pLoopUnit->isAlwaysHeal())
{
pLoopUnit->doHeal();
}
}
else
{
if(pLoopUnit->IsHurt())
{
pLoopUnit->doHeal();
}
}
}
Do I assume correctly that PublishActivePlayerTurnEnd() will trigger the lua event?
If so this means I can not use ActivePlayerTurnEnd to fix my problem. Are there any other events in that case that can perhaps be used?
Alternatively, it would also be possible to deny the player to select the units that have to heal, so I do not have to set their movement points to 0. However I could not figure out any way to do so yet. Any help is appreciated
