AlkTree Script
Alright, I can understand most of this, but I can't seem to get it to work right for my apple tree. The problem is, the apples don't fall where I want them to, and sometimes they don't even move, they just appear. I need to know what I'm supposed to change, and how to change it. I changed &randx and &randy, but that's what messes it up. This is the original script with a couple of changes, and I need to change where they fall. Could someone help me?
void main( void ) { int &crap; int &randx; int &randy; int &fally; }
void talk( void ) { say_stop("Hey, that's an Apple tree.", 1); wait(250); }
void hit( void ) { &crap = scripts_used(); if (&crap > 170) { //don't make any more apples, there are 165 already on the screen..) return; } //lets make the apple fall down and give it an apple script &randx = random(200,320); &randy = random(80,0); &crap = create_sprite(&randx, &randy, 0, 421, 23); sp_speed(&crap, 1); move_stop(&crap, 8, 86, 1) &fally = random(80,110); sp_script(&crap, "s1-apple"); move_stop(&crap, 2, &fally, 1) }
Maybe you're not setting the random() values to what you really want them to be? That could explain why they aren't moving.. The script itself is fine, but what is that first move_stop() for?
void hit( void )
{
&crap = scripts_used();
if (&crap > 170)
return;
//lets make the apple fall down and give it an apple script
&randx = random(200,320); //320-519
&randy = random(80,0); //0-79
&crap = create_sprite(&randx, &randy, 0, 421, 23);
sp_speed(&crap, 1);
//move_stop(&crap, 8, 86, 1)
&fally = random(80,110); //110-189
sp_script(&crap, "s1-apple");
move_stop(&crap, 2, &fally, 1)
}
void hit( void )
{
&crap = scripts_used();
if (&crap > 170)
return;
//lets make the apple fall down and give it an apple script
&randx = random(200,320); //320-519
&randy = random(80,0); //0-79
&crap = create_sprite(&randx, &randy, 0, 421, 23);
sp_speed(&crap, 1);
//move_stop(&crap, 8, 86, 1)
&fally = random(80,110); //110-189
sp_script(&crap, "s1-apple");
move_stop(&crap, 2, &fally, 1)
}
Do you know how random() works? It's utterly counter-intuitive. The first number is how many diffrent chances there are, the second number is the minimum value.
random(200,320);creates the sprite somewhere between 320 and 500. If you wanted to create the apple between 200 and 320, you need to write
random(120,200);
Well, they're appearing where I want them to now (for the most part), and a few fall, but most just spawn.