if (Link->X == Combo113-> && Link->Y == Combo 113->Y) { Game[CR_DRupees] -= 1; }work error free or how exactly do I change up above code to do what I need to do please?
How do I code if Link is on a combo113 one rupee gets drained constant
#1
Posted 19 June 2018 - 07:19 PM
#2
Posted 19 June 2018 - 07:32 PM
Don't really know how ZScript works, but, first of all, your Link->X is set to be checked against something from Combo113, but you haven't filled that in.
In short, try changing that to Combo113->X, and that should solve something, at least.
Also, is CR_DRupees a function? Again, don't quite know how this works.
#3
Posted 19 June 2018 - 07:56 PM
Game->DCounter[CR_RUPEES] -= 1;
#4
Posted 19 June 2018 - 08:16 PM
Please correct my coding if it is wrong thank you and will
if (Link->X == Combo113-> && Link->Y == Combo 113->Y) { Game[CR_DRupees] -= 1; }work error free or how exactly do I change up above code to do what I need to do please?
if (Link->X == ComboX(113) && Link->Y == ComboY(113)) { Game->DCounter[CR_RUPEES] -= 1; }
:
You probably want a global frame counter, and to reduce if frame%30 == 0. Further, I'd suggest distance <= 4 instead of precise coordinates.
int frame; //Global frame counter. global script a { void run() { int frame = -1; while(1) { if ( ++frame > 59 ) { frame = 0; } //increment the frame, and loop the frame if needed. Waitdraw(); Waitframe(); } } } ffc script drainRupeesOnCombo { void run() { while(1) { if ( frame&30 == 0 ) //two rupees per second { if ( Abs(Link->X-ComboX(113)) <= 4 ) { if ( Abs(Link->Y-ComboY(113)) <= 4 ) { Game->DCounter[CR_RUPEES] -= 1; } } } Waitframe(); } } } ffc script drainRupeesOnComboArgs //With D* args. { void run(int pos, int distance, int frame_val, int amount) { while(1) { if ( frame&frame_val == 0 ) { if ( Abs(Link->X-ComboX(pos)) <= distance ) { if ( Abs(Link->Y-ComboY(pos)) <= distance ) { Game->DCounter[CR_RUPEES] -= amount; } } } Waitframe(); } } }
#5
Posted 19 June 2018 - 09:53 PM
if (Abs(Link->X - ComboX(113)) < 6 && Abs(Link->Y - ComboY(113)) < 6) Game->Counter[CR_RUPEE]--;
#6
Posted 20 June 2018 - 06:00 PM
if (Abs(Link->X - ComboX(113)) < 6 && Abs(Link->Y - ComboY(113)) < 6) Game->Counter[CR_RUPEE]--;
Cumulative?
#7
Posted 20 June 2018 - 06:19 PM
Cumulative?
Where did he ask for that? He's using DCounter because that's what he thinks will drain the rupees IIRC. This one is "constant", like he asked.
#8
Posted 20 June 2018 - 06:34 PM
#9
Posted 20 June 2018 - 07:43 PM
But it's only one rupee; there's no difference between draining and just removing manually
#10
Posted 20 June 2018 - 08:57 PM
Hence why I said "if he changes the rupee amount". IF he decides, say, that he'd rather have it take 5 rupees away, using DCounter is preferable. I mean, yes, for only one rupee, it doesn't matter, but for consistency's sake, and for the sake of keeping it more moddable. Actually, I'm kinda wondering why not just do the whole thing as an FFC script. Then you can throw both the combo number to activate the effect and the rupee amount it pulls into the D args.
EDIT: Which is exactly what Zoria's script did. Sorry, I wasn't paying attention.
Edited by Binx, 20 June 2018 - 08:58 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users