📧 Message Board Archive

Problem with scripting for a new magic
I am working on a new magic. It is a "flash" type of magic. When Dink casts the magic, a series of "concentric" flashes would be generated within a short time. It will damage many (if not all) monsters in the screen.



I have created a series of graphics from 130x90 to 1300x900 bmp files for the flashes. However, I can only set the brain of the flash to 7 since I only want one series of flashes (then die). I also need to set the speed of the flash to be 0 since the flashes need to be concentric around Dink. The problem is the flashes don't hurt anybody.



I tried to change the hardbox of the flash sprites in Dink.ini; I tried using very long sp_range (600); but nothing worked. I did manage to do some damage to the monsters using a spawn("dam") and use hurt(&random_monster, 10), but that way Dink won't get any experience if the monsters were killed by the magic. I might be able to put

"&exp += 25;" or "add_exp(25, &current_sprite);" in die(void) instead of using sp_exp(&current_sprite, 25); in main(void). But it seems that those solutions would fail if many monsters die at the "same" time. Just don't know why.



Any suggestions?
Re: Problem with scripting for a new magic
: Any suggestions?



There is a special brain for what you need, 17. It works like a cross between 11 and 7. The other problem is that Missles don't use hard boxes, they use sp_range so if you want the real area of the effect to match the apperent area (the sprite) as it grows, you'll have to manually increment sp_range.
Re: Problem with scripting for a new magic
: There is a special brain for what you need, 17. It works like a cross between 11 and 7. The other problem is that Missles don't use hard boxes, they use sp_range so if you want the real area of the effect to match the apperent area (the sprite) as it grows, you'll have to manually increment sp_range.



Thank you for the reply.



I did try to use sp_range(&junk, 600) with brain 17, but it will cause multiple damage to the same monster and slow down the game a lot if there are a lot of monsters in the screen.



I also tried using sp_pseq & sp_pframe and change sp_range from 0 to 600 before the last frame. In order to have the seq proceed with every frame, I need to put wait(1) between sp_pframe and it caused all kinds of problem when a lot of other scripts ruuning at the same time.



''Using spawned script to cause hurt() on random monsters and put "&exp += 20" in die'' is the best way I can find so far as long as NO level increase occurs at that time. (BUT you cannot visually see the increased exp even I put a say("20", &current_sprite); on the die procedure. Don't know why?



I may decide that NO experience will be given for using this magic since it's so powerful. :p
Re: Problem with scripting for a new magic
Hmm, I'm not quite sure what you want to do then.



You want to damage all enemies on the screen (once), and have dink only get only 20 exp if they die from it, correct?
Problem solved, sort of.
I used what you said earlier with a little twist:



First, I put the following in use(void) of the item script



&junk = create_sprite(&xdink, &ydink, 17, 196, 1);

sp_speed(&junk, 0);

sp_strength(&junk, 2);

sp_brain_parm(&junk, 1);

sp_seq(&junk, 196);

sp_range(&junk, 0);

sp_script(&junk, "dam-fla");



Then I have main(void) in dam-fla as



void main( void )

{

&silence = 1;

int &pcrap;

two:

&pcrap = sp_pframe(&current_sprite, -1);

if (&pcrap < 2)

{

 wait(1);

 goto two;

}

sp_range(&current_sprite, 90);

five:

&pcrap = sp_pframe(&current_sprite, -1);

if (&pcrap < 5)

{

 wait(1);

 sp_range(&current_sprite, 0);

 goto five;

}

sp_range(&current_sprite, 250);

ten:

&pcrap = sp_pframe(&current_sprite, -1);

if (&pcrap < 10)

{

 wait(1);

 sp_range(&current_sprite, 0);

 goto ten;

}

sp_range(&current_sprite, 600);

wait(1);

sp_range(&current_sprite, 0);

&silence = 0;

}



I use the global variable &silence to avoid hitting some annoying thing. (Something might freeze Dink if Dink hit it.) By doing the above thing, any given sprite will not be hit more than 3 times; besides only the closest enemies will be hit twice or more.



It worked fine as far as I can tell except for hitting the fish (with random bonus exp). It two fishes die at the same time, then I will have trouble. So I decided the fish is NOT hittable by this magic. :p
Re: Problem solved, sort of.
: I used what you said earlier with a little twist:



>8 snip 8<



: It worked fine as far as I can tell except for hitting the fish (with random bonus exp). It two fishes die at the same time, then I will have trouble. So I decided the fish is NOT hittable by this magic. :p



Sounds good. That the most graceful script, but sometime when you have to force it to do just waht you want it gets messy. :)