The Dink Network

Splitting pillbug boss.

April 11th 2012, 03:55 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
as you probably read i have an idea for a pillbug that splits up as a boss. however fooling around with the premade pillbug scripts didn't get me that much farther. so i'll pos the cooked up script sofar(only minor edits)

//pillbug brain

void main( void )
{
screenlock(1);
sp_brain(¤t_sprite, 9);
sp_speed(¤t_sprite, 2);
sp_nohit(¤t_sprite, 0);
sp_exp(¤t_sprite, 5);
sp_base_walk(¤t_sprite, 130);
sp_base_death(¤t_sprite, 140);
sp_touch_damage(¤t_sprite, 3);
sp_hitpoints(¤t_sprite, 10);
sp_defense(¤t_sprite,99999);
preload_seq(131);
preload_seq(133);
preload_seq(141);
preload_seq(143);

if (random(2,1) == 1)
 {
 sp_target(¤t_sprite, 1);
 }
}

void hit( void )
{
sp_target(¤t_sprite, &enemy_sprite);
playsound(30, 17050, 4000, ¤t_sprite, 0);
//lock on to the guy who just hit us
//playsound
}
void die( void )
{

if (get_sprite_with_this_brain(9, ¤t_sprite) == 0)
 {
  //no more brain 9 monsters here, lets unlock the screen

  screenlock(0);
  playsound(43, 22050,0,0,0);

  int &hold = sp_editor_num(¤t_sprite);
  if (&hold != 0)
  editor_type(&hold, 6); 

&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);

 external("emake","boss");

}
}


now my idea was if possible i want after he's hit and damaged i want him(and his partners after made) to split up in 2 and those partners sharing the HP which is left over from the initial hitted bug. this also is why though has insane defense it's exp given is so low as that is for each individual part and since he splits there will be many of those parts to give that exp which would still result in tons of exp.

I decided not to remove the respawn code because i want the boss to be rebattleable(and since it has insane defenses he'll always stay as challenging as he is and might consider using counter based touch damage instaid of the preset touch damage as the test script is.

and as you can probably see i will give bosses a separate drop table and he is only allowed to do so if he and his split partners are dead just haven't decided what to put in there yet though but will be better than any reward plain old foes can give.

dunno if it is possible to do with a single script but i do know the concept is possible(thanks to those splitting blob enemies that are present in some mods) but i don't like the idea of needing a script per HP taken off and if it can be done in 1 script it is much more efficient.

I did manage to add it so he did split but only with his HP at max resulting in an endless stream of insane defense having pillbugs is not how i want the battle to be so i removed the piece of coding instaid of commenting it out.

Edot: Dunno why but for some reason the Code tags keep replacing "&current_sprite" with "¤t_sprite"
April 11th 2012, 04:53 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
So, do you want each pillbug that splits to also be splittable further?
April 11th 2012, 05:32 AM
custom_msdink.png
MsDink
Peasant She/Her New Zealand
Tag - Umm.. tag, you're it? 
it only does that when you edit your masterpiece merder (the &current_sprite thing ) fix it post and no editing
April 11th 2012, 07:25 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
So, do you want each pillbug that splits to also be splittable further?

yes that i want too because if it does not do that it is only a feww buff pillbugs not worthy of the boss tag.
and since i want it to be able to do that till all HP is depleted it still can only split a certain amount of times but since it'll split up quite a few times before it does it can be quite the deadly foe especially since all would be buff pillbugs.

it only does that when you edit your masterpiece merder (the &current_sprite thing ) fix it post and no editing

I see well that sucks since i had some typo's that changed the context of the non code part so had to edit it(that only happened due to lack of preview option). but it old it happened s they know what it really says insted of the FFing change in text that happened for some annoying reason
April 11th 2012, 07:30 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Okay, so this is fairly easy to accomplish.

First of all, in the hit() procedure you will place an external() that will run a different script. We will call this script the "splitter". What it does is create two new pillbugs with half the health of the original. Note that you can still use current_sprite in external scripts, so getting the max health of the original and dividing it by two should not be a problem.
1) Put max health of boss pillbug in variable
2) Create two new pillbugs at the location of the original
3) Give the new pillbugs half the health of the original
4) Attach the same pillbug script to it
5) Kill the original sprite

This will keep them splitting like you want, but there is a problem. This cycle will never end, because you have to hit a sprite to kill it. This means that even when the last pillbugs remain with 1 max health, they will still split when you hit and kill them. The solution is to place a condition before the splitting which checks the max health of the sprite and if it is equal to 1, you don't replicate it and it will die

