PDA

View Full Version : Stupid Rising Fireballs.



Archangel
04-17-2009, 10:58 PM
First of all so you all can see the desire effect for yourselves. Switch a fire wizzrobes projectile to rising fireballs and make them teleport instead of float. I want a ghoma to fire fireballs in a ring. How can I do this. THis is what I tried.



ffc script Gohma5{
void run(int count){
while(true){
npc gohma = Screen->LoadNPC(2);
for(count = 8; count <= 8; count++){ //shoot 8 fireballs in right
npc gohma = Screen->LoadNPC(2);
eweapon fireball = Screen->CreateEWeapon(145);
fireball->X = gohma->X;
fireball->Y = gohma->Y;
fireball->Dir = count - 1;
waitframe();
} //ends for loop
Waitframes(30);
} //ends while loop
} //ends void run
} //ends script

Compiled just find. Doesn't work worth a shit though. Try it out yourself. Oh and if you want to see what the gohma does, attach it to a digdogger using my displacement script.

pkmnfrk
04-17-2009, 11:17 PM
Try this, see if it works: (I highlighted my changes)


ffc script Gohma5{
void run(){
Waitframes(1);
npc gohma = Screen->LoadNPC(2);
while(gohma->isValid()){
for(int count = 8; count <= 8; count++){ //shoot 8 fireballs in right
npc gohma = Screen->LoadNPC(2);
eweapon fireball = Screen->CreateEWeapon(145);
fireball->X = gohma->X;
fireball->Y = gohma->Y;
fireball->Dir = count - 1;
fireball->Angular = false;
Waitframe();
} //ends for loop
Waitframes(30);
} //ends while loop
} //ends void run
} //ends script

Questwizard88
04-17-2009, 11:50 PM
I think I'm going to give this a shot. I've never messed with FFC scripts yet, but I think I might have found another issue. You're only going to get one weapon to fire with the way you have the count variable set. Since it gets initialized to 8 by the loop, it'll only run that loop once, because the count++ will make it 9 the next time through. Try this (includes the changes from above):

ffc script Gohma5{
void run(){
Waitframes(1);
npc gohma = Screen->LoadNPC(2);
while(gohma->isValid()){
for(int count = 0; count <= 7; count++){ //shoot 8 fireballs in right
npc gohma = Screen->LoadNPC(2);
eweapon fireball = Screen->CreateEWeapon(145);
fireball->X = gohma->X;
fireball->Y = gohma->Y;
fireball->Dir = count;
fireball->Angular = false;
Waitframe();
} //ends for loop
Waitframes(30);
} //ends while loop
} //ends void run
} //ends script

Dunno if that's right, but assuming what I know from other languages, it should be correct.

Archangel
04-18-2009, 12:05 AM
I knew it had something to do with a angle based bool! :)
Anyways, hopefully when I get around to implementing these two versions and compare them, I'll be able to fix it up. Do some heavy testing, and make a public demo through level 6. All shall bow before my mighty Gohma!

pkmnfrk
04-18-2009, 12:24 AM
I think I'm going to give this a shot. I've never messed with FFC scripts yet, but I think I might have found another issue. You're only going to get one weapon to fire with the way you have the count variable set. Since it gets initialized to 8 by the loop, it'll only run that loop once, because the count++ will make it 9 the next time through. Try this (includes the changes from above):

*snip*

Dunno if that's right, but assuming what I know from other languages, it should be correct.

Doh! I can't believe I missed that.

Alternately, the for() could have been written like:


for(int count = 8; count > 0; count--) {

But, there's no real benefit in doing that, really.

lucas92
04-18-2009, 08:32 AM
I think you actually need to wait 2 frames before using the first Screen->LoadNPC...

pkmnfrk
04-18-2009, 11:52 AM
ffc script Gohma5{
void run(){
npc gohma = Screen->LoadNPC(2);
while(!gohma->isValid()) {
Waitframe();
gohma = Screen->LoadNPC(2);
}
while(gohma->isValid()){
for(int count = 0; count <= 7; count++){ //shoot 8 fireballs in right
npc gohma = Screen->LoadNPC(2);
eweapon fireball = Screen->CreateEWeapon(145);
fireball->X = gohma->X;
fireball->Y = gohma->Y;
fireball->Dir = count;
fireball->Angular = false;
Waitframe();
} //ends for loop
Waitframes(30);
} //ends while loop
} //ends void run
} //ends script

Last version, doesn't matter how many frames you need to wait.

Archangel
04-18-2009, 12:37 PM
Oh well. This one creates the 8 way effects. But doesn't emulate the effect that my example in my initial post does.

"First of all so you all can see the desire effect for yourselves. Switch a fire wizzrobes projectile to rising fireballs and make them teleport instead of float."