The Dink Network

Idea: Creating scripts that are extremely versatile

March 12th 2003, 09:18 AM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I've been doing some thinking, and maybe this is common sense... but I've thought of a way to make one single script behave appropriately in innumerable situations.

Ok, that's a kinda crappy summary. Here is a simple example:

Imagine that you have a basic pillbug script that you've made (or copied from the original game). So you place a few weak pillbugs around the start of the game, and everything is good.

Now imagine you want to build some super-pillbugs, (that are more challenging). Now, the normal way to do this would be to edit your original pillbug script, make some changes, and then save the script as something like en-pill5.c or whatever.

That works fine. But imagine you want to have like 20 different pillbug strengths. Or 50. Or 100. It just doesn't make sense to create 100 different pillbug scripts, wasting space and all.

So... this is what I suggest. In DE or WDE, decide that one of the sprite properties will represent, say, the Pillbug's level (where Level 0 is easy, Level 100 is hard). I'll use Speed as an example. Then give it a script like this:

//Multi-Level Pillbug
//en-pill.c

void main(void)
{
int &my_level = sp_speed(&current_sprite,-1);
int &my_temp = 0;

//Negative values are bad
if (&my_level < 0)
{
&my_level = 0;
}

//Set the non-changing attributes
sp_speed(&current_sprite,1);
sp_brain(&current_sprite,9);
sp_base_walk(&current_sprite,130);
sp_base_death(&current_sprite,140);

//Set the level-dependent attributes
//The hitpoints = 3*LVL + 8
&my_temp = &my_level;
&my_temp * 3;
&my_temp + 8;
sp_hitpoints(&current_sprite, &my_temp);

//The touch damage = LVL + 1
&my_temp = &my_level;
&my_temp += 1;
sp_touch_damage(&current_sprite, &my_temp);

//The experience = LVL * 5
&my_temp = &my_level;
&my_temp * 5;
sp_exp(&current_sprite, &my_temp);
}

//Blah, other procedures here

And that's all there is to it. Just give a pillbug a Speed of 45 in WDE or DE, and its a super-pillbug with 143 HP, 46 Damage (probably a bit much, hehe), and 225 Experience.

This technique could also be used for non-enemy sprites, but things that are similar and used a lot that need a script. Like Blocker scripts (that Dink runs into but can't pass). Just decide that the Speed is the direction the blocker script should move Dink, and say the Hitpoints is the x/y value Dink should be moved to, and you've made one super-functional script that can be used as many times as you want, without creating a brand new script each time.

Like I said in the beginning, this could be common sense and could be in use for decades, but I just realized the potential.
March 12th 2003, 09:26 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
I've been using it for ages
March 12th 2003, 10:41 AM
pig.gif


........
March 12th 2003, 11:09 AM
custom_fish.png
SabreTrout
Noble He/Him United Kingdom
Tigertigertiger. 
Pretty cool stuff Redink.
March 12th 2003, 07:07 PM
wizard.gif
Chrispy
Peasant He/Him Canada
I'm a man, but I can change, if I have to.I guess. 
Its also a good idea to have a base value, for a def/atk/magic/hitpoints stat, and just add a percentage of dink's to it... That way you can never have an too easy boss or you can make it so that you need lower stats in the start (say, if you have a base valuse of 1 and add 115% of dink's, that suckers not gonna go down if you cheat..)
You could also factor in dinks level to confirm large stats, but then it gets complicated.
March 14th 2003, 09:55 PM
wizardg.gif
Paul
Peasant He/Him United States
 
I think that's a pretty good idea, only I can't imagine too many d-mods using 50 levels a pillbug, but yeah.
March 15th 2003, 11:13 AM
spike.gif
That's a good idea. Only bad thing is that when you place dozens of foes on several screens, and forget to change the speed, it's kinda annoying deleting and re-adding them.
That's why I more like making many scripts..
March 15th 2003, 01:19 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
Or just use Sprite Replacer, and change all of their Speeds in like 15 seconds
March 22nd 2003, 03:17 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
If you have like 5 different versatile pillbugs on the same screen, and each with a different level, it will not work. All of the attributes for the pillbugs will be the same as one of the pillbugs (probably the one with the lowest/highest editor number, I haven't checked yet).

So you can only have homogenous-level pillbugs on the same screen. You could mix-and-match like a Level 4 Pillbug and a Level 10 Bonca with no problem, though.
March 23rd 2003, 12:22 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Well, I used it for things like gold or hurt. My vargold script gives dink an amount of gold equal to the pile's defence!
March 23rd 2003, 09:28 PM
custom_odd.gif
I must say, well thought out.

I only have a few randomizers to change up the stats a little, so combining that with a level would lead to really diverse monsters.
March 30th 2003, 08:04 AM
pq_frog.gif
Ric
Peasant They/Them Canada
 
Here is one I attach to a pebble or blade of grass.
void main ()
{
if(&level == 1) { preload_seq(131); sp_seq(&current_sprite,131); sp_script(&current_sprite,"en-pill"); }
if(&level == 2) { sp_seq(&current_sprite,651); sp_script(&current_sprite,"en-slim"); }
if(&level == 3) { sp_seq(&current_sprite,537); sp_script(&current_sprite,"en-bonc"); }
if(&level == 4) { sp_seq(&current_sprite,133); sp_script(&current_sprite,"en-pill2");
}
if(&level > 4) { sp_seq(&current_sprite,609); sp_script(&current_sprite,"en-bong");
}
}

works like a charm
(without that "amp" in there. What's with that anyway??)