PDA

View Full Version : So....



Joe123
04-20-2008, 07:02 PM
ffc script enemytallgrassshallowwater{
void run(int grass, int gcmb, int ripple, int rcmb){
int i;
if(grass == 0) grass = grasstile;
if(ripple == 0) ripple = rippletile;
if(gcmb == 0) gcmb = 131;
if(rcmb == 0) rcmb = 11;

Waitframes(4);
int ecount = Screen->NumNPCs();
npc e[10];
int j[10]; int fdly[10];
for(i=0;i<ecount;i++){
e[i] = Screen->LoadNPC(i+1);
}
while(true){
for(i=0;i<ecount;i++){
if(e[i]->isValid()){
if(Screen->ComboT[ComboAt(e[i]->X+8,e[i]->Y+8)] == rcmb){
fdly[i]++;
if(fdly[i] == 20){j[i]++; fdly[i] = 0;}
Screen->DrawTile(3, e[i]->X, e[i]->Y-2, ripple+j[i], 1, 1, 4, 1, 0, 0, 0, 0, true, 128);
if(j[i]==3) j[i] = 0;
}
if(Screen->ComboT[ComboAt(e[i]->X+8,e[i]->Y+8)] == gcmb){
fdly[i]++;
if(fdly[i] == 20){j[i]++; fdly[i] = 0;}
Screen->DrawTile(3, e[i]->X, e[i]->Y-2, grass+j[i], 1, 1, 3, 1, 0, 0, 0, 0, true, 128);
if(j[i]==3) j[i] = 0;
}
}
}
Waitframe();
}
}
}

Would this work?

I haven't actually tried it, because I don't have 780 at hand, but I think the code is ok?

So long as we have variable sized arrays and arrays of NPCs?


It's meant to make a tall grass/shallow water effect for every enemy on the screen.

Joe123
04-23-2008, 10:57 AM
Wow!

It does just work!
I'm so chuffed =D

I've never actually used an array before you see.
The only problem is that we don't have variable sized arrays, so I just had to load up '10' enemies instead of 'ecount' enemies, but that's ok.

=D

Go arrays!
I think I might go and change lots of scripts to array now =D

jman2050
04-23-2008, 02:05 PM
Yeah, I was going to mention that variable-sized arrays don't work currently. It's something I wanted to add before this build but never got the chance.

Still, the size of the arrays probably shouldn't be too much of a concern anyway unless you plan on using tons of memory.

Joe123
04-23-2008, 02:39 PM
I don't plan on doing it, but I might do accidentaly =S

How would I go about using lots of memory?