Page 1 of 1

Problem with coding helicopter (gets stucked when landing)

Posted: 14 Sep 2008 10:59
by Wile E. Coyote
I tried to code helicopter-like behaving aircraft, but something wrong happens. I used following code:

Code: Select all

   40 * 4	 01 03 01 08
   41 c:\igre\ttwin95\sprites/sasw.pcx 738 8 01 57 54 -27 -29
   42 c:\igre\ttwin95\sprites/sasw.pcx 2 88 09 45 86 -48 -27
   43 c:\igre\ttwin95\sprites/sasw.pcx 98 88 01 42 119 -60 -21
   44 c:\igre\ttwin95\sprites/sasw.pcx 226 88 09 60 86 -43 -37
   45 c:\igre\ttwin95\sprites/sasw.pcx 322 88 01 58 54 -27 -29
   46 c:\igre\ttwin95\sprites/sasw.pcx 386 88 09 60 86 -43 -37
   47 c:\igre\ttwin95\sprites/sasw.pcx 482 88 01 42 119 -60 -21
   48 c:\igre\ttwin95\sprites/sasw.pcx 610 88 09 45 86 -38 -31
   49 * 9	 02 03 00 01 01 00 00 00 00 //aircraft sprites
   50 * 4	 01 03 01 02
   51 c:\igre\ttwin95\sprites/sasw.pcx 738 88 01 1 1 -1 -1
   52 c:\igre\ttwin95\sprites/sasw.pcx 754 88 09 1 1 -1 -1
   53 * 9	 02 03 01 01 01 00 00 00 00 //fake rotor sprites
   54 * 14	 02 03 10 81 10 00 FF 01 49 FF 00 0A 06 FF //set sound effects
   55 * 14	 02 03 11 81 E2 00 FF 01 03 FF 17 1C 05 FF //use 03 for taking off, preparing to land and landing,
else use 05
   56 * 26	 02 03 12 81 E2 00 FF 04 01 FF 18 19 01 FF 1B 1C 06 FF 17 17 06 FF 1A 1A 04 FF //use 01 when
preparing to land and land from airport or heliport, use 06 when taking off from airport or heliport, else use 04
   57 * 18	 02 03 13 81 10 00 FF 02 11 00 0C 0C 12 00 0E 0E 00 00 //use c-id 11 to set speed (prop. 0C),
use c-id 12 to set running costs (prop. 0E), else return real sprite
   58 * 14	 02 03 15 81 0C 00 FF 01 10 FF 23 23 00 00 //display D0 10 string in purchase list (cb 23)
   59 * 18	 02 03 20 81 0C 00 FF 02 10 00 33 33 13 00 36 36 00 00 //use c-id 10 for sound effects callback
(cb 33), use c-id 13 to change vehicle properties (cb 36), else use real sprite
   60 * 10	 03 03 01 00 01 FF 15 00 20 00 //use c-id 15 for purchase list, else use c-id 20
   61 * 7	 03 03 81 00 00 01 00 //rotor override
I hope I commented NFO good.

Bad behaviour is next: when aircraft lands, it stays stucked on airport in place where it was landed. I tried with 2,4 and 8 fake rotor sprites. I tried to replace FF with 80 when add real values in callbacks. I tried one variation in sprite 57 with changing one property and return other. I even tried code without any callbacks, but same thing happens. Same thing also happens with approximately last 100 Nightly versions (last version I tried is Nightly 2019). With OTTD aircraft is working normal (don't gets stucked). Please help. Thanx in advance!

Re: Problem with coding helicopter (gets stucked when landing)

Posted: 14 Sep 2008 11:09
by PikkaBird
Helicopters will get stuck in TTD if they try to land at less than 80mph (0x0A).

Re: Problem with coding helicopter (gets stucked when landing)

Posted: 14 Sep 2008 12:13
by Wile E. Coyote
Thanx, Pikka! That was mystery for me! :D