The Dink Network

My D-mod questions

June 3rd 2010, 05:27 AM
boncap.gif
Killersong96
Peasant He/Him Turkey
A horse! A horse! My banana for a horse! 
How can I make a sprite walk on direction that I choose?
June 3rd 2010, 05:50 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
You use the move(); command for this:
move(<sprite>,<direction>,<destination>,<nohard> );


The <sprite> is the number of the sprite you want to move. The most common are 1 (Dink) and &current_sprite which is the sprite the script is attached to.
The <direction> is the direction you want the sprite to move (2 is down, 4 is left, 6 is right and 8 is up)
The <destination> is the final x or y coordinate (x if using direction 4 or 6 and y if using 2 or 8)
<nohard> is wether or not the sprite ignores hardness, you usually put this to a value of 1.

So making the current sprite move from x=100, y=100 to x=200, y=100 would look something like this:

move(&current_sprite,6,200,1);

June 3rd 2010, 05:53 AM
boncap.gif
Killersong96
Peasant He/Him Turkey
A horse! A horse! My banana for a horse! 
I mean can I walk the sprite first left then down then right?
June 3rd 2010, 06:11 AM
dinkdead.gif
Use move_stop.

move_stop(&current_sprite, 4, xxx, 1);
move_stop(&current_sprite, 2, yyy, 1);
move_stop(&current_sprite, 6, xxx, 1);
//etc etc


Something_stop basically means the script will not carry on until that line has completed, so move here then move here then move here.

move(&current_sprite, 4, xxx, 1);
move(&current_sprite, 2, yyy, 1);
move(&current_sprite, 6, xxx, 1);
//This would probably only run the last line.


Edit: Heh, posted at the same time.
June 3rd 2010, 06:11 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Sure, you'll probably need to use move_stop() instead of move. That will make sure your script doesn't continue until the movement has been completed. For example I can move a sprite from (x=200,y=100) to (x=100,y=100) then to (x=100,y=200) and finally to (x=200,y=200). (That would be left, down, right)

move_stop(&current_sprite,4,100,1);
move_stop(&current_sprite,2,200,1);
move_stop(&current_sprite,6,200,1);


EDIT: AAARRGGHHH!! SPARRROWWW!!
June 3rd 2010, 07:42 AM
boncap.gif
Killersong96
Peasant He/Him Turkey
A horse! A horse! My banana for a horse! 
metatarasal(sorry may I spelled it wrong) your guide is really helping me. Thanks you too sparrow your post was the first one I saw
June 3rd 2010, 08:23 AM
boncap.gif
Killersong96
Peasant He/Him Turkey
A horse! A horse! My banana for a horse! 
Another question: On your guide you say that bonca and pillbug but I want to make an blue knight as an enemy how can I do that?
June 3rd 2010, 08:47 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Well, essentially a blue knight is like a bonca. You can use the same type of script to make a knight. There's a couple of things you need to change:

- sp_base_walk()
- sp_base_death()
- sp_base_attack()

Also you can probably remove (or change) the preload(); commands and change things like sp_distance() or the sound it makes once hit, but essentially it's the three I mentioned you'll need to change to the ones for the blue knight. You'll probably need a sp_base_death(&current_sprite,0); Other than that I don't know the proper values, but you can look them up in (Win)DinkEdit.
June 3rd 2010, 11:52 AM
boncap.gif
Killersong96
Peasant He/Him Turkey
A horse! A horse! My banana for a horse! 
Another question: How can I make a guard appears when you hit someone and guard must be an enemy.
June 3rd 2010, 12:44 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
You need to process that in the hit procedure of the person you want to get hit. So if that would be random man 1 his script would contain:

void hit (void)
{
int &guard = create_sprite(x, y, 9, seq, 1);
sp_script(&guard, "en-guard");
}


And then inside the en-guard script you would set its properties such as base_walk, target, strength, ... Hope that helps