My D-mod questions
How can I make a sprite walk on direction that I choose?
You use the move(); command for this:
The <sprite> is the number of the sprite you want to move. The most common are 1 (Dink) and ¤t_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(<sprite>,<direction>,<destination>,<nohard> );
The <sprite> is the number of the sprite you want to move. The most common are 1 (Dink) and ¤t_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(¤t_sprite,6,200,1);
I mean can I walk the sprite first left then down then right?
Use move_stop.
Something_stop basically means the script will not carry on until that line has completed, so move here then move here then move here.
Edit: Heh, posted at the same time.
move_stop(¤t_sprite, 4, xxx, 1); move_stop(¤t_sprite, 2, yyy, 1); move_stop(¤t_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(¤t_sprite, 4, xxx, 1); move(¤t_sprite, 2, yyy, 1); move(¤t_sprite, 6, xxx, 1); //This would probably only run the last line.
Edit: Heh, posted at the same time.
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)
EDIT: AAARRGGHHH!! SPARRROWWW!!
move_stop(¤t_sprite,4,100,1); move_stop(¤t_sprite,2,200,1); move_stop(¤t_sprite,6,200,1);
EDIT: AAARRGGHHH!! SPARRROWWW!!
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
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?
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(¤t_sprite,0); Other than that I don't know the proper values, but you can look them up in (Win)DinkEdit.
- 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(¤t_sprite,0); Other than that I don't know the proper values, but you can look them up in (Win)DinkEdit.
Another question: How can I make a guard appears when you hit someone and guard must be an enemy.
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:
And then inside the en-guard script you would set its properties such as base_walk, target, strength, ... Hope that helps
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