Coding help

  • Pyromaniac555
    5th Jan 2011 Member 0 Permalink
    I am making an element that releases GAS slowly. Does anybody know how to do this?

    something like: if(t==PT_GRBG){then I need to put something here}
  • PizzaPlatypus
    5th Jan 2011 Member 0 Permalink
    find yeast and copy it to wherever your code is then remove the bit about the temperature i.e if(parts[i].temp=293.0f) or whatever it is then change the number after the bit with (rand>()200%) or whatever and change the percent number, the higher the slower, then at the create part change YEST to GAS. This is not exact code as I don't have visual studio up at the moment, but basically that is what you do. If you don't understand I'll post the entire code tommorow afternoon.
  • tian110796
    5th Jan 2011 Member 0 Permalink
    put this:
    if(rand()%n < 1)
    create_part(-1, x + rand()%5 - 3, y + rand()%5 -3, PT_GAS);

    replace n with any number greater than 1, the higher it is, the less GAS it forms.
  • Felix
    5th Jan 2011 Member 0 Permalink
    As an explanation of the code above, % is modulus in C. If I read the code above correctly, making n 99 would get you a one in a hundred chans of it happening.
  • Pyromaniac555
    5th Jan 2011 Member 0 Permalink
    Thanks everybody. I think I get it. If I post my mod I'll give all of you credit.