The Dink Network

Reply to Re: New Dmod: Adventurer's Adventure

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 9th 2024, 01:00 AM
custom_robj.png
Robj
Jester He/Him Australia
You feed the madness, and it feeds on you. 
For the above thing of detecting if the bomb was used but didn't hit the rock, you could just get the rock to set a variable, or sp_custom value on the bomb explosion sprite itself if the rock is hit, and then in the dam-bomn script check for that value and if it isn't set, it missed.

so in the rock script add the sp_custom line as the first line in the procedure, here's the full proc again:

void hit(void)
{
	int &rcrap = compare_sprite_script(&missle_source, "dam-bomn");
	if (&rcrap == 1)
	{
	 sp_custom("bomb_hit", &missle_source, 1);
	
		&mine_rock = 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);
		}

		script_attach(1000);
		progress();
	}
	kill_this_task();
}


And the new dam-bomn damage proc:
//Bomb noise

void damage (void)
{
 playsound(6, 32050, 0,0,0);
 
 &save_x = sp_custom("bomb_hit", &current_sprite, -1);
 if (&save_x < 1)
 {
  //make it so this only runs once
  sp_custom("bomb_hit", &current_sprite, 2);
  
  //spawn the script that will handle the rest so the damage proc running again doesn't interrupt
  spawn("b-no-hit");
 }
}


And then the spawned b-no-hit script, which is the script that will do what you want to happen when the bomb was used anywhere other than the rock, example:
void main(void)
{
 int &mag = get_sprite_with_this_brain(16, 1);
 freeze(&mag);
 freeze(1);
 sp_dir(&mag, 6); 
 say_stop("`1WOW DINK YOU HAD ONE JOB!", &mag);
 wait(200);
 say_stop("Alright well I guess your stuck there, bye, I'm out", 1);
 unfreeze(&mag);
 unfreeze(1);
 kill_this_task();
}