View topic - Spring 89.0 - underwater units are scared of deep water



All times are UTC + 1 hour


Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: 20 Jul 2012, 02:03 
User avatar

Joined: 03 Jun 2010, 00:28
Underwater tanks stop to move when reach the bottom of the sea. Sometimes stucked.

Spring 89.0 + NOTA 1.68


Attachments:
File comment: underwater tanks of both sides dont move under water-- esp. at the bottom of the sea
pathing01.jpg [70.14 KiB]
Downloaded 5 times
Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 11:32 
Spring Developer

Joined: 08 Oct 2006, 15:58
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.


Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:09 
User avatar

Joined: 03 Jun 2010, 00:28
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.


In BOS i see only this:

Code:
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;
   }
}


and i see something about 0.75 of speed underwater. I dont know what is in COB, but i compiled the file again, so it should be the same as bos. Can you tell me where you see the mention about speed = 0 pls?

The another fact is, these tanks moves underwater quite ok, normaly, the problem is only when they reach the bottom of the sea. So i think i has nothing to do with animation script, becouse theres no mention about action "bottom of the sea reached"... but maybe Im wrong, becouse i dont understand the bos/cob files code much.


Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:17 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
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:

Code:
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 3 / 4;


Also, de-cobbled scripts make baby noodle monsters cry.


Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:21 
User avatar

Joined: 03 Jun 2010, 00:28
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:

Code:
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 3 / 4;


Also, de-cobbled scripts make baby noodle monsters cry.


the result is still not integer.. so? :)


Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:24 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
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


Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:25 
User avatar

Joined: 03 Jun 2010, 00:28
PepeAmpere wrote:
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:

Code:
set UNKNOWN_UNIT_VALUE(75) to Static_Var_3 * 3 / 4;


Also, de-cobbled scripts make baby noodle monsters cry.


the result is still not integer.. so? :)


I put there only *3 to see if the bug is here and they move now everywhere.. so it was it. Thx


Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:27 
User avatar

Joined: 03 Jun 2010, 00:28
FLOZi 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


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 this ;)


Last edited by PepeAmpere on 23 Jul 2012, 01:42, edited 3 times in total.

Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:32 
Moderator
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
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)

edit: Didn't realise BIDMAS is a UK-ism; http://en.wikipedia.org/wiki/Order_of_o ... #Mnemonics


Last edited by FLOZi on 20 Jul 2012, 15:50, edited 1 time in total.

Top
 Offline Profile  
 
PostPosted: 20 Jul 2012, 15:33 
User avatar

Joined: 03 Jun 2010, 00:28
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)


Ok, thx.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.