PDA

View Full Version : Bombchus



Joe123
08-16-2008, 07:18 PM
I've recently been writing a bomchu script, on request by Blaman.
It's now finished, and I have a nice little tutorial that should help explain to anyone who wants to use it how to set it up.
I've also got a little example quest here: bombchu.qst (http://www.mediafire.com/download.php?so2mvpspvgk)

How to use the Bombchu script
By Joe123

Contents
The Tiles
Setting up the Superbombs
The Script
The Items
The Subscreen
Notes
A. The Tiles
Firstly, find yourself some nice Bombchu tiles.
They should be able to face in four directions.
The Classic tileset has some as default, and EZGBZ may have some (cause they're in the gameboy zeldas), but I haven't checked.
Rip them on to your tilepage, and arrange them in this order:
Up, Down, Left, Right.
If you want them to animate, place the animations after the first one (ie; Up1, Up2, Down1, Down2 etc.).
Write down the number of the first tile (so the up facing one).
B. Setting up the Superbombs
Now, you won't be using superbombs in your quest if you want bombchus, so we first have to sabotage our superbomb item.
Go to Quest->Items->Superbombs.
Change the fuse duration of your superbomb to '3'
C. The Script
Now go to the lines in the script that are noted (have '//' before them), and change the inputs to suit your needs (putting in the number you wrote down earlier for the bombchutile input).
Make sure to set up the number of animation frames properly here, otherwise it just won't work.
Compile the script, and put the script called 'slot_2' into global script slot 2, and write down the number of the slot you assign the item script to.
D. The Items
This is the complicated part.
Make a new custom item with a custom itemclass, give it the bombchu item pickup graphics, and set it's action script to the bombchu script (and call it 'bombchu' or something).
Make sure to tick the 'Equipment Item' box, and then go to your subscreen editor.
Make another custom item called 'Bombchu Ammo' (or simmilar).
Open up the 'Bomb Ammunition' item, and copy everything about this item over into your new 'Bombchu Ammo' item.
On the pick-up tab, change the 'counter reference' box to '6'.
Change its graphics to be that of a bombchu, rather than a bomb.
E. The Subscreen
On the subscreen, add a space for this new itemclass (probably over the top of your superbombs, as you won't be needing them anymore).
Change the graphics of your super-bomb counter to be that of a bombchu.
F. Notes
It is not possible to have superbombs, bombs and bombchus; only two of the three(well, currently you can't have bombchus and superbombs, but no bombs, however I could edit the script quite easily to do that).
When giving the player the bombchus in the first place, give him the first item you made (the one with the entry on the subscreen).
Then, when you want him to pick up more bombchus, place a 'bombchu ammunition' item on the screen, which will then increase Link's number of bombchus by however much you like.



import "std.zh"

const int bombchuflag = 98; //Flag the bombchu can pass through (even if solid)

bool bombchuattack;
bool isSolid(int x,int y){
if(x<0 || x>255 || y<0 || y>175) return false;
int mask=1111b;
if(x%16<8) mask&=0011b;
else mask&=1100b;
if(y%16<8) mask&=0101b;
else mask&=1010b;
return (!(Screen->ComboS[ComboAt(x,y)]&mask)==0);
}

bool bombchucheck(int x, int y){
if((isSolid(x,y) && Screen->ComboF[ComboAt(x,y)] != bombchuflag && Screen->ComboI[ComboAt(x,y)] != bombchuflag)
|| (Screen->ComboF[ComboAt(x,y)] == 6 || Screen->ComboI[ComboAt(x,y)] == 6 ||Screen->ComboF[ComboAt(x,y)] == 11 || Screen->ComboI[ComboAt(x,y)] == 11)) return true;
}

void noaction(){
Link->InputR = false;
Link->InputL = false;
Link->InputA = false;
Link->InputB = false;
Link->InputUp = false;
Link->InputDown = false;
Link->InputRight = false;
Link->InputLeft = false;
}
global script slot_2{
void run(){
int bombchutile = 20; //Set the tile for your weapon here. Up, Down, Left, Right it should be on the tilepage.
int bombchuframes = 2; //Set the number of animation frames here.
int bombchuaspeed = 10;//Set the animation speed here
int bombchucset = 8; //Set the CSet here

int bombchudmg = 2; //Set the damage here
int bombchuspeed = 1; //Set the speed of the bombchu here

int HP;
int bdir;
int bombchux; int bombchuy;
lweapon explosion;

while(true){
if(bombchuattack){
if(Link->X > 15 && Link->X < 241 && Link->Y > 15 && Link->Y < 153){
lweapon bombchu = Screen->CreateLWeapon(31);
bdir = Link->Dir;
bombchu->OriginalTile = bombchutile+(bdir*bombchuframes);
bombchu->Tile = bombchutile+(bdir*bombchuframes);
bombchu->NumFrames = bombchuframes;
bombchu->ASpeed = bombchuaspeed;
bombchu->CSet = bombchucset;
bombchux = 0; bombchuy = 0;
if(bdir>1) bombchux = (((bdir-2)*2)-1)*16;
if(bdir<2) bombchuy = ((bdir*2)-1)*16;
bombchu->X = Link->X+bombchux;
bombchu->Y = Link->Y+bombchuy;
bombchu->Step = bombchuspeed;
Link->Action = LA_ATTACKING;
Game->Counter[6]--;
Waitframe();

while(bombchu->isValid()){
HP = Link->HP;
if(Link->InputUp) bdir = 0;
if(Link->InputDown) bdir = 1;
if(Link->InputLeft) bdir = 2;
if(Link->InputRight) bdir = 3;
if(bdir == 0 && bombchucheck(bombchu->X+8,bombchu->Y+4)
|| (bdir == 1 && bombchucheck(bombchu->X+8,bombchu->Y+12))
|| (bdir == 2 && bombchucheck(bombchu->X+4,bombchu->Y+8))
|| (bdir == 3 && bombchucheck(bombchu->X+12,bombchu->Y+8))) bombchu->DeadState = 0;
bombchu->Dir = bdir;
bombchu->Tile = bombchutile+(bdir*bombchuframes);
bombchu->OriginalTile = bombchutile+(bdir*bombchuframes);
bombchux = bombchu->X;
bombchuy = bombchu->Y;
noaction();
Waitframe();
if(Link->HP < HP) bombchu->DeadState = 0;
}

explosion = Screen->CreateLWeapon(LW_SBOMB);
explosion->Damage = bombchudmg;
explosion->X = bombchux;
explosion->Y = bombchuy;
}else{
bdir = Link->Dir;
bombchux = 0; bombchuy = 0;
if(bdir>1) bombchux = (((bdir-2)*2)-1)*16;
if(bdir<2) bombchuy = ((bdir*2)-1)*16;
explosion = Screen->CreateLWeapon(LW_SBOMB);
explosion->X = Link->X+bombchux;
explosion->Y = Link->Y+bombchuy;
explosion->Damage = bombchudmg;
}
Link->Action = 0;
bombchuattack = false;
}
Waitframe();
}
}
}

global script slot_3{
void run(){
bombchuattack = false;
}
}

item script bombchu{
void run(){
if(Game->Counter[6] > 0) bombchuattack = true;
}
}

And there we have it.
If anyone would like to have any parts of the tutorial better explained, let me know and I'll be happy to do it.

EDIT: Changed the script a little.

Pielord
08-16-2008, 09:42 PM
chus? Cool!:D I'm been waiting for something like this. I don't have enough time to try it out right now but I will be sure to do it when I get some free time. You sure do wright some great scripts. Can't wait to see your next one.:)

EDIT: OK, this is cool. I will more than likely use them in my quest. The only problem I see is the fact that you're invincible but other than that it's prefect.

Joe123
08-19-2008, 03:46 PM
OK, I've fixed the script so that now when Link is damaged whilst controlling a Bombchu, the Bombchu explodes instead of Link just being invincible.

The script in the first post has been edited with that change.

And now we have A Video! (http://www.youtube.com/watch?v=7NiNeR0hTVk) of the script, courtesy of Billy Ronald from PZC.

En Passant
10-28-2014, 03:01 AM
Unless I'm being stupid here, in 2.5 there are no global script slots. There's Active, onExit, onContinue, and I think init, and the rest is unusable white space. Where should I put the global scripts?

Saffith
10-28-2014, 01:01 PM
It's just old terminology. Slot 2 is the active script now.

En Passant
05-10-2015, 05:40 PM
Good news! It's possible (and actually really simple) to have Super Bombs and Bombchu at the same time! All you have to do is replace any instances of LW_SBOMB with LW_BOMBBLAST. The Bombchu will explode on impact, like it does in canon games, and editing the Super Bomb becomes completely unnecessary. You still have to share the Bombchu count with either Bombs or Super Bombs, though.