Profile image

Is there any way for a random value in xml?

344 senkanhitachi  4.4 years ago

I am currently working on weapon system similiar to MW-1 munitions dispenser, is there any method to have random value in cannon projectile velocity? to random generate a value between A to B every time when shoot?

  • Log in to leave a comment
  • Profile image
    6,361 Aeromotive

    @senkanhitachi If you need a float you can try multiplying the function output with a float and see if that does any good.

    4.4 years ago
  • Profile image

    @Aerofy Seems like the projectile velocity can only apply the flout/double value and not support function. I try to use a function as a value on that, it always use 0 as default

    4.4 years ago
  • Profile image
    6,361 Aeromotive

    @senkanhitachi Use funky trees

    4.4 years ago
  • Profile image

    @Aerofy I understand how to create a random function, i dont know how to create a function in simpleplanes xml.

    4.4 years ago
  • Profile image
    6,361 Aeromotive

    Stackoverflow is generally where you find formula's like that with plenty of explanation.
    Here's an example I stumbled upon: Link

    4.4 years ago
  • Profile image

    @Aerofy is there any document for that?

    4.4 years ago
  • Profile image
    6,361 Aeromotive

    I don't think there is. But you can try looking up a function for generating random numbers and implement it yourself.

    4.4 years ago