PDA

View Full Version : problems with ffc->Data=0



Master Maniac
04-08-2008, 06:53 PM
i have an issue. it might be a cycling thing but im not sure...

i made a script that creates 2 ffc's. one is for looks and the other takes the damage for the enemy. when the ghosted enemy is dead, both the ffc's data is set to 0.

before it dies though, one of the ffcs cycles a lot. so im thinking that may be the cause of this.

anyway what the problem is, the ffc thats just there for looks (has no animation and no cycling) defaults its data to 0 at the right time.

the other ffc (cycles a little bit with no animation) doesent default its data to 0... rather it cycles to a certain combo.

here ill explain how i made it cycle.

its an eye. the eye is closed. the script tells it to cycle and so it cycles to a combo animating the eye opening. then that cycles to an open eye combo.

when it is supposed to go to 0, it goes to the animating/cycling combo instead, and then stops everything.

ill post the script so far too, so you guys can see. maybe i worded something in the script wrong or something.

ill also post 2 screenshots... (or links to them) as before and after shots of killing it.


//ennefenom's ghoma script

//ok so im going ot explain how to set up the script part only.
//im also going to leave notes so hopefully you can do something like this yourself at some point.
//also im going to assume you know nothing about scripting so ill explain every little detail

//first your setup. you will need:

//1 set of combos for the body, and 2 to 3 sets for the eye. the eye will have 2 different colors, which will be cycled back and forth.
//2 ffc's. one that is only the eye, and one that is everything but the eye
//1 custom enemy. you can make its attributes. (shooter, etc.)
//1 sound effect for a "dying ghoma"

//now for your arguments


//D:0=the ID of the enemy that will be used as ghoma's HP. do not set combos for this enemy, as it is supposed to be invisible.
//D:1=the ID of the enemy you want to spawn when it is "invincible"
//D:2=the ID of the combo you want the eye to be when it is vulnerable.
//D:3=the ID of the combo you want to use when ghoma is invulnerable
//D:4=how much health you want ghoma to start with
//D:5=the # of the sound you want to use for "ghoma dying"

import "std.zh" //this imports variables from a file in the build folder, which makes this script possible

ffc script ghoma{//this names your script "ghoma"and sets the type to FFC. also opens a new level of scope with "{"

void run(int m, int n, int c1, int c2,int h, int s){//starts the script to running. also notice i places a tab stroke for organization. layer 1 of scope = 1 tab press.

ffc ghoma_body;

ffc ghoma_eye;

npc ghost;

npc dummy1;

npc dummy2;

int beasts;

ghoma_body = Screen->LoadFFC(1);//notice i didnt use "{" here. there are no functions within what ive told it to do, so no need for them

ghoma_eye = Screen->LoadFFC(2);//with this line and the previous one, ive commanded the screen to draw 2 FFC's and name them ghoma eye and ghoma body

ghost = Screen->CreateNPC(m);//creates an NPC (or an enemy) whose ID is equal to the value of "m"

ghost->X=ghoma_eye->X;ghost->Y=ghoma_eye->Y;//not sure if i worded this right yet... sets the coordinates of the enemy anf the eye to the same every frame

while (true){

if(Screen->NumNPCs()==1){

dummy1= Screen->CreateNPC(n);
dummy2= Screen->CreateNPC(n);//these draw enemies with an ID equal to the value of n

beasts=1;
}

if(dummy1->HP<1&&dummy2->HP<1){

beasts=2;

}

ghost->HP=9999;//gives an "invincible"effect

if(beasts==2){// this is an if function. it says if (whatevers in parentheses is true) then preform the next level of scope.

ghoma_eye->Data = c1;//cycles the combo for the eye to another combo, ID equal to c1
ghost->HP=h;//turns off the enemy's invincibility

Waitframes(900);//waits 15 seconds(i think)
h=ghost->HP;

ghost->HP=9999;//turns invincibility back on

ghoma_eye->Data = c2;

}//this closes a level of scope, here being the if function
if(ghost->HP<1){//another if function

ghoma_body->Data=0;//"kills" the FFCs
ghoma_eye->Data=0;

Game->PlaySound(s);//plays a sound equal to the interger "s"
}
Waitframe();
}

}

}

yep still working on the same one. its useless right now. the boss is so easy to kill its not even funny.

however i will post any further questions involving this script in this thread for now.

Master Maniac
04-08-2008, 07:01 PM
here are the screenshots.

