Hi everyone - just figured out a way to make a Modify Protounit that can set the value of a field rather than add or subtract from it. It works by abusing the loss of precision with high numbers causing many values to become the same value - something that happens when you add a large number to a small number.
With this trick adding and subtracting a very large number will give the result of zero. As a result this then allows the value to be set to whatever you like regardless of the starting value. This will not work with every field but the majority of fields do seem to work including:
Hitpoints
LOS
Speed
Lifespan
Attack
Cost
And probably several others. Some fields like population count does work - might relate make adjustments to make it work for those fields too but thought it was worth releasing anyway in its current state in case anyone finds it useful.
With this trick adding and subtracting a very large number will give the result of zero. As a result this then allows the value to be set to whatever you like regardless of the starting value. This will not work with every field but the majority of fields do seem to work including:
And probably several others. Some fields like population count does work - might relate make adjustments to make it work for those fields too but thought it was worth releasing anyway in its current state in case anyone finds it useful.
<Effect name="Modify Protounit Absolute player range">
<Param name="ProtoUnit" dispName="$$22449$$ProtoUnit" varType="protounit"> Anubite< /Param>
<Param name="p1" dispName="lowest player" varType="player"> 1< /Param>
<Param name="p2" dispName="highest player" varType="player"> 4< /Param>
<Param name="Field" dispName="$$23943$$Field" varType="pufield"> 0< /Param>
<Param name="Amount" dispName="Amount" varType="float"> 1.0< /Param>
<Command> trQuestVarSet("PlayerID", %p1%);< /Command>
<Command> while(%p2%> =trQuestVarGet("PlayerID")) {< /Command>
<Command> trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, 9999999999999999999.0);< /Command>
<Command> trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, -9999999999999999999.0);< /Command>
<Command> trModifyProtounit("%ProtoUnit%", 1*trQuestVarGet("playerID"), %Field%, %Amount%);< /Command>
<Command> trQuestVarSet("PlayerID", trQuestVarGet("PlayerID")+1);}< /Command>
</Effect>
[This message has been edited by nottud (edited 09-23-2017 @ 08:31 AM).]