murderous pigs planning a piggy reveloutoin.
i have a subquest in my dmod about killer pigs ect, (you know, the usual) and in one of the cutscenes 2 of the pigs dont freeze when i want them to. here are all scripts involved.
//cutscene script
void main(void)
{
freeze(1);
freeze(¤t_sprite);
freeze(&deathpig1);
freeze(&deathpig2);
freeze(&deathpig3);
freeze(&deathpig4);
say_stop("`5enough nonesense, eat the girl before she blabs about le resitanse de piggy to the king!", &deathpig1);
say_stop("`2uhh chief,", &deathpig1);
say_stop("`5what now cletus?", &deathpig1);
say_stop("`2there be an intruder!", &deathpig3);
sp_dir(1,4);
say("dum de doo...", 1);
wait(1200);
say_stop("`5GET THAT ASSMOLE BEFORE HE TALKS", &deathpig1);
say("well, i'll be going...", 1);
say_stop("`5not so fast pig ass", &deathpig1);
say_stop("did you call me a pig ass", 1);
say_stop("then it's time to die!", 1);
playmidi("106.mid");
unfreeze(1);
unfreeze(&deathpig1);
unfreeze(&deathpig2);
unfreeze(&deathpig3);
unfreeze(&deathpig4);
sp_target(&deathpig1, 1);
sp_target(&deathpig2, 1);
sp_target(&deathpig3, 1);
sp_target(&deathpig4, 1);
}
//first pig that doesent freeze
void main(void)
{
&deathpig3 = (¤t_sprite);
}
//second pig that doesent freeze
void main(void)
{
&deathpig4 = (¤t_sprite);
}
//extract from main.c
make_global_int("&deathpig3", 0);
make_global_int("&deathpig4", 0);
ive been trying to fix this for 2 days now, but i just cant see the problem. thanks.
//cutscene script
void main(void)
{
freeze(1);
freeze(¤t_sprite);
freeze(&deathpig1);
freeze(&deathpig2);
freeze(&deathpig3);
freeze(&deathpig4);
say_stop("`5enough nonesense, eat the girl before she blabs about le resitanse de piggy to the king!", &deathpig1);
say_stop("`2uhh chief,", &deathpig1);
say_stop("`5what now cletus?", &deathpig1);
say_stop("`2there be an intruder!", &deathpig3);
sp_dir(1,4);
say("dum de doo...", 1);
wait(1200);
say_stop("`5GET THAT ASSMOLE BEFORE HE TALKS", &deathpig1);
say("well, i'll be going...", 1);
say_stop("`5not so fast pig ass", &deathpig1);
say_stop("did you call me a pig ass", 1);
say_stop("then it's time to die!", 1);
playmidi("106.mid");
unfreeze(1);
unfreeze(&deathpig1);
unfreeze(&deathpig2);
unfreeze(&deathpig3);
unfreeze(&deathpig4);
sp_target(&deathpig1, 1);
sp_target(&deathpig2, 1);
sp_target(&deathpig3, 1);
sp_target(&deathpig4, 1);
}
//first pig that doesent freeze
void main(void)
{
&deathpig3 = (¤t_sprite);
}
//second pig that doesent freeze
void main(void)
{
&deathpig4 = (¤t_sprite);
}
//extract from main.c
make_global_int("&deathpig3", 0);
make_global_int("&deathpig4", 0);
ive been trying to fix this for 2 days now, but i just cant see the problem. thanks.
nope, no luck. i'll try that again in the morning though, because i didnt do it properly as my dads presurizing me to get on the computer.
There might be some silly explanation to your problem, like that you've attached the wrong scripts to the pigs in the editor. Check out!
Try putting a wait(100); at the begining of the cutscene scripts' main() just to make sure the globals in the sprite script has time to get assigned before those sprites are controlled.
Also if there is a local variable anywhere that starts with d ( &dxxx..) that is changing at that time it may confuse the Dink engine and change the wrong var.
Also if there is a local variable anywhere that starts with d ( &dxxx..) that is changing at that time it may confuse the Dink engine and change the wrong var.
September 10th 2004, 05:32 PM

MiloBones


get_sprite_with_this_brain, combined with using nonexisting brains, is awesome in this sort of situation. You don't have to burn any globals.
But this isn't relevant, so I'll shut up.
But this isn't relevant, so I'll shut up.
An example from the waller:
//wallbr.c
//marks bottom right corner
void main( void )
{
sp_brain(¤t_sprite, 90);
wait(2);
sp_brain(¤t_sprite, 0);
}
//walltl.c
//marks top left corner and makes walls
void main( void )
{
...
wait(1);
//get sprite number of marker for bottom right corner
int &wallbr = get_sprite_with_this_brain(90, 1);
...
//wallbr.c
//marks bottom right corner
void main( void )
{
sp_brain(¤t_sprite, 90);
wait(2);
sp_brain(¤t_sprite, 0);
}
//walltl.c
//marks top left corner and makes walls
void main( void )
{
...
wait(1);
//get sprite number of marker for bottom right corner
int &wallbr = get_sprite_with_this_brain(90, 1);
...
"Also if there is a local variable anywhere that starts with d ( &dxxx..) that is changing at that time it may confuse the Dink engine and change the wrong var."
You mean the dxxx will be mistaken for a deathpigx? I don't think so. This way there would only be a possibility for 26 vars, and that's not really much.
It will go wrong if you have a &d and a &deathpig at the same time, or, more generally, an &xxx and an &xxxyyy. (don't start about &magic and &magic_cost and &magic_level, I dunno that, probably an engine thing).
If you didn't mean that... I dunno anything
You mean the dxxx will be mistaken for a deathpigx? I don't think so. This way there would only be a possibility for 26 vars, and that's not really much.
It will go wrong if you have a &d and a &deathpig at the same time, or, more generally, an &xxx and an &xxxyyy. (don't start about &magic and &magic_cost and &magic_level, I dunno that, probably an engine thing).
If you didn't mean that... I dunno anything

Dink keeps global variables straight but locals can confuse it. Read 'Dink C reference 3.1' for details. That's probably not the problem though.
i fixed the problem, by making it wait before the cutscene. thanks everyone. theres another problem though, that just happend, the girl who the pigs are trying to eat turns into a pig. i'm not that botherd, because i havent had a proper look at the problem, but anyway. thanks.
Do'h. clasical mistake, i put the wrong walk sequence in. that happens to me a lot, does it say what they are anywere?
alls well, and thanks to all.
alls well, and thanks to all.
Thanks, had i known about that earlyer it would have saved me a lot of trouble.
I think the wait(100) or something like that could be changed to give more time for the globals or something to be assigned properly, like wait(300).
I don't think that would make a difference. Wait(100) is easily long enough in my experience.
I could be wrong though.
I could be wrong though.
Uh, to me, it's too fast a number to properly assign the vars of my global stuff... That is, in MY DMOD. I'm not sure about other DMODs.
Well, I never have to check globals so quickly after changing them in my d-mod, so I don't really know.
