Setting position after "move to environment" comm

Home Board Index » X3AP » Scripts and Modding » Setting position after "move to environment" comm

VatutinMax

VatutinMax avatar
Level badge Rookiguey (4)
Posted 10 years ago.

Hi all!) I'm Max and I'm currently working with Robert on the BSG mod.
I've fully written an FTL jumping system (based on paulps 2p2 jump script, but in fact there is not much paulps code already =)). Ad I have a problem to be solved, maybe someone will give me some tip!
So here's a final part of the code of a main plugin:

* Sending warning:
$strtime = 'X seconds until jump!'
if [THIS] == [PLAYERSHIP]
$classtime = convert number $w8count to string
$strtime = substitute in string $strtime: pattern 'X' with $classtime
display subtitle text: text=$strtime duration=2000 ms
end
* Counting:
while $w8count > 0
= wait 1000 ms
dec $w8count
end
* Command using check
skip if [THIS]-> get command
[THIS]-> set command: [COMMAND_FTL_JUMP]
* Executing the jump
[THIS]-> put into environment $target.sector->
* Setting ship position in the sector
[THIS]-> set position: x=$x y=$y z=$z
* Removing needed fuel from cargobay
$nfuel = -$nfuel
= [THIS]-> add $nfuel units of {Tylium fuel}
* END
return null



As you can see, the feature is to get rid of vanilla jumpdrive and ecells. But, as far as I know, the command "use jump drive: target=$Value" is hardcoded and can be called only with Jumpdriveonboard and will take some ecells anyway. In this case I had to use "[THIS]-> put into environment $target.sector->" this one... In fact it's doing same to "use jump drive: target=$Value", but without any wares required. But using this command causes (for some mysterious for me reason) an issue with the next command "[THIS]-> set position: x=$x y=$y z=$z"...

In fact after the jump ship appears at the center of the sector and that's all. Nothing happens, it doesn't move anywhere... Seems like next line was not executed, but it's impossible + script takes correct amount of "{Tylium fuel}" which should be executed after moving command. Another fact is that if you use the FTL drive in the same sector ship jumps to correct coordinates!

And I've tried both "set position" and "force position" commands, nothing happens. But if you place a vanilla "Use jumpdrive..", all seems to work.

Any help would be appreciated!

P.S. Sorry for my terrible English, it's not my native language =( Aslo code tags were not working for some reasons, so I had to paste the code as you can see it atm(

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

hi there, well the code tag wasnt working to start with because of my level-system. This is to stop new members registering, then posting a load of links to spam-sites. It does happen from time, to time - albeit not very often. I have inserted the tags now for you (as it makes it much easier to read).

Have you tried putting a delay after the jump command? I know its not ideal, but maybe when then the ship is being moved, the game could be loading from the HDD (so the script can not move the ship whilst loading in the sector).

VatutinMax

VatutinMax avatar
Level badge Rookiguey (4)
Posted 10 years ago.

Yep, i've tried this delay adding "=wait 2000ms" befor the "set position" command... Tired more ad less time as well. Have an idea to use "call script" command with set position, will try today later.
Thanks a lot anyway)

VatutinMax

VatutinMax avatar
Level badge Rookiguey (4)
Posted 10 years ago.

Ok, I've fixed this issue. Just added a check if this is a player ship and made a separate jumping code with two delays and additional check on the current sector. Thanks you, Roguey, anyway for a reple! =)

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

ah glad you got it sorted. I used to get that with the x-games; you get something odd which stops you in your tracks for awhile. It can be the most oddest thing too.

VatutinMax

VatutinMax avatar
Level badge Rookiguey (4)
Posted 10 years ago.

Hey!) I have a new simple question =) I've stacked with some messages... I've added an extra feature to FTL jump system. The idea is that when the ship have a hull damage and it's current hull % is less than stated (atm it's less than 60%) there is a chance to loose some wares and ships due to structural damage of the ship. All is working perfectly except one thing... I want to make a message which will contain every ship lost. Here is a part of code:
if $dock.check > 0
$ships.onboard = [THIS]-> get ship array from sector/ship/station
if not $ships.onboard == null
for each $s in array $ships.onboard using counter $count
$ship.check = random value from zero to 3
if $ship.check == 0
$ship.lost = $s-> get name
append $ship.lost to array $ships.lost.total
$s-> destroy object: killer=null, show no explosion=[TRUE
end
end
end
end

The question is how to send a message which will show $ships.lost.total array correctly?)
Cheers

Roguey

Roguey avatar
Level badge Trueguey (22)
Posted 10 years ago.

hmm.. well I would suggest using write to log-book, rather than a big pop-up message. After that, then I think there is a sprintf command you can use to format a string, to then post on the log-book. Although its been awhile since I scripted much Smile

1


You need to log-in to post here.