Profile image

State shifting FT

101k winterro  yesterday

So, i want to have a go at the coordinate guided ai stuff. And maybe staged attack patterns for my bewilderbeast. I do not want to use other peoples crafts to learn this cause i won't learn anything from that.

Whats the code that makes it go Coord1 > Coord2 > Coord3 > Coord4 > Coord1?

i don't know how to do this as with my understanding, when my craft reaches the next coordinate i do not know how to "shift the gear" to the next position if you know what i mean.

If someone knows this, could you please explain its workings in the most barebones state?

  • Log in to leave a comment
  • Profile image

    @winterro you can freeze a value using smooth with the maximum rate set to 0, and unfreeze it by setting the rate to a very large number

    11 hours ago
  • Profile image
    101k winterro

    @hpgbproductions also, is there a code that acts similar to ZeroOnDeactivate = false?

    like true by default, but activates it when it reaches coord4?

    i have a system for that, however i am not even gonna bother trying to put 50 rotators in a vehicle that does high G force meneuvres.

    18 hours ago
  • Profile image

    @winterro that's usually a bit shift operator, it doesn't work on sp
    To change a value in sp, you can activate a variable setter for a short time, or only when a specific event happens:
    .
    setter i: 2
    activator: i=1 & Event1
    .
    The state machine must check its own state because not every old state is allowed to go to the new state. A state machine works like a flow chart.

    yesterday
  • Profile image
    101k winterro

    @hpgbproductions does shift or >>

    Also work?

    yesterday
  • Profile image
    101k winterro

    @hpgbproductions Ah alright, i'll try that

    yesterday
  • Profile image

    You can store each x,y,z value as an array-like ternary statement chain, then use a coordinate index to retrieve the value you want:
    .
    setter i:
    1
    .
    setter x:
    i=1 ? 1000 : (i=2 ? 2000 : (i=3 ? 3000: 0))
    .
    Is equivalent to:
    int i = 1;
    int[] x = [0, 1000, 2000, 3000];

    +1 yesterday