The Dink Network

3 Questions

October 27th 2003, 03:56 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
I have some development questions..

1) Which command, and where should I write it in order to make Dink change sprites when changing armed items. I have the problem that Dink first arms the sword, then arms some other item (and not any sword) but his sprite seq is still holding the sword..

2) I have two script which have hit - functions, and when hitting both at the same time, the game freezes (two different scripts). Why? How do I solve this problem?

3) When you have created a warp object in the dink edit program, the sound when touching this will always be the 'opening door sound'. I don't want to have this sound when walking through an open doorway (I don't want to have any sound at all). I have tried to set the sp_sound to 0, but it doesn't work. What should I do?

October 27th 2003, 04:24 PM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
1) in the item script... load graphics for the new weapon in the arm() procedure, unload them (or in reality replace them) is the holdingdrop() procedure. Best example to look at is the item-sw1 (or any sword script, or bow script from the original game)

2) It depends on what is meant to be happening in each of the scripts? Is it complicated? Are you checking things like what the current weapon is?

3) Inside the editor you can assign a sound to a warp sprite - SHIFT 7 I think is the combo. But to have no sound... just create a hard sprite, and attach a script that does the warp on touch... so set touch_damage to -1 in the main() procedure and then in the touch procedure do the warp. Have a look at the scripts for the hole/crawl stuff, and just remove the crawling animation
October 27th 2003, 04:39 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
Ok.. thanks for the answers, I think I can get rid of the first and third problem now, but not the second. Those two script that doesn't likes to be hit (barrel and a rock) at the same time are those. I also noticed that rock and a enemy freezes the game in the same way. It's not just Dink that's frozen, but the entire game. I have to restart my computer.:

***barrel:

void main( void)
{
preload_seq(173);
}

void talk ( void )
{
int &fla;
&fla = &barrel;
&fla += 1;
freeze(1);
say_stop("`2 The smashing barrels voice: You're looking at the barrel nr &fla. Never hesitate!", 1);
wait(200);
unfreeze(1);
}

void hit ( void )
{
&barrel += 1;

if(&barrel == 1)
{

freeze(1);
sp_nocontrol(1, 1);
say("`2 The smashing barrels voice: Yes yes, smash 'em, I love it!", 1);
wait(200);
unfreeze(1);

}
if (&barrel == 30)
{
freeze(1);
say_stop_stop("`2 Ok, stupid you actually buried your sword on the beach, between two trees", 1);
unfreeze(1);

//play noise
playsound(37, 22050, 0,0,0);
int &hold = sp_editor_num(&current_sprite);

if (&hold != 0)
{
//this was placed by the editor, lets make the barrel stay flat
editor_type(&hold, 3);
editor_seq(&hold, 173);
editor_frame(&hold, 6);
//type means show this seq/frame combo as background in the future
}
sp_seq(&current_sprite, 173);
sp_brain(&current_sprite, 5);
sp_notouch(&current_sprite, 1);
sp_nohit(&current_sprite, 1);
sp_hard(&current_sprite, 1);
//sprite ain't hard no more! Let's redraw the hard map in one area
draw_hard_sprite(&current_sprite);
}
else
{
//play noise
playsound(37, 22050, 0,0,0);
int &hold = sp_editor_num(&current_sprite);

if (&hold != 0)
{
//this was placed by the editor, lets make the barrel stay flat
editor_type(&hold, 3);
editor_seq(&hold, 173);
editor_frame(&hold, 6);
//type means show this seq/frame combo as background in the future
}
sp_seq(&current_sprite, 173);
sp_brain(&current_sprite, 5);
sp_notouch(&current_sprite, 1);
sp_nohit(&current_sprite, 1);
sp_hard(&current_sprite, 1);
//sprite ain't hard no more! Let's redraw the hard map in one area
draw_hard_sprite(&current_sprite);
say("`2 Yes yes! More, more smashing!", 1);
wait(400);
//added 2003-10-07
if (&barrel == 1)
{
say(" I have smashed &barrel barrel!", 1);
}
if (&barrel > 1)
{
say(" I have smashed &barrel barrels!", 1);
}
wait(100);
}

}

*** rock

void main( void )
{
}
void push( void )
{
say("Rock is just too heavy to move.", 1);
return;
}

