The reason I want this script is because arrows are now "water", and I want to be able to refill in water combos, or rather flag no 98, in case I don't want it filled up in specific water tiles.
refill arrows to 99 when touching script flag 98
Started by
Lemmy Koopa
, Nov 11 2009 06:20 AM
18 replies to this topic
#16
Posted 12 November 2009 - 03:10 AM
#17
Posted 12 November 2009 - 05:49 AM
Come on guys, all you have to do is check for Screen->ComboI aswell as Screen->ComboF...
#18
Posted 12 November 2009 - 01:48 PM
Taking into account inherent flags and whether or not the combo type is water. And I actually tested it this time...
import "std.zh"
global script slot2
{
void run()
{
while(true)
{
Waitframe();
SetCounter(98,CT_WATER,CR_ARROWS,99,SFX_SCALE);
}
}
}
// If player is touching combo of "combotype" with specified flag, the ammo is refilled to the given amount
void SetCounter(int flag, int combotype, int ammotype, int ammoamount, int sfx)
{
//If counter is already set, return to global function
if(Game->Counter[ammotype] == ammoamount) return;
//Get the four combos that Link is touching
int combo[4];
combo[0] = ComboAt(Link->X,Link->Y);
combo[1] = ComboAt(Link->X+16,Link->Y);
combo[2] = ComboAt(Link->X,Link->Y+16);
combo[3] = ComboAt(Link->X+16,Link->Y+16);
//If any of those 4 combos have the specified flag, update the counter and play the sound
for(int i=0;i<4;i++)
{
if((Screen->ComboF[combo[i]] == flag || Screen->ComboI[combo[i]] == flag) && Screen->ComboT[combo[i]] == combotype)
{
Game->Counter[ammotype] = ammoamount;
Game->PlaySound(sfx);
return;
}
}
}
CODE
import "std.zh"
global script slot2
{
void run()
{
while(true)
{
Waitframe();
SetCounter(98,CT_WATER,CR_ARROWS,99,SFX_SCALE);
}
}
}
// If player is touching combo of "combotype" with specified flag, the ammo is refilled to the given amount
void SetCounter(int flag, int combotype, int ammotype, int ammoamount, int sfx)
{
//If counter is already set, return to global function
if(Game->Counter[ammotype] == ammoamount) return;
//Get the four combos that Link is touching
int combo[4];
combo[0] = ComboAt(Link->X,Link->Y);
combo[1] = ComboAt(Link->X+16,Link->Y);
combo[2] = ComboAt(Link->X,Link->Y+16);
combo[3] = ComboAt(Link->X+16,Link->Y+16);
//If any of those 4 combos have the specified flag, update the counter and play the sound
for(int i=0;i<4;i++)
{
if((Screen->ComboF[combo[i]] == flag || Screen->ComboI[combo[i]] == flag) && Screen->ComboT[combo[i]] == combotype)
{
Game->Counter[ammotype] = ammoamount;
Game->PlaySound(sfx);
return;
}
}
}
#19
Posted 13 November 2009 - 01:45 PM
Thanks for the help guys.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users