Hope this makes sense.
April 11th 2012, 08:25 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
If I remember correctly (which I probably don't), Cloud Castle 2 had splitting Slimes. Maybe you could look help from their script?
April 11th 2012, 11:05 AM
wizardg.gif
Paul
Peasant He/Him United States
 
A couple suggestion:
You probably want to do a check for how many scripts are running, as seen in the original alktree script before splitting. Hopefully that won't get in the way, but things may go weird if more then 100 or so copies exist at once so it's better to be safe.

And this is just an idea, but instead of giving 5 exp for each bug, you could give them zero exp but award a bunch of exp with add_exp when the last one is killed. That way the total exp-value of the boss would be consistent. But I can see the appeal of the other way too.
April 11th 2012, 11:47 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
OK thanks will do the suggestions and hope it works as planned. if unnecessary will not do divided health(but if needed will do the math so that it still splits as often as needed.

also on the EXP given: since all bugs have crazy defense(more than the player probably gets without cheating) still is consistent and makes it less work if i decide to make a splitting pillbug with more HP.
April 11th 2012, 11:58 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
If you can't make it work, I'll see what I can do But definitely check out some of the other d-mods with splitting slimes that you've talked about. Learning from existing scripts is the shortcut to success.
April 11th 2012, 12:14 PM
wizardg.gif
Paul
Peasant He/Him United States
 
All the splitting slimes I recall split when they died, so I'm not sure how applicable those scripts will be.
April 11th 2012, 02:40 PM
pillbug.gif
pillbug
Peasant He/Him United States
Love! True love! 
I'm not sure if they split in PQ, but this is the void die() of the green blob that splits into two blue blobs from Cast Awakening: Initiation. Changing it to work when you hit the pillbug shouldn't be too difficult.

void die(void)
{
  &save_x = sp_editor_num(&current_sprite);
  if (&save_x != 0) editor_type(&save_x, 7);
  
  &save_x = sp_x(&current_sprite, -1);
  &save_y = sp_y(&current_sprite, -1);
  
  int &temp = create_sprite(&save_x,&save_y,9,861,1);
  sp_dir(&temp,1);
  sp_script(&temp,"en-blob1");
  &temp = create_sprite(&save_x,&save_y,9,861,1);
  sp_dir(&temp,3);
  sp_script(&temp,"en-blob1");
  &temp = create_sprite(&save_x,&save_y,9,861,1);
  sp_dir(&temp,7);
  sp_script(&temp,"en-blob1");
  &temp = create_sprite(&save_x,&save_y,9,861,1);
  sp_dir(&temp,9);
  sp_script(&temp,"en-blob1");
  
  external("emake","medium");
}


So it creates new sprites with new scripts where it died.
April 12th 2012, 10:59 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
All the splitting slimes I recall split when they died, so I'm not sure how applicable those scripts will be.

Die and hit are different procedures so just means the location needs to change and probably need to add a counter to transfer left over hp. but i think i can make it work

and thansks Pill that;ll help even if some code needs to be added but that i can handle that.
April 17th 2012, 02:42 PM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
Ive finished the boss and he works and dang is he though . so if you wanna challange him now just place this script in your game and enjoy

//pillbug brain

void main( void )
{
int &crap;
screenlock(1);
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 2);
sp_nohit(&current_sprite, 0);
sp_exp(&current_sprite, 5);
sp_base_walk(&current_sprite, 130);
sp_base_death(&current_sprite, 140);
sp_touch_damage(&current_sprite, 3);
sp_hitpoints(&current_sprite, 10);
Sp_defense(&current_sprite, 2);
preload_seq(131);
preload_seq(133);
preload_seq(141);
preload_seq(143);

if (random(2,1) == 1)
 {
 sp_target(&current_sprite, 1);
 }
}

void hit( void )
{
sp_target(&current_sprite, &enemy_sprite);
playsound(30, 17050, 4000, &current_sprite, 0);
//lock on to the guy who just hit us
//playsound
         &crap = scripts_used();
if (&crap > 101)
  {
  //don't make any more bugs, there are 100 already on the screen..)
  return;
  }

  wait(1);
  &save_x = sp_x(&current_sprite, -1);

  &save_y = sp_y(&current_sprite, -1);

  int &temp = create_sprite(&save_x,&save_y,9,131,1);

  sp_dir(&temp,1);

  sp_script(&temp,"boss-splitbug");

  int &hp_transfer = sp_hitpoints(&current_sprite, -1); 
  sp_hitpoints(&temp, &hp_transfer);
  sp_speed(&temp, 2)
}
void die( void )
{

if (get_sprite_with_this_brain(9, &current_sprite) == 0)
 {
  //no more brain 9 monsters here, lets unlock the screen

  screenlock(0);
  playsound(43, 22050,0,0,0);

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

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);

 external("emake","boss");

}
}


had to place the splitting code in its own script and not an external one(since than the original bug script stopped) but it works and hope you enjo thiss though battle(see touch damage foes can be a challenge )

edit: had to reduce it's defense in order for the engine being able to handle him oh well he still is a challenge and requires luck but trust me on any defense this guy can decimate you also note that the finalized version will have counter based defense so that nomatter how trained you are he is a challenge(and will go the extra mile and see if you have any swords in your pack but via a global counter so that the game works smoother and not that every individual bug doesn't have to do that math)
April 18th 2012, 10:08 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Sounds good Merder! Grats on getting it working Not gonna try it just like this though, will wait for your d-mod^^