Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

[solved] Thrust Override doesn't work in 2nd code iteration

Discussion in 'Programming (In-game)' started by Sero93, Jun 22, 2017.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Sero93 Trainee Engineer

    the following code is Part of a bigger script.
    for better understanding i inserted the whole foreach loop, which gives me trouble.

    This code snipped is actually responsible for dedocking a small drone via mergeblock, in particular this is the part where the thrusters are getting fired to generate distance between mothership and drone.

    When i weld the first Drone, it works perfectly and drone gets properly seperated.
    If i weld/place the next drone, everything seems to work fine, except the Thrusters are not firing.

    Interesting is, that the "Echo" statement is fired correctly in the 2nd iteration. So it says the specific thrusters have been overwritten, but they aren't. They are toggled on, ownership is ofc no thing (as the first drone works and its same blueprint), but the override is not happening.

    for debugging i copied the 2nd drone in, renamed some thrusters and docked it after the first succesfully dedocked, to see wheather its a problem relating to the blueprint copy pasta, but that also didn't help. (the echo even gave the correct name change, but still no override reached the drone).

    so i don't understand how that ' thruster.SetValueFloat("Override", 9999);' can fail ONLY in upcoming iterations, when the Echo statement and upcoming code are working properly.

    Any ideas?

    foreach(IMyRemoteControl currentremote in remoteswarm)
                    foreach(IMyThrust thruster in GetBlocksInTheSameGrid(currentremote))
                        if(thruster.Orientation.TransformDirection(Base6Directions.Direction.Forward) == swarm_dedockdirection)
                            thruster.SetValueFloat("Override", 9999);
                            Echo("added "+thruster.CustomName);
    --- Automerge ---
    ah, i was just stupid...the "thrusters.Add(thruster);" part was the problem.
    in the upcoming code i checked wheather the drone is far enough away from ship than it will disable the override... by accident i messed it up, so the first the drone IS far enough away, but it will not toggle only its own thrusters, but also all thrusters from new drones.

    so in basic it DID override the Thrusters, but i instantly reverted that in upcoming code -.- took me 2 hours to see that.
Thread Status:
This last post in this thread was made more than 31 days old.