The Dink Network

Missile brain Question

December 20th 2009, 10:35 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Solved, thanks

I'm making a spell for dink. The animation that the missile brain will use is a picture of a explosion that expends and shrinks once along with it's harbox. This should result in a skill that damage monsters far away fewer times than those close to it. But it looks like only the first frame in the sequence acully deal damage (The frame with the smallest hardbox).

Is the problem my scripting or is it impossible to make a missile damage things without moving?

void use(void)
{
	If(&form < 2)
	{
		freeze(1);
		say("*Casting the spell*", 1);
		&magic_level = 0;
		draw_status();
                //We don't want dink to take damage.
		sp_nohit(1, 1);
                //first we get dinks cordinates
		&x = sp_x(1, -1);
		&y = sp_y(1, -1);
                //And create a explotion
		&m1 = create_sprite(&x, &y, 17, 899, 1);
		sp_seq(&m1, 899);
		sp_frame(&m1, 1);
		sp_speed(&m1, 6);
  		sp_strength(&m1, 10);
		sp_que(&m1, -500);
		wait(1500);
		unfreeze(1);
                //Sequence is over, let's make dink hit-able
		sp_nohit(1, 0);

	}
	else
	{
		say("I can't cast spells in Shadow Form!", 1);
	}		
}
void arm(void)
{
	preload_seq(899);
	&magic_cost = 500;
	&magic_level = 0;
	int &x;
	int &y;
}
void disarm(void)
{
&magic_level = 0;
kill_this_task();
}
void pickup(void)
{
Debug("Player now owns this item.");
kill_this_task();
}

void drop(void)
{
Debug("Item dropped.");
kill_this_task();
}
December 20th 2009, 06:03 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
Have all the frames got hardboxes? Many spells have animated sprites, so all the frames should be able to hit an enemy.

This seems like a good idea, sorry I can't be of too much help, but I hope this works out for you. Seriously, we need stuff like this being developed at the moment.
December 20th 2009, 07:09 PM
fairy.gif
Someone
Peasant He/Him Australia
 
There is an intermission.. a missile can only damage a certain sprite every 100ms or something
December 21st 2009, 08:38 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Forget this, i've still got problems... Look down.
December 21st 2009, 10:19 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Perhaps a bit late, as you've figured it out already, but the bomb is a non-moving missile that does damage.
December 21st 2009, 01:34 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Now I've got problems again. Is there any way of hurting all monsters? I was thinking about counting the number of monster with brain 9 and then doing some loop which run the hurt that number of times... But I need some way of detecting which monsters that I've already cast the spell on.

Here's the script, if anyone could think of a way to damage all monsters, please tell me. Oh, and the high damage is temporary... And the skill will be disabled while fighting bosses.

void use(void)
{
	// Dink's cordinates
	&dx = sp_x(1, -1);
	&dy = sp_y(1, -1);
	//Create animation for effect only:
	&ani = create_sprite(&dx, &dy, 7, 899, 1);
	sp_seq(&ani, 899);
	//Set the damage
	&damage = 1000;
	&tar = get_sprite_with_this_brain(9, &current_sprite);
	// Target's cordinates
	&tarx = sp_x(&tar, -1);
	&tary = sp_y(&tar, -1);
	//Now, is the spirite left or right of dink?
	If(&tarx > &dx)
	{
		//sprite is right of dink
		//How far?
		&tarx -= &dx;
		//Now, let's lower the damgae by that!
		&damage -= &tarx;
	}
	else
	{
		//sprite is left of dink
		&dx -= &tarx;
		&damage -= &dx;
	}
	//So far, so good, Let's fix the Y-Cordinates too.
	If(&tary > &dy)
	{
		//sprite is under dink.
		&tary -= &dy;
		&damage -= &tary;
	}
	else
	{
		//sprite is over Dink
		&dy -= &tary;
		&damage -= &dy;
	}
	//Now let's set a minimum damage,
	If(&damage < &magic)
	{
		&damage = &magic;
	}
	//And... Hurt him!
	hurt(&tar, &damage);
	&magic_level -= 500;
	draw_status();						
}
void arm(void)
{
	preload_seq(899);
	&magic_cost = 1000;
	int &dis;
	int &tar;
	int &tarx;
	int &tary;
	int &dx;
	int &dy;
	int &damage;
	int &ani;
}
void disarm(void)
{
&magic_level = 0;
kill_this_task();
}
void pickup(void)
{
Debug("Player now owns this item.");
kill_this_task();
}

void drop(void)
{
Debug("Item dropped.");
kill_this_task();
}	
December 21st 2009, 05:36 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Yes you'll need some sort of loop. I'd just use get_next_sprite_with_this_brain() instead of get_sprite_with_this_brain()

int &counter = 1;
loop:
&tar = get_next_sprite_with_this_brain(9,1,&counter);
if (&tar == 0)
{
goto stop;
}
&counter = &tar;
//Do damage (that complicated thing you have there)
goto loop;
stop:


This will make sure you find every brain 9 enemy there is on the screen.

EDIT: Also, I don't know what happens if you do negative damage, which is kind of what you're doing for some sprites.
December 21st 2009, 07:20 PM
burntree.gif
Fireball5
Peasant He/Him Australia
Let me heat that up for you... 
Negative damage? Wouldn't that heal them?
December 22nd 2009, 05:36 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
I didn't know about get_next_sprite_with_this_brain! That makes it a whole lot easier! Thanks!

Oh, and look in the script, I've already made sure It will not deal negative damage.
//Now let's set a minimum damage,
	If(&damage < &magic)
	{
		&damage = &magic;
	}
	//And... Hurt him!
	hurt(&tar, &damage);


December 23rd 2009, 01:07 PM
knightg.gif
paladinemet
Peasant He/Him United States
The Truth is out there 
negetive damage results in zero damage (as of dink v. 1.08)