The Dink Network

Reply to How to script so your stuff can malfunction in ten different ways...

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
August 19th 2004, 12:22 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
If that would be a book, I would be the author. But now seriously, I've made a really cool boss (pillbug guy from BoE) and I've had a lot of bug reports on that one. Only problem is... they were all different . For some people, the computer froze, unable to do anything but resetting. With other players (including myself, 15 minutes ago) the boss freezes and acts like a dead pillbug-body (or it just disappears with the same effect: pillbugs won't drop anymore and you can't hit the guy out of the air). Now (after my own crash ) I'm desperate to get it work for everybody, so here's the three scripts which it uses:

Script attached to screen (s2-scr1.c):

void main( void )
{
if (&story > 19)
{
freeze(1);
say_stop("There's nothing more to see here.",1);
fade_down();
&player_map = 103;
load_screen(103);
draw_screen();
fade_up();
unfreeze(1);
kill_this_task();
}
int &xie;
int &yie;
int &crap;
int &brap;
&bosspoint = 80;
stopmidi();
&store = 0;
//Store = 0 --> Boss in air
//Store = 1 --> Boss on ground or floating down
//Store = 2 --> Boss floating up
freeze(1);
say_stop_xy("`% You'll never find me! HAHAHA!!",1,1);
unfreeze(1);
playmidi("5.mid");
set_callback_random("fallpill", 1000, 2000);
}

void fallpill( void )
{
if (&store == 0)
{
&xie = random(360, 1);
&xie += 120;
&yie = random(160, 1);
&yie += 120;
&crap = create_sprite(&xie, &yie, 0, 432, 1);
&brap = create_sprite(&xie, -50, 0, 131,1);
sp_base_walk(&brap, 130);
sp_speed(&brap, 5);
move_stop(&brap, 2, &yie, 1);
sp_nodraw(&crap, 1);
&target = &crap;
external("effect","killit");
sp_speed(&brap, 2);
sp_script(&brap, "en-pill");
unfreeze(1);
}
}

Script attached to walls (s2-hit.c):

void main( void )
{
int &xie;
int &yie;
int &crap;
int &brap;
sp_nodraw(&current_sprite, 1);
}

void hit( void )
{
if (&story > 19);
{
return;
}
if (&store == 0)
{
&store = 1;
&xie = random(360, 1);
&xie += 120;
&yie = random(160, 1);
&yie += 120;
&crap = create_sprite(&xie, &yie, 0, 432, 1);
&xie -= 7;
&yie -= 13;
&brap = create_sprite(&xie, -100, 0, 411, 1);
sp_speed(&brap, 5);
move_stop(&brap, 2, &yie, 1);
sp_nodraw(&crap, 1);
&target = &crap;
external("effect","killit");
sp_script(&brap, "s2-boss1");
}
}

Script of the boss (s2-boss1.c):

void main( void )
{
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 2);
sp_target(&current_sprite, 1);
sp_base_walk(&current_sprite, 410);
sp_touch_damage(&current_sprite, 8);
preload_seq(70);
set_callback_random("beammeup",1000, 2000);
}

void hit( void )
{
unfreeze(1);
&bosspoint -= &strength;
if (&bosspoint < 1)
{
defeat();
return;
}
say("`% &bosspoint",&current_sprite);
beammeup();
unfreeze(1);
}

void beammeup( void )
{
//Where's Scotty when you need him?
&store = 2;
sp_touch_damage(&current_sprite, 0);
sp_que(&current_sprite, 2000);
//Set him floating
sp_brain(&current_sprite, 0);
int &xie = sp_x(1, -1);
int &yie = sp_y(1, -1);
&xie += 7;
&yie += 13;
&crap = create_sprite(&xie, &yie, 0, 432, 1);
sp_speed(&current_sprite, 5);
move_stop(&current_sprite, 8, 0, 1);
sp_nodraw(&current_sprite, 1);
sp_nodraw(&crap, 1);
&store = 0;
//He's up again, pillbugs may fall.
&target = &crap;
external("effect","killit");
&target = &current_sprite;
external("effect","killit");
unfreeze(1);
}

void defeat( void )
{
&store = 2;
//Floating status means now inactive.
sp_touch_damage(&current_sprite, 0);
freeze(1);
&life = &lifemax;
sp_brain(&current_sprite, 0);
sp_que(&current_sprite, -2000);
int &xie = sp_x(&current_sprite, -1);
int &yie = sp_y(&current_sprite, -1);
&xie += 20;
&yie -= 70;
int &crap = create_sprite(&xie, &yie, 7, 70, 1);
sp_seq(&crap, 70);
playsound(24, 22025, 0, 0, 0);
wait(250);
&xie -= 30;
&yie += 40;
int &crap = create_sprite(&xie, &yie, 7, 70, 1);
sp_seq(&crap, 70);
playsound(24, 22025, 0, 0, 0);
wait(250);
&xie +=20;
&yie += 20;
int &crap = create_sprite(&xie, &yie, 7, 70, 1);
sp_seq(&crap, 70);
playsound(24, 22025, 0, 0, 0);
wait(250);
&xie -= 25;
&yie -= 50;
int &crap = create_sprite(&xie, &yie, 7, 70, 1);
sp_seq(&crap, 70);
playsound(24, 22025, 0, 0, 0);
wait(250);
&xie += 15;
&yie += 30
int &crap = create_sprite(&xie, &yie, 7, 70, 1);
sp_seq(&crap, 70);
playsound(24, 22025, 0, 0, 0);
wait(250);
sp_nodraw(&current_sprite, 1);
script_attach(1000);
&story = 20;
say("I've got the key to the main boss room!",1);
add_item("item-key", 850, 6);
wait(1000);
fade_down();
&player_map = 103;
load_screen(103);
draw_screen();
fade_up();
unfreeze(1);
kill_this_task();
}

The "effect","killit" procedure looks like this:

void killit ( void )
{
//Removes a sprite permanently from the map
int &hold = sp_editor_num(&target);
if (&hold != 0)
{
editor_type(&hold, 3);
}
sp_brain(&target, 5);
sp_notouch(&target, 1);
sp_nohit(&target, 1);
sp_hard(&target, 1);
draw_hard_sprite(&target);
sp_nodraw(&target, 1);
sp_active(&target, 0);
kill_this_task();
}

&target, &bosspoints, &story and &store are all globals initted in main.c.

I hope it's in my scripting and not in the engine, because scripting can be fixed, and the engine... can be fixed too, but I'd rather fix my scripting (which I understand) than the engine (which I don't)
If anyone finds the bug, I'd really really REALLY appreciate it!