PDA

View Full Version : Boss scripts



Gleeok
10-02-2007, 01:27 AM
Well this should complete the Gleeok needs help thread trilogy.


Anyway I've got this bit in a custom boss script i'm working on:



if(this_ffc->X > 128) { this_ffc->Vx = -1; }
if(this_ffc->X < 128) { this_ffc->Vx = 1; }
if(this_ffc->Y > 32) { this_ffc->Vy = -1; }
if(this_ffc->Y < 32) { this_ffc->Vy = 1; }


if( (this_ffc->X==128 && this_ffc->Y==32) || (battlecounter>100) ){

npc breath = Screen->CreateNPC(enemy_id);
breath->X = this_ffc->X;
breath->Y = this_ffc->Y;
}

I ended up adding the or statement because..well the ffc could never actually arrive at 128,32. I can fix it, but i'm looking for a much simpler way of arriving at 128,32 without chopping up the script.

Is there a simpler way to do this?

C-Dawg
10-02-2007, 12:04 PM
It took me about five minutes to figure out what you are asking. You want to know how to get the FFC to move precisely to 128, 32? And you probably want to do it using Vx and Vy instead of X and Y so that the linked FFCs follow it properly?

Okay, well, that's not too hard. Just decrease the speed the closer it gets. For instance:

this_ffc->Vx = 128-this_ffc->X;
if(this_ffc->Vx>2) { this_ffc->Vx=2;}
if(this_ffc->Vx<-2) { this_ffc->Vx=-2;}

And same thing for Y. This should make the FFC move incrementally slower until it fits snugly into 128, 32.

On the other hand, why is this precise location so important? Why not just make it move to within 8 pixels of 128, 32?

if ( (Abs(this_ffc->X-128) <= 8 ) && (Abs(this_ffc->Y-32) <= 8) ){

stuff

}

Gleeok
10-09-2007, 08:14 AM
More scripting head scratching.....

Some setup variables:


npc shieldy = Screen->LoadNPC(1);
shieldy->HP = enemyHP;



This line(the first if statement in the loop) doesn't want to work right...I have no idea why??