void hit(void)
{
int &rcrap = compare_sprite_script(&missle_source, "dam-bomn");

if (&rcrap == 1)
{
sp_hard(&current_sprite, 1);
draw_hard_sprite(&current_sprite);
sp_active(&current_sprite, 0);
playsound(43, 22050, 0,0,0);

int &hold = sp_editor_num(&current_sprite);
if (&hold != 0)
editor_type(&hold, 1);
}
}

October 27th 2003, 04:53 PM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
Your simpliest solution would be to move the rock... as I feel it is the compare_sprite_script that may be causing the problem. I'm not entirely certain... but I remember using it for a new bomb (the sleep bomb in SOB) and when I put the command in enemies hit procedures the game would freeze or crash... in the end I used the damage procedure of the bomb script itself to control the enemy sprite.

If you can't move the rock, trying simplifying the hit procedures so that the engine is only having to do one check depending on the number of barrels smashed, maybe using spawn() and global tempholders to run each spawned script.
October 27th 2003, 05:02 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
Ok, yeah I guess I can simple move them, it's probable the best solution to this problem. Thanks!

I discoverd another strange thing when testing. I have a script that shrinks it's sprite, and removes it when hitting it with the claw sword. If I first use the claw sword and hit one such sprite, it dissappears as it should. If I then shoot a fireball at another such script it shrinks and dissappears too! But the fireball should not have this ability. And it only works like this, when cutting down one or more such sprites with the claw sword.
October 28th 2003, 12:49 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
So... you have a sprite with script "clawshrk" attached... in which the hit procedure checks to see if the claw sword is armed and then shrinks... or something else.

Because a sprite will respond to a hit from anything... be it bomb or fireball, or sword... and if it is using compare_weapon() to see if Dink is armed with a sword then the shrink stuff will still happen even if the sword has not been used. I hope that makes sense... but post the script and lets see
October 28th 2003, 12:59 AM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
The grass/bush/undergrowth script looks like this:

void main( void )
{
}

void hit (void)
{
int &bla = compare_weapon("Item-sw3");
if (&bla == 1)
{
//hopefully this will shrink it

sp_brain_parm(&current_sprite, 5);
sp_brain(&current_sprite, 12);
sp_touch_damage(&current_sprite, 0);
sp_timing(&current_sprite, 0);

int &hold = sp_editor_num (&current_sprite);
if (&hold != 0)
editor_type(&hold, 1);
sp_hard(&current_sprite, 1);
//sprite ain't hard no more! Let's redraw the hard map in one area
draw_hard_sprite(&current_sprite);
}
}

I think it's from the Prophecy of the Ancients, but I'm not sure. And I have modified it a bit.

And this bugg only appear, when I have uesd the claw sword first. If I hit the sprite with the fist and then fire it with a fireball, nothing happens.
October 28th 2003, 01:48 AM
custom_simon.gif
SimonK
Peasant He/Him Australia
 
So you hit the sprite with a claw sword and it disappears... and then with the claw sword still armed you hit more sprites with the same script attached with a fireball and they disappear, but you don't want them to... at least that's what I think you're saying.

And that is probably because the compare_weapon() command just looks to see if the weapon is armed... not if it has been used.
October 28th 2003, 07:44 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
It might be an idea to check &missile_target, just to see if it was a missile it got hit by. (It is if &missile_target > 0)

Also, the grass should shrink when an enemy hits it. Check &enemy_sprite for that.

I hope this helps a bit.
October 28th 2003, 08:44 AM
wizardg.gif
Paul
Peasant He/Him United States
 
You can test:
if (sp_active(&missle_source, -1) > 0)
but all that really does is check if Dink just shot a spell/arrow, so if he casts a fireball off to the side and then hits the shrub with his swrord, it'll think it was hit with magic. There doesn't seem to be any good way to do this.

Theres one wierd thing that might help, but I'd class it has a bug so I don't know if it's good to use.

If a sprite is soft and nohit weapons can still make it run it's hit procedure. (but spells can't) But you'd have to be creative to use that anyway since your sprite is hard.
October 28th 2003, 01:13 PM
peasantmg.gif
Raven
Peasant He/Him Sweden
 
Ok, thanks for the explanation. This problem isn't really a big problem, since Dink can't destroy any bushes or undergrowth with magic before he finds the claw sword. I just wanted to know why this bug occured.
November 3rd 2003, 08:02 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
I know this post is a little out-of-date, but whatever, there MUST be some way to do it.

I think this thing might work:

void hit( void )
{
if (&missle_source == &current_sprite)
{
&missle_source = 0;
//Do nothing
}
//Put the sword-check and the rest of the script here
}