before (http://http://i268.photobucket.com/albums/jj33/master00maniac/zelda006.gif)

after (http://http://i268.photobucket.com/albums/jj33/master00maniac/zelda007.gif)

sorry i double posted. i couldnt figure out how to set links with editing =)

Joe123
04-08-2008, 07:07 PM
I haven't actually read this (sorry) all the way through, but whenever an ffc's combo is changed to 0, any scripts it has on it end instantly.

Master Maniac
04-08-2008, 07:24 PM
thats certainly strange... what if the ffc's combo is set to cycle? like the combo that makes the ffc? if its set to cycle then that could cause it...

im sorry most of my questions have such simple solutions lol but its just my luck that the simple solutions only pop into my head after i post the topic

EDIT:nope thats not it. the combo i have set as the eye closed doesent cycle...

Joe123
04-08-2008, 07:40 PM
combos never cycle to combo 0.

Master Maniac
04-08-2008, 07:50 PM
i know that. i just said ffc->Data=0

and it works for one but not the other.

also i havent figured out if the health tracking works yet...

EDIT: oh i get what youre saying. no i meant i thought i set the closed eye to cycle to the opening eye animation on the combo editor. but i didnt.

bobrocks95
04-08-2008, 08:40 PM
Isn't that just a Ghoma?

Master Maniac
04-08-2008, 08:41 PM
nope. its not going to move at all... and its not done yet. i still have to make it a boss. i just used already made tiles for it.

bobrocks95
04-08-2008, 08:54 PM
A non-moving boss based off a ghoma that you have to kill ghosts and fire arrows at to hurt? Or am I way off?

Master Maniac
04-08-2008, 09:17 PM
heh lol no

if its eye is open you can hit it with anything.

if its eye is closed nothing has any effect at all.

and it also

-spawns enemies
-is firing from most parts of its body
-and could move if you really wanted it to

and any other add-ons that might be requested would help too. that would do me quite a bit of good in making it a great boss.

it is a first level boss though. so i dont want it too hard yet. and all the arguments up to D:5 are in use so nothing too complicated.

EDIT: and the "ghost" i was talking about is the enemy attached to the graphics for the eye. its basically a HP counter.

also you have to kill the enemies it spawns before you can hurt it.

Master Maniac
04-09-2008, 08:15 PM
is there any way i can directly access an enemy's attributes to make it firing using scripting? or do i have to place a combo under it thats a statue and make the statues shoot fire?

and to make this double post ok, i think i have new information regarding the script. im going to try something.

ill make it cycle back to an un-cycling combo and then make its data=0.

wonder if it will work...?

gimme a few minutes and ill post the new script with the corrections, if it works.

i just dont understand whats going wrong...

EDIT: nope. didnt work. i dont understand...waiit....i got this =)

EDIT2: no i dont...

can someone explain (if possible) whats going wrong?

Gleeok
04-09-2008, 11:57 PM
I'm not following what the error is. Does the script stop working, or does the ffc cycle to the wrong combo?

Master Maniac
04-10-2008, 06:43 PM
one of the ffc's cycles to the wrong combo.

here:

the script tells ghoma_eye to cycle to a combo when vulnerable (c2). at the end it tells ghoma_eye to set its Data to 0.

however instead of setting its Data to 0, it sets it to the value of c2.

is something out of order?

the script still works, and everything dies except the graphic for one FFC changes to the wrong combo. im thinking its a problem with my scope...

ScaryBinary
04-11-2008, 05:52 PM
I think I know what the issue is, but I'm not sure I can clearly explain it. In a nutshell, when your main boss dies, you also need to set "beasts" to 0 or 1 (or anything not equal to 2).

First, remember this is all happening inside a while(true) loop, so even if your boss is dead, everything in the while loop is still getting executed. This is a key point.

Now, let's follow your logic. The following if statement is important:

if(dummy1->HP<1&&dummy2->HP<1){
beasts=2;
}
Because of the way you've set up your while loop, once you kill these two spawned enemies, beasts will always equal 2, even after you've killed the main boss (you never set it to anything else, once you've spawned the enemies).

So we move to the next if statement:

if(beasts==2){// this is an if function. it says if (whatevers in parentheses is true) then preform the next level of scope.
ghoma_eye->Data = c1;//cycles the combo for the eye to another combo, ID equal to c1
ghost->HP=h;//turns off the enemy's invincibility
Waitframes(900);//waits 15 seconds(i think)
h=ghost->HP;
ghost->HP=9999;//turns invincibility back on
ghoma_eye->Data = c2;
}
Since beasts is always 2, this if statement gets executed every frame, even if your main boss is dead. The last statement sets ghoma_eye to c2, which is exactly what you're seeing happen.

So, you need to do some boss-death clean up so that when the main boss dies, you set beasts to 0 or something. Maybe you could also reorganize your if statements or something, too. At any rate, I think that's what's going on.

Master Maniac
04-11-2008, 08:24 PM
ahh thats probably it...

ok so if i do something about this then ill have to change more than just the beasts=1...

ill also have to change this:


if(Screen->NumNPCs()==1){

dummy1= Screen->CreateNPC(n);
dummy2= Screen->CreateNPC(n);//these draw enemies with an ID equal to the value of n

beasts=1;

because it changes beasts to 1 if the total number of NPCs on the screen is 1... so ill have to change it to... well im not quite sure...

ill just have to do something different. i think i should just re-type the script... the problem is, im not sure how to make it a non-ghosted enemy. which really sucks for me... but yeah...

anyone have any ideas as to what else i could do with this part?... wait... ha! idea =)

also, the health tracker isnt working, so i'll have to do something different...

EDIT: would it effect anything if i moved the if() for the ghoma dying out of the while loop?or to another level of scope in the loop?

Gleeok
04-11-2008, 08:45 PM
Yeah, I figured that out in your other thread. It was hard for me to make sense out of what you were trying to do, so I redid it.

Master Maniac
04-11-2008, 09:03 PM
i noticed gleeok =) thank you lol

i replied there but i still have issues understanding some things myself too.

im not sure how for() and else() are supposed to work. (thats why you didnt see any in my script :p)

and you did the second re-do of the script with a small error. the eye is supposed to open when the enemies are killed, not spawn them when the eye opens.

but thats a small error.

not quite sure how im gonna make them better... i gotta access all the enemies on the screen's data nad make them firing somehow...

and my previous questions still apply too =)

thanks to everyone for all your help lol