Spring 89.0 - underwater units are scared of deep water
Posted: 20 Jul 2012, 03:03
Underwater tanks stop to move when reach the bottom of the sea. Sometimes stucked.
Spring 89.0 + NOTA 1.68
Spring 89.0 + NOTA 1.68
Open Source Realtime Strategy Game Engine
https://springrts.com/phpbb/
In BOS i see only this:Kloot wrote:Although I don't see it in armcroc.bos, the compiled version of armcroc's script issues a set MAX_SPEED to 0 when the unit enters water which (as the changelog mentions) has a permanent effect in 89.0 --> mod bug.
Code: Select all
AmphSpeed()
{
Static_Var_3 = get UNKNOWN_UNIT_VALUE(75);
while( TRUE )
{
if( get IN_WATER )
{
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 0.75;
}
else
{
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3;
}
sleep 30;
}
}
Code: Select all
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 3 / 4;
the result is still not integer.. so? :)FLOZi wrote:I'm not sure about Spring, but in OTA bos/cob only handled integers (so 0.75 becomes 0).. may even be a limitation of scriptor compiler, perhaps try:
Also, de-cobbled scripts make baby noodle monsters cry.Code: Select all
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 3 / 4;
I put there only *3 to see if the bug is here and they move now everywhere.. so it was it. ThxPepeAmpere wrote:the result is still not integer.. so? :)FLOZi wrote:I'm not sure about Spring, but in OTA bos/cob only handled integers (so 0.75 becomes 0).. may even be a limitation of scriptor compiler, perhaps try:
Also, de-cobbled scripts make baby noodle monsters cry.Code: Select all
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 3 / 4;
btw.. i didnt know that there is "very_large_number"-... and btw i was not sure how spring understands *3 and /4.. i didnt know which priority is used in this situation (i dont know in which language it is written). Thx for revealing me thisFLOZi wrote:Yes, it is, due to integer maths and BIDMAS.
3/4 = 0
very_large_number * 3 / 4 = even_larger_number / 4 = reasonably_sized_number
e.g.
1024 * 3 / 4 = 3072 / 4 = 768
Ok, thx.FLOZi wrote:unit speeds (e.g. if you were to use get PRINT (Static_Var_3);, where PRINT is 81) in BOS are quite large integers, precisely due to the fact that it doesn't do decimals.![]()
The language will largely follow standard BIDMAS rules for order of operations afaik, in this case * and / have the same priority so order (left to right) takes precedence.
(If you want to see operator priorities for Scriptor, look at Compiler.cfg in your scriptor install)