Hey yall! i need a script to create a new tile combo titled "pot", in which when I slash the pot, it does a quick 4 tile animation of the pot breaking into the undercombo. This combo would be wonderful if it could play my pot sound effect. should be simple, thanks for reading
Link's pot rampage
Started by
Weasels
, Apr 01 2009 11:11 PM
3 replies to this topic
#1
Posted 01 April 2009 - 11:11 PM
#2
Posted 02 April 2009 - 02:24 AM
Hrm....
I have a nice little 'custom breakables' set of code in my quest, but it involves links to the global script and lots of different functions and things.
There's quite a lot to it, but it's easy to use (or should be anyway).
I can try and set that up for you if you want?
You'd need the newest beta though.
I have a nice little 'custom breakables' set of code in my quest, but it involves links to the global script and lots of different functions and things.
There's quite a lot to it, but it's easy to use (or should be anyway).
I can try and set that up for you if you want?
You'd need the newest beta though.
#3
Posted 03 April 2009 - 01:00 AM
yes, please! I would really appreciate that, and I have the newest beta. do you want me to send you my script set?
Edited by Weasels, 03 April 2009 - 01:01 AM.
#4
Posted 03 April 2009 - 12:24 PM
Hmm well....
I think you can code ZScript, right?
I might have that wrong, and if I do I'll put a bit more effort in.
I'm a bit loathe to code it all up properly really though.
The code's pretty well written (the functions should be easy to use I hope), so if I just leave a dump of it here hopefully you can sort it out?
It should mostly just be calling the 'LWeaponCheck()' function to your global script, but you might need to do a bit more than that.
If you think there're any parts missing do let me know.
I think you can code ZScript, right?
I might have that wrong, and if I do I'll put a bit more effort in.
I'm a bit loathe to code it all up properly really though.
The code's pretty well written (the functions should be easy to use I hope), so if I just leave a dump of it here hopefully you can sort it out?
It should mostly just be calling the 'LWeaponCheck()' function to your global script, but you might need to do a bit more than that.
If you think there're any parts missing do let me know.
CODE
//Sound Effect Constants
const int SFX_SMASH = 83; //Smashing a signpost or pot
//Weapon Sprite Constants
const int WSP_LEAVES1 = 89;
const int WSP_LEAVES2 = 90;
const int WSP_POTSMASH = 91;
const int WSP_SIGNSMASH = 92;
//LWeapon Constants
const int LW_DECORATION = 40; //Decoration sprites
const int MISC_DECORATIONTYPE = 7; //Integer used to store decoration type
const int MISC0 = 0; //General use
//Decoration type Constants
const int D_LEAVES1 = 0; //Green colour gradient
const int D_LEAVES2 = 1; //Red colour gradient
const int D_SIGN = 2;
const int D_POT = 3;
//Combotype Constants
const int CT_BUSH2 = 129; //Red-leaved bushes (Slash->Next)
const int CT_POT = 130; //Custom pot combo (Slash->Next (Item))
//Turns ComboAt back into XY coordinates
int ComboX(int ComboAt){ return ComboAt%16*16; }
int ComboY(int ComboAt){ return ComboAt-ComboAt%16; }
//Create a decoration LWeapon
lweapon CreateDecoration(int type){
lweapon l = Screen->CreateLWeapon(LW_DECORATION);
l->Misc[MISC_DECORATIONTYPE] = type;
l->HitXOffset = 500;
return l;
}
//Make leaf, pot and signpost smash decorations
void CreateSlashDecoration(int loc, int Decor, int CSet){
for(int i;i<4;i++){
lweapon Decoration = CreateDecoration(Decor);
Decoration->X = ComboX(loc); Decoration->Y = ComboY(loc);
Decoration->Angular = true; Decoration->Angle = Rand(64)/10;
Decoration->Step = 100;
if(Decor == D_LEAVES1) Decoration->UseSprite(WSP_LEAVES1);
else if(Decor == D_LEAVES2) Decoration->UseSprite(WSP_LEAVES2);
else if(Decor == D_POT) Decoration->UseSprite(WSP_POTSMASH);
else if(Decor == D_SIGN) Decoration->UseSprite(WSP_SIGNSMASH);
if(CSet == -1) Decoration->CSet = Screen->ComboC[loc];
else Decoration->CSet = CSet;
}
if(Decor == D_SIGN || Decor == D_POT) Game->PlaySound(SFX_SMASH);
else if(Decor == D_LEAVES1 || Decor == D_LEAVES2)Game->PlaySound(SFX_GRASSCUT);
}
//Tall Grass random percentages
void TallGrassItems(int loc){
int Chance = Rand(110);
int itm = -1;
if(Chance < 1) itm = I_RUPEE5;
else if(Chance < 16) itm = I_HEART;
else if(Chance < 46) itm = I_RUPEE1;
else if(Chance < 56) itm = I_ARROWPICKUP5;
if(itm > -1) CreatePickupItem(loc,itm);
}
//Spawn a perishable item
void CreatePickupItem(int loc, int itm){
item Spawn = Screen->CreateItem(itm);
Spawn->Pickup |= IP_TIMEOUT;
Spawn->HitWidth = 16; Spawn->HitHeight = 16;
Spawn->X = ComboX(loc); Spawn->Y = ComboY(loc);
}
//Check through the LWeapons...
void LWeaponCheck(){
for(int i=1;i<=Screen->NumLWeapons();i++){
lweapon Check = Screen->LoadLWeapon(i);
//The sword, bombs and boomerang cut grass and bushes, and smash pots
if(Check->ID == LW_BRANG || Check->ID == LW_SWORD || Check->ID == LW_BOMBBLAST){
int loc; int Decor = -1;
for(int j;j<4;j++){
loc = ComboAt(Check->X+8+12*Sin(j*90),Check->Y+8+12*Cos(j*90));
if(//Screen->ComboT[loc] == CT_BUSHNEXT || Screen->ComboT[loc] == CT_BUSH2 ||
Screen->ComboT[loc] == CT_POT){
Decor = Screen->ComboT[loc];
break;
}
}
if(Decor != -1 && !(Decor == CT_POT && Check->ID == LW_BRANG)){
//if(Decor == CT_BUSHNEXT) CreateSlashDecoration(loc,D_LEAVES1,-1);
//else if(Decor == CT_BUSH2) CreateSlashDecoration(loc,D_LEAVES2,-1);
//else
if(Decor == CT_POT) CreateSlashDecoration(loc,D_POT,-1);
TallGrassItems(loc);
Screen->ComboD[loc]++;
}
}
if(Check->ID == LW_DECORATION){
int m = Check->Misc[MISC_DECORATIONTYPE];
//Remove Pot, Grass and Signpost decorations
if(m == D_POT || m == D_LEAVES1 || m == D_LEAVES2 || m == D_SIGN){
Check->Misc[MISC0]++;
if(Check->Misc[MISC0] == DecorationTimeLimit) Check->DeadState = WDS_DEAD;
}
}
}
}
const int SFX_SMASH = 83; //Smashing a signpost or pot
//Weapon Sprite Constants
const int WSP_LEAVES1 = 89;
const int WSP_LEAVES2 = 90;
const int WSP_POTSMASH = 91;
const int WSP_SIGNSMASH = 92;
//LWeapon Constants
const int LW_DECORATION = 40; //Decoration sprites
const int MISC_DECORATIONTYPE = 7; //Integer used to store decoration type
const int MISC0 = 0; //General use
//Decoration type Constants
const int D_LEAVES1 = 0; //Green colour gradient
const int D_LEAVES2 = 1; //Red colour gradient
const int D_SIGN = 2;
const int D_POT = 3;
//Combotype Constants
const int CT_BUSH2 = 129; //Red-leaved bushes (Slash->Next)
const int CT_POT = 130; //Custom pot combo (Slash->Next (Item))
//Turns ComboAt back into XY coordinates
int ComboX(int ComboAt){ return ComboAt%16*16; }
int ComboY(int ComboAt){ return ComboAt-ComboAt%16; }
//Create a decoration LWeapon
lweapon CreateDecoration(int type){
lweapon l = Screen->CreateLWeapon(LW_DECORATION);
l->Misc[MISC_DECORATIONTYPE] = type;
l->HitXOffset = 500;
return l;
}
//Make leaf, pot and signpost smash decorations
void CreateSlashDecoration(int loc, int Decor, int CSet){
for(int i;i<4;i++){
lweapon Decoration = CreateDecoration(Decor);
Decoration->X = ComboX(loc); Decoration->Y = ComboY(loc);
Decoration->Angular = true; Decoration->Angle = Rand(64)/10;
Decoration->Step = 100;
if(Decor == D_LEAVES1) Decoration->UseSprite(WSP_LEAVES1);
else if(Decor == D_LEAVES2) Decoration->UseSprite(WSP_LEAVES2);
else if(Decor == D_POT) Decoration->UseSprite(WSP_POTSMASH);
else if(Decor == D_SIGN) Decoration->UseSprite(WSP_SIGNSMASH);
if(CSet == -1) Decoration->CSet = Screen->ComboC[loc];
else Decoration->CSet = CSet;
}
if(Decor == D_SIGN || Decor == D_POT) Game->PlaySound(SFX_SMASH);
else if(Decor == D_LEAVES1 || Decor == D_LEAVES2)Game->PlaySound(SFX_GRASSCUT);
}
//Tall Grass random percentages
void TallGrassItems(int loc){
int Chance = Rand(110);
int itm = -1;
if(Chance < 1) itm = I_RUPEE5;
else if(Chance < 16) itm = I_HEART;
else if(Chance < 46) itm = I_RUPEE1;
else if(Chance < 56) itm = I_ARROWPICKUP5;
if(itm > -1) CreatePickupItem(loc,itm);
}
//Spawn a perishable item
void CreatePickupItem(int loc, int itm){
item Spawn = Screen->CreateItem(itm);
Spawn->Pickup |= IP_TIMEOUT;
Spawn->HitWidth = 16; Spawn->HitHeight = 16;
Spawn->X = ComboX(loc); Spawn->Y = ComboY(loc);
}
//Check through the LWeapons...
void LWeaponCheck(){
for(int i=1;i<=Screen->NumLWeapons();i++){
lweapon Check = Screen->LoadLWeapon(i);
//The sword, bombs and boomerang cut grass and bushes, and smash pots
if(Check->ID == LW_BRANG || Check->ID == LW_SWORD || Check->ID == LW_BOMBBLAST){
int loc; int Decor = -1;
for(int j;j<4;j++){
loc = ComboAt(Check->X+8+12*Sin(j*90),Check->Y+8+12*Cos(j*90));
if(//Screen->ComboT[loc] == CT_BUSHNEXT || Screen->ComboT[loc] == CT_BUSH2 ||
Screen->ComboT[loc] == CT_POT){
Decor = Screen->ComboT[loc];
break;
}
}
if(Decor != -1 && !(Decor == CT_POT && Check->ID == LW_BRANG)){
//if(Decor == CT_BUSHNEXT) CreateSlashDecoration(loc,D_LEAVES1,-1);
//else if(Decor == CT_BUSH2) CreateSlashDecoration(loc,D_LEAVES2,-1);
//else
if(Decor == CT_POT) CreateSlashDecoration(loc,D_POT,-1);
TallGrassItems(loc);
Screen->ComboD[loc]++;
}
}
if(Check->ID == LW_DECORATION){
int m = Check->Misc[MISC_DECORATIONTYPE];
//Remove Pot, Grass and Signpost decorations
if(m == D_POT || m == D_LEAVES1 || m == D_LEAVES2 || m == D_SIGN){
Check->Misc[MISC0]++;
if(Check->Misc[MISC0] == DecorationTimeLimit) Check->DeadState = WDS_DEAD;
}
}
}
}
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users