Jump to content

Photo

trouble with this->Data=0


  • Please log in to reply
7 replies to this topic

#1 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 09 April 2008 - 07:40 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.



CODE
//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=c2;
                ghoma_eye->Data=0;
        
                Game->PlaySound(s);//plays a sound equal to the interger "s"
            }
        Waitframe();    
        }
    
    }
    
}



before
after


PS: this script is useless as a boss right now. its so easy to beat, but it still has bugs too.

also, its not just a regular ghoma. thought i would throw that out there before someone said something like that =)

#2 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 09 April 2008 - 08:45 PM

What exactly is so different about this Ghoma that sets it apart from the built-ins? Does it shoot fire? Does it eat arrows? What makes it special?

Also, I don't know if it is the best idea to use enemy ghosting. Just expand upon the original Ghoma by having an ffc track the Ghoma's position and make the Ghoma appear to be shooting fire and other crap like that. Look at JMan's Scripting Power video 2. That is the kind of method I'd recommend. And ask him how he did it or something.

#3 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 09 April 2008 - 09:45 PM

but this ones not supposed to move!! lol i explained this at AGN

im not done making it special but herws what i have planned so far.

-spawns 2 enemies(so far... might make it more)
-only becomes vulnerable if those enemies are killed
-is vulnerable to anything (when it becomes vulnerable)
-is firing (not worked out yet)
-at some point might have a flamethrower... i'd have to ask gleeok's permission for it though. he made the item script for one, i'd just have to take parts from it and make it a boss attack. (not sure on this one yet)

and ill take any extra suggestions. (be aware, im a scripting n00b)

but its NON-MOVING

so you know =)

Edited by Master Maniac, 09 April 2008 - 09:48 PM.


#4 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 10 April 2008 - 02:29 AM

I'm not sure but here's how I manage ffc->Data:

rule 1; ffc->Data never under any circumstances is allowed to become 0.
rule 2; ffc->Data never under any circumstances is allowed to become 0.
rule 3; ffc->Data never under any circumstances is allowed to become 0...EVER!

The exeption is when a seperate script is set for the explicit purpose of another ffc#->Data=0;


Also make sure you don't accidentally cycle to 0.....hmm...dejavu

EDIT: please use the flamethrower! B) icon_cool.gif

...so wait, the eye is fine but the body disappears? Use npc->isValid() for detecting enemyHP. if !en->isValid(){ then Data=0; maybe.

Edited by Gleeok, 10 April 2008 - 02:34 AM.


#5 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 10 April 2008 - 06:02 PM

QUOTE(Gleeok @ Apr 9 2008, 11:29 PM) View Post

I'm not sure but here's how I manage ffc->Data:

rule 1; ffc->Data never under any circumstances is allowed to become 0.
rule 2; ffc->Data never under any circumstances is allowed to become 0.
rule 3; ffc->Data never under any circumstances is allowed to become 0...EVER!

The exeption is when a seperate script is set for the explicit purpose of another ffc#->Data=0;
Also make sure you don't accidentally cycle to 0.....hmm...dejavu

EDIT: please use the flamethrower! B) icon_cool.gif

...so wait, the eye is fine but the body disappears? Use npc->isValid() for detecting enemyHP. if !en->isValid(){ then Data=0; maybe.





i want the eye to disappear. thats the point. but the eye is the only thing that stays. i thought ffc->Data=0 made an ffc have the effect of disappearing? the body acts ok. but the eye WONT disappear. not sure why.

and thank you =) ill use it lol. ill have to figure out how to make it track link and curve to aim at him... but i can use slope to do that. never mind XD. y=mx+b right?

crap i forgot what all of that meant...

m=y intercept...
so b is displacement along y axis

this is gonna be hard to write up but ill try it XD

im gonna have to alter your script gleeok, but it will become a perfect boss. ill even make a "gleeok version" of the enemy... or try to XD

thanks =) (still need help figuring out whats wrong though...)

EDIT:
is there a screen->draw line function? if i could use the coordinates for the enemy and link to draw a line, it would make things a lot easier. then i could put the flames along the line to make things easier.

Edited by Master Maniac, 10 April 2008 - 06:05 PM.


#6 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 10 April 2008 - 11:06 PM

CODE
//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 && ghost->isValid()){
    
                dummy1= Screen->CreateNPC(n);
                dummy2= Screen->CreateNPC(n);//these draw enemies with an ID equal to the value of n

                beasts=1;
            }

            if(!dummy1->isValid() && !dummy2->isValid()){

                beasts=2;

            }
    
            ghost->HP=9999;//gives an "invincible"effect
    
            if(beasts==2 && ghost->isValid()){// 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->isValid()){//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(); this->Data=0; Quit(); //you don't really need both these but meh....;)
            }
        Waitframe();    
        }
    
    }
    
}


edit; oops, ok I see now.

edit 2; ..I had trouble reading your script so if that doesn't work this one will.

CODE

ffc script ghoma{

    void run(int m, int n, int c1, int c2,int h, int s){

               bool dead;
            npc ghost;
            npc dummy1;
            npc dummy2;

            ffc ghoma_body = Screen->LoadFFC(1);
            ffc ghoma_eye = Screen->LoadFFC(2);

            ghost = Screen->CreateNPC(m);
            ghost->X=ghoma_eye->X;ghost->Y=ghoma_eye->Y;      
            dummy1= Screen->CreateNPC(n);
            dummy2= Screen->CreateNPC(n);

               while (true){

            if(ghost->isValid()){
                        if(!dummy1->isValid() && !dummy2->isValid()){

                            dummy1= Screen->CreateNPC(n);
                               dummy2= Screen->CreateNPC(n);
                            ghoma_eye->Data = c1;
                            ghost->HP=h;
                            Waitframes(900);

                            h=ghost->HP;
                            ghost->HP=9999;
                            ghoma_eye->Data = c2;
                }
                else ghost->HP=9999;
            }
            else{
                        ghoma_body->Data=0;
                        ghoma_eye->Data=0;
                        if(!dead){Game->PlaySound(s);dead=true;}
                    }
            Waitframe();    
            }
    }
}

Edited by Gleeok, 11 April 2008 - 04:49 AM.


#7 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 11 April 2008 - 07:45 PM

ah thank you gleeok =)

i started re-writing the script anyway so i think i could try these =)

also, is there any command to make enemies firing even if its not in their data?

EDIT: crap these are confusing...

im not sure how the else() thing works... or the for() for that matter...

lol im not sure where im gonna put the code to beef this thing up but... ill try =)

EDIT2: also the second one has an issue. the enemies are supposed to be killed to make it open its eye.

Edited by Master Maniac, 11 April 2008 - 07:58 PM.


#8 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 14 April 2008 - 04:47 PM

gleeok the second one works just fine. ill make some little alterations to it if i can fugure out how to do some stuff.

thank you =)

i dont understand what was erong completely though...


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users