if(shieldy->HP > 90% enemyHP){


and this one never seems to happen:



if(shieldy->HP > 50% enemyHP && shieldy->HP <= 70% enemyHP){


The in between if's kinda work, which is leading me to believe I am incorrectly using

Enemy-> HP > % of maxHP.



I took out all the if's and replaced them with
if(delay_tick > 300 && delay_tick <=600 etc..., and delay_tick++;
and everything worked fine...

Is there a correct way to check % of an enemies HP?

ShadowMancer
10-09-2007, 11:36 AM
if (shieldy->HP > (enemyHP*0.5) && shieldy->HP <= (enemyHP*0.7) {

That should work

Gleeok
10-11-2007, 05:52 AM
if (shieldy->HP > (enemyHP*0.5) && shieldy->HP <= (enemyHP*0.7) {

That should work

Thank you. That explains much more than my question. :)




Also whew, this ones bugging me...It seems to be a problem for all scripters too.

*I've run out of FFC's!* ----------shit popsicles...


The problem:

The ffc's that make up the boss number 44. The ffc's used for attack's number 14.....problem.


-I've been trying to think of possible solutions for this, but they don't seem plausible.

-Use Screen->Draw functions: Besides the fact that I've never used these, they wouldn't be damage combos. They could work however if they could be linked just like animated ffc's, and only use them for the upper 2/3 of the body. Is it possible to link draw functions to ffc's, or alway's keep them at X and Y of this->X or Y? How could I do this?

- Some way to move combos on the current screen just like linked ffc's...I don't think this is possible...but I might be wrong.

btw; check it out: :D The kids are gonna love it!
http://i233.photobucket.com/albums/ee49/Gleeok9/zelda023.png

I know now this is a problem having only 32 ffc's max. Any idea's?


.

C-Dawg
10-11-2007, 01:12 PM
I feel your pain. In the case of Zodiac, I'm serious about not ripping ANY tiles, which means it isn't feasible for me to make custom bosses too much larger than, say, 4x4 tiles anyway. So I'm staying just under the limits. You're ripping pre-made bosses that are much larger, and so you're going to have huge issues with this.

One solution: FFCs are designed to be able to be larger than 16x16. I've found this behavior to be buggy, but if someone can explain it, this might work for you.

With regard to projectiles, you can do some clever re-using of FFCs to minimize the number you need. Move them faster and recycle more often, for instance. Or if several stages of the boss shoot things, re-use the same FFCs in different forms.

ShadowMancer
10-11-2007, 09:51 PM
Use Screen->Draw functions: Besides the fact that I've never used these, they wouldn't be damage combos if they could be linked just like animated ffc's, and only use them for the upper 2/3 of the body. Is it possible to link draw functions to ffc's, or alway's keep them at X and Y of this->X or Y? How could I do this?
Well, you don't need a damage combo to hurt Link, but since you can't manually flash his CSet damage combos might be best.
As for Drawing, it could work but be warned my early test with drawing tiles seemed to slow down the game abit, might not make much of a diference on a faster computer but not everyone has a 50 Terabyte CPU :D
You have been warned...
So here is some code:


//For your reference:
////DrawTile(int layer, int x, int y, int tile, int blockw, int blockh, int cset, float scale, int rx, int ry, int rangle, int flip, bool transparency, int opacity)
//say just use 2 linked 4X4 FFC's for the front***
//then you can draw the back 1/2 of your boss, 8X4 tiles
//Then run this code inside the while loop in the FFC script for your boss
DrawTile(layer, this->x, this->y-64, tile, 8, 4, cset, 1, 0, 0, 0, 0, true, 128)

***(C-Dawg says this is buggy, I am going to be doing some extensive testing with large FFC's so I'll post any findings. They will be required for my battle system to work)

That should work for you, obviously I have no idea what layer, tile number, and cset you are useing so just fill em in yerself.


Some way to move combos on the current screen just like linked ffc's...I don't think this is possible...but I might be wrong.
As far as I know normal combos must be snapped to the 16,16 grid so not a good solution.

I did ask DD about getting more FFCs in a future build (I suggested 256) but it does not look good.
At the very least mabye the devs can optimise the drawing functions, posibly by only haveing them be erased and redrawn when they actually change instead of bieng erased with each frame, mabye post 2.5 :shrug:

Gleeok
10-12-2007, 02:11 AM
One solution: FFCs are designed to be able to be larger than 16x16. I've found this behavior to be buggy, but if someone can explain it, this might work for you.

With regard to projectiles, you can do some clever re-using of FFCs to minimize the number you need. Move them faster and recycle more often, for instance. Or if several stages of the boss shoot things, re-use the same FFCs in different forms.


Yeah, but the ffc's start bugging up when that happens.....hmmm.......To the bug forums!!!


Yeah, I've already started doing that. It's at the point where every new script idea has ffc->Data = (n) declared var. and (n) is incremented differently for every if statement, or n++ in a loop. Normally you can continually cycle the same ffc's over and over again with any data you want, and no one's the wiser. I think the best bet for scripting ffc's would be to get any bug involving larger than 16x16 ffc's fixed. That would cut the required ffc's for the mega-bosses down from 60(in this case) to like 20-25.




Thanks Shadowmancer, I'm thinking draw functions are a last resort, but finally someone explained it to me! :)

ShadowMancer
10-12-2007, 11:40 AM
Has any one directly experinced the buggyness of large FFCs? What exactly is wrong or odd about their behavior. Or is it like they are randomly not were you want them or wrong size or combo? I am yet to do any testing but to have a 'heads up' of what to look for would be helpfull.

C-Dawg
10-12-2007, 01:00 PM
Large FFCs just never perform as expected for me. I understand they display some many tiles on the tile page. Once you start doing animation, they fuck up royally. I'm also not sure how they behave when you write to FFC->Data.

Could be buggy, or I might not know how to use it. If it worked, you could, in theory, use only ONE FFC for the boss's body. (Need more for targeting purpose or any part of the boss that moves independently).

Gleeok
10-12-2007, 09:12 PM
Large FFCs just never perform as expected for me. I understand they display some many tiles on the tile page. Once you start doing animation, they fuck up royally. I'm also not sure how they behave when you write to FFC->Data.

Could be buggy, or I might not know how to use it. If it worked, you could, in theory, use only ONE FFC for the boss's body. (Need more for targeting purpose or any part of the boss that moves independently).


Hey C-, you need to see this thread and download the second quest from SM. Trust me.
http://www.armageddongames.net/forums/showthread.php?threadid=99757


.

Gleeok
10-16-2007, 12:57 AM
Got a new one for the kids. My scriptings getting better so I thought I'd try and tackle something more difficult.

http://i233.photobucket.com/albums/ee49/Gleeok9/zelda001-1.png


I'm assuming everyone knows where that's from. It goes through 7 stages of animation/cycling when opening/closing. The tricky part:

-The shell is supposed to be impervious to all attacks, meaning the npc inside can't take damage from the top or bottom, or when the shell is closed.

-When the shell opens, it unleashes a hellstorm of projectiles(ffc's 1-20). This part's no problem for me, i've gotten way better at scripting stuff that kills Link than anything else.:laughing:

[*In case anyone wonders why projectiles now start from ffc slot 1, it's because the lower the ffc, the higher the layer they are drawn. Important to know that.*]


So I'm try ing to brainstorm abit before writing the script, as I think it's a good one for showcase, one that others can actually use.

Any suggestions, thoughts, help?


btw; here's the vid from metroid:http://www.youtube.com/watch?v=4QznS2-ZVAs, but it will behave quite different, plus no gravity.