Scripting question
Hey there. I'm making this add-on for the Dink fighting engine, where you can "miss".
There is a small chance you miss when you attack. Though, the only way I could think of is make your strength 0 for a microsecond, and then turn it back to old strength.
The problem is, Seth was a horrible programmer, and because of that, it actually takes time to count down to 0 for strength. Because of this, *some* times, you miss, and still do damage. I could prevent this by putting in a bigger wait, but that would be kinda stupid, to see your strength go to 0 for an x ammount of time (which would be too long if strength is high. when strength is higher it takes a longer time to count to 0).
My question; does anyone know a way this can be easier done?
There is a small chance you miss when you attack. Though, the only way I could think of is make your strength 0 for a microsecond, and then turn it back to old strength.
The problem is, Seth was a horrible programmer, and because of that, it actually takes time to count down to 0 for strength. Because of this, *some* times, you miss, and still do damage. I could prevent this by putting in a bigger wait, but that would be kinda stupid, to see your strength go to 0 for an x ammount of time (which would be too long if strength is high. when strength is higher it takes a longer time to count to 0).
My question; does anyone know a way this can be easier done?
In the weapon script, add to the use(void)
int &chance = random(9,1)
if (&chance > 6) { //miss sp_nodraw(1,1) //create a clone of dink, that cannot do damage &clone = create_sprite( blabla ) sp_strength(&clone, 0) //play the sequence } else { //do original stuff }
Ik hoop dat dat je op koers helpt
Ben de commandos een beetje vergeten door DarkBASIC
int &chance = random(9,1)
if (&chance > 6) { //miss sp_nodraw(1,1) //create a clone of dink, that cannot do damage &clone = create_sprite( blabla ) sp_strength(&clone, 0) //play the sequence } else { //do original stuff }
Ik hoop dat dat je op koers helpt
Ben de commandos een beetje vergeten door DarkBASIC
There are two basic ways to do this, not including theprophet's silly way:
1) Set the strength to 0 immediately, and restore it immediately. Just do something like this:
&strength = 0;
draw_status();
//Fightin' Stuff!
&strength = &oldstr;
draw_status();
2) Remove the special frame from Dink's attack animation, so Dink can't actually hit anything. Like so:
init("set_frame_special 102 3 0");
init("set_frame_special 104 3 0");
init("set_frame_special 106 3 0");
init("set_frame_special 108 3 0");
//Fightin' Stuff
init("set_frame_special 102 3 1");
init("set_frame_special 104 3 1");
init("set_frame_special 106 3 1");
init("set_frame_special 108 3 1");
Of course, you'd need a few if (&randomvar == &somevalue) things around the code above, but that should be relatively simple to figure out.
1) Set the strength to 0 immediately, and restore it immediately. Just do something like this:
&strength = 0;
draw_status();
//Fightin' Stuff!
&strength = &oldstr;
draw_status();
2) Remove the special frame from Dink's attack animation, so Dink can't actually hit anything. Like so:
init("set_frame_special 102 3 0");
init("set_frame_special 104 3 0");
init("set_frame_special 106 3 0");
init("set_frame_special 108 3 0");
//Fightin' Stuff
init("set_frame_special 102 3 1");
init("set_frame_special 104 3 1");
init("set_frame_special 106 3 1");
init("set_frame_special 108 3 1");
Of course, you'd need a few if (&randomvar == &somevalue) things around the code above, but that should be relatively simple to figure out.
The first method Redink1 suggests isn't nearly as good as the second, because due to the safety measures Seth built in, you will still be able to do 1 damage to the monster even with 0 strength.
The second method is extremely cool though and will definitely yield the results you want.
The second method is extremely cool though and will definitely yield the results you want.
How about?:
sp_range(1, -100);
That seems to have the same effect as redink1's option 2. Also, I'd suggest that there's no reason to set it back afterwards, as long as you set it back when he disarms the weapon, and randomly each time he attacks.
sp_range(1, -100);
That seems to have the same effect as redink1's option 2. Also, I'd suggest that there's no reason to set it back afterwards, as long as you set it back when he disarms the weapon, and randomly each time he attacks.
hmm, does it improve anything? Redink1's way is prefect and bugless, so I won't change it I think. I guess yours is too though.
Paul's would probably work better. I seem to recall some various, unpredictable bugs when specifying special frames with init lines in-game.
Oh, okay. So I just have to enter
//random chance
sp_range(1, -100);
//100% - random chance
sp_range(1, x);
where x is the range of the weapon you are carrying?
//random chance
sp_range(1, -100);
//100% - random chance
sp_range(1, x);
where x is the range of the weapon you are carrying?
Zero is impossible. I'm not sure what the exact number is though.
sp_range() for Dink... this is only mentioned in the item-swX (swords 1 to 3) scripts.
Arm procedure in each script sets both range and distance for each sword, disarm resets both to 0
Arm procedure in each script sets both range and distance for each sword, disarm resets both to 0
I figured it out, and it ís 0 Kyle. It works with 0, and it makes sense, 'cause your "hit-range" is just as big as your hardbox. With swords and all, this is extended. (I think)
Anyway, 0 works for me.
Anyway, 0 works for me.
Nah, Dink has a built-in check so if your range is 0, it is actually set to 23 or something like that.
Ah. Well anyway, when set to 0 it works, so I don't care