The Dink Network

Kerrek's Development Thread (Questions included)

July 22nd 2012, 08:51 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
So far I've got this, a new bland UI and some poses of Master Chief.

And some questions:

Are there tutorials on how to add a magic spell into the game?

Is there any way to make it so a sound plays after or during a magic item charging?

Is there any way to make a magic item recharge after a set number of shots, (Let's say, 4, and after the four shots from a fireball it recharges)

How do you set the speed of a projectile set by a magic item like a fireball
July 22nd 2012, 09:44 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
1) I think RobJ has some, and I know that the Introduction to D-Mod Making has at least touches on it.

2) Hmm...off the top of my head, I would say spawn a script like this in the use() of your spells:

//charging.c
void main(void)
{
loop:
wait(1);

int &max = &magic_cost;
int &cur = &magic_level;
if(&cur < &max)
{
goto loop;
}

if(&cur >= &max)
{
    if(&once < 1)
    {
	&cur = &max;
    playsound();
    }

}
kill_this_task();
}



You could also rig up something with a variable and spawn that to run all the time, but it seems like it would just be easier to put spawn("charging"); in the use() of your spells.

3) You would need a global variable for the number, let's say &shots. What actually starts the recharge is the line in the spell's use that sets &magic_level to 0. &magic_level is how full the bar is, out of &magic_cost. At the beginning of use() put:
&shots += 1;


And around &magic_level = 0; put:

if(&shots == 4)
{
&magic_level = 0;
&shots = 0;
}


That will make it recharge only when the fourth shot is fired, and reset the number of shots to 0.

4) It's actually sp_mx and sp_my, which is how many pixels the sprite travels in a set amount of time. There's a section on it in the DinkC Reference. Basically increase the numbers to go faster, decrease to go slower (inverse if you're going left or up, since those are negative numbers I suppose).
July 22nd 2012, 09:47 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Thank you so much. This'll really help.
July 22nd 2012, 09:52 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
No problem. I was kind of rushed writing it so if something doesn't work right just tell me.
July 22nd 2012, 09:56 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
If this does work right I will have a sniper rifle ready,

Also, I can't seem to find a tutorial on how to script a magic spell. I've been searching Robj's tutorials, but I can't find one.
July 22nd 2012, 10:12 PM
pillbug.gif
pillbug
Peasant He/Him United States
Love! True love! 
What kind of spell are you trying to make/add? A projectile, I'm assuming? You can copy most of the script from "item-fb", since it's the standard fireball spell. You add them the same you add items, except with add_magic instead of add_item. Example:

add_magic("item-fb",437,1);


July 22nd 2012, 10:14 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Oh,

Thanks a lot.
July 22nd 2012, 11:39 PM
knight.gif
KrisKnox
Peasant He/Him United States
The site's resident Therian (Dire Wolf, Dragon) 
*looking at the previous topic.*

Holy crap, Kerrek. This is amazing.
July 23rd 2012, 07:19 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Eh, thanks.

To be honest it isn't that difficult as just adding simple bones to a model and moving them with keyframes from all 4 angles.

Anyways while Blender is being difficult I'm going to see to adding tiles to make the game more interesting.
July 23rd 2012, 09:03 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Another question.

I got tiles in the game easily, but when I try putting a Sprite in, it doesn't appear in the Sprite Library.

I follow Robj's tutorial on adding graphics but it just won't appear. I can't get any farther because of it.

Help will be appreciated.
July 23rd 2012, 09:39 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Post your load_sequence line here for us to look at
July 23rd 2012, 09:41 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
It's not finished so I can't really show it.

I got up to the part where the sprite shows in the library so:

load_sequence_now GRAPHICS\NEWWALLS\WALL 100 77


I made it case-sensitive instead.

And everything is correct in the path, I checked.
July 23rd 2012, 09:48 AM
spike.gif
What are the .bmp files called? For that path to work, they should be named

wall01.bmp
wall02.bmp
wall03.bmp, etc.
July 23rd 2012, 09:54 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
They're called

WALL1.BMP through WALL8.BMP

I'll see if adding zeros helps, I'm srs.

Ok... did that and now it says "Out of memory" when I go to sprite mode and i Have to use task manager to close it.

I think I broke it.

EDIT: Huh... made it lowercase and it went back to just not being there, the sprite library works.

Weird.

July 23rd 2012, 11:14 AM
wizardg.gif
Paul
Peasant He/Him United States
 
When you say "Sprite Library", are you talking about the sidebar thing in WinDinkedit, or the actual graphics that appear when you press E?
July 23rd 2012, 11:17 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
The latter.
July 23rd 2012, 11:26 AM
wizardg.gif
Paul
Peasant He/Him United States
 
Okay, hmm. You definitely need the zeros, case shoudln't matter. Not sure what might be causing the out of memory thing, unless the graphics are actually that gigantic. I always found sprite mode a little unstable in WinDinkedit though.
July 23rd 2012, 11:33 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
They're just 100X110 sprites of walls..

Not sure waht could be wrong.
July 23rd 2012, 11:38 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Try seeing if they show up in the regular DinkEdit or another version of WDE. Or, if you feel up to it, share one of the walls with us so we can try it out on our end
July 23rd 2012, 11:44 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Windinkedit doesn't show either.

I'm not sure what I'm doing wrong.

EDIT: Whenever I'm sure I'm doing it right it says "out of memory"
July 23rd 2012, 12:12 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
It could be that you've used too many set_sprite_info lines. If you have a large number of those the game gets mad. If you have a sprite with duplicate set_sprite_info lines, try deleting the ones that have been overridden.
July 23rd 2012, 12:16 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Good idea. I'll look into that.

EDIT: I didn't add any to Dink.ini, and I only added one load_sequence_now.

I deleted four with no change.
July 23rd 2012, 01:26 PM
dinkdead.gif
Not sure about the "out of memory" message, but check the bit depth of your sprites. If they're 32 bit (as is often the default by some image editors) they won't show up in Dink. Try changing them to 24 bit, or as low as possible (8 bit = non-truecolour).
July 23rd 2012, 01:29 PM
pillbug.gif
Pillbug
Peasant He/Him United States
Love! True love! 
Ah, yeah, that happened to me with some of my new graphics. Do what Sparrow said.
July 23rd 2012, 01:54 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Thanks for the help guys. I mean it.

I just resaved them as 8-bit files with the least dithering possible to give them the good ol' Dink look.
Now they appear.
July 23rd 2012, 03:10 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Note that DinkHD does support the 32-bit BMP format with transparency intact, but you won't be able to use the editor to place the stuff So it's really only useful for stuff that's created in scripts.
July 23rd 2012, 08:31 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ok this question is for the experienced Blender users, if there are any on this forum.

My blender version is 2.63 if i'm correct, the latest version.

It comes with Rigify, a rigging system, and it's supposed to have a rig called "Humanoid Meta-Rig", but for some reason I don't have it.

For those that don't know. The Humanoid Meta-rig is a bunch of bones configured to the human body, including fingers and all, and I'm sick of rerigging all of that crap.

Thanks for the help.
July 24th 2012, 05:31 AM
knightgl.gif
zeddexx
Peasant He/Him New Zealand
I'm pretty sure I'm worth atleast SIX goats... 
Btw Kerrek.

You are just pure awesomeness.
July 24th 2012, 07:15 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
You need to go to preferences ---> addons and then activate rigify
July 24th 2012, 09:51 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Thanks Zed.

@Iplaydink, It's aleady activated, -shrug-

I think I read something about it not being compatatible so they got rid of it. For the newest version.

Thanks for the suggestion, though.

I also found some .blend files with a rig in them that is good enough, but when I export them it's fine, and nothing happens when I import them,

I checked the duplication and it's set to none so Idk what's going on.
July 24th 2012, 01:34 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Also, is there any way to make an item fire continuously, like if you hold down ctrl? Is there also a way to set the time between the continuous shots, like let's say I want .3 seconds between each shot, is there a way to script that?
July 24th 2012, 01:40 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Press & Hold is not supported. You can build in a cooldown if you wanted to though.

EDIT: I should elaborate on how

You can store the current time in a variable when you press the attack key and then when it is pressed again check if enough time has passed since last keypress
July 24th 2012, 01:45 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ah.

Thanks for the info.
July 24th 2012, 03:26 PM
dinkdead.gif
You can do it if you make the attack a magic spell... press and hold works with shift, you just need to play with the magic cost/level to get the timing right.
July 24th 2012, 03:36 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ah.

All this won't matter if I can't get my darn sniper rifle rig working.

My problem: I added a bone to the hand the length of the sniper rifle, and whenever I move it in pose mode it drags along part of the foot, stretching it for no reason.

I dun' get it.
July 24th 2012, 03:58 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Does it really work with spells? I seem to recall reading somewhere that it didn't. Oh well.
July 24th 2012, 06:11 PM
wizardg.gif
Paul
Peasant He/Him United States
 
Dem bones, dem bones, foot bone's connected the rifle bone?

Does it really work with spells? I seem to recall reading somewhere that it didn't. Oh well.

Yeah, it does. It will continually call use() for spell as long as shift is held down, &magic_level >= &magic_cost and Dink is not frozen. You can see this even in the original game with fireball if Dink has alot of &magic.

But an interesting aspect of how it works is that if use() contains a wait command, and all of the above is still true when it executes, the script will interrupt itself and nothing below the wait will run. And so, with a little creativity, you can actually test when shift is released.
July 24th 2012, 11:14 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ya, hitting shift to shoot.

Anyways, I redid the rig and it works fine now.

I need a weapon.
July 24th 2012, 11:46 PM
knight.gif
KrisKnox
Peasant He/Him United States
The site's resident Therian (Dire Wolf, Dragon) 
Very good weapon
July 25th 2012, 08:09 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Heh, thanks

Also, one more question:

How would I set the magic spell to cast earlier in the animation for it? Like, you know Fireball takes 4 frames to actually shoot, can I shorten that to two?

Thanks/

July 25th 2012, 11:18 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
I just realized, I have no idea where to put the scripts, do I put them in Dink.ini, or something like that?
July 25th 2012, 11:24 AM
spike.gif
As in, Dink C scripts?

Those go in the story folder. They also need to be called C files, so if your script is named e.g. "halodude.txt", you need to rename that to "halodude.c".
July 25th 2012, 11:30 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ah.

Currently animating some banana projectile to make it into a sniper rifle.
July 25th 2012, 11:30 AM
wizardg.gif
Paul
Peasant He/Him United States
 
No offense, but haven't you looked an existing d-mod at all? This will all make alot more sense after you poke around a working example a bit.
July 25th 2012, 11:31 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
I have, but not much.
July 25th 2012, 11:34 AM
wizardg.gif
Paul
Peasant He/Him United States
 
Well, I recommend it. Not that we mind answering questions, but IMHO taking something apart is the best way to learn how to put it together.
July 25th 2012, 11:36 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
That's what i'm doing right now.
July 25th 2012, 12:14 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
"My problem: I added a bone to the hand the length of the sniper rifle, and whenever I move it in pose mode it drags along part of the foot, stretching it for no reason."

If you enter weight paint mode you can see which bones control which part of the mesh, and also edit that manually... just so you know for next time
July 25th 2012, 12:22 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ah, thank you.

I learn so much from you guys. You're really helpful.
July 25th 2012, 01:43 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Apologies, but I couldn't find anything on this on the site.

Whenever I put a midi in the game, in-game it slows down, I'm not sure why,
July 25th 2012, 01:53 PM
pillbug.gif
pillbug
Peasant He/Him United States
Love! True love! 
Are you using playmidi(), or just attaching it to the screen? Does the entire game slow down (get laggy) or is it just the MIDI?
July 25th 2012, 01:55 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
I'm using playmidi()

And it's just the midi.
July 25th 2012, 03:16 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
This sounds like a problem with your sound driver/OS/computer/game combination :/
July 25th 2012, 03:26 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Huh?

It only happens with this dmod though.
July 25th 2012, 03:50 PM
pq_knight.gif
ExDeathEvn
Peasant He/Him New Zealand rumble
"Skinny Legend" 
Could just be the machine, or something else you've put in your Dmod that makes changing the midi's take a lower priority. Some downloaded midi's also have a pause at the start of the .mid file before the tune actually starts, thats also possible.
If you've finished your mesh and added pictures of it to your Dmod as a sprite or something, for example, you need to maake sure the graphics are in the Dink pallet. Unless you want to restrict users to Truecolor mode.
July 25th 2012, 06:35 PM
wizardg.gif
Paul
Peasant He/Him United States
 
That's mighty odd. Does it only do that with MIDIs you add, or would it happen with one from the original game too? For example: playmidi("bullythe.mid");
July 25th 2012, 06:43 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Bullythe goes fine, and another midi I added works fine. It's odd.
July 25th 2012, 11:12 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
For the faff of me I cannot find out how to make it so Dink starts with the spell.

I've been examining for hours and i cannot figure it out.
July 25th 2012, 11:18 PM
wizardg.gif
leprochaun
Peasant He/Him Japan bloop
Responsible for making things not look like ass 
You'd put an add protocol in the start-1 script. At least that's what makes sense.
July 26th 2012, 12:37 AM
wizardg.gif
Paul
Peasant He/Him United States
 
Yep, that's the usual place to set up Dink's stats and equipment. But just to clarify, "start-1" is the traditional name for the script on the "Start" or "New Game" button on the title screen, though you could actually name it something else if you wanted.
July 26th 2012, 08:38 AM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Ah.

I managed to get a blue outline in the Magic menu that i cannot select. That's it.
July 26th 2012, 12:42 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Gettin music done is fun.

So far I have about... 12 midis done.
July 26th 2012, 12:45 PM
wizardg.gif
Paul
Peasant He/Him United States
 
So... You wanna show us what command you're using to add the spell?

Come to think of it, unless you've changed something around, a blue outline normally means a spell already is selected.
July 26th 2012, 03:07 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
//lets give him fists to start out with, and arm him with the fists.
    add_item("item-fst",438, 1);
    add_item("item"snp",437, 6);
    &cur_weapon = 1;
     arm_weapon();


That's the command.

-shrug-
July 26th 2012, 03:47 PM
wizardg.gif
Paul
Peasant He/Him United States
 
Well, it looks like you've got a quotation mark in the item name, that's definitely not cool. But also, if you're trying to add a spell, you should use add_magic instead of add_item. Finally, the standard sequence 437 doesn't not have a frame 6. Of course if you have added one (correctly) that's not a problem, but for testing purposes, you might want to use frame 3, which should be a lightning bolt.
July 26th 2012, 03:53 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Yeah, i added a frame to it.

I'll see to getting rid of the quotation. Lol I feel stupid for not noticing that.

I'll fix the magic too.
July 26th 2012, 04:23 PM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Oh, did you figure out how to render dink-shadows directly in blender?
If not, check out my file "Avoca", it includes a .blend file where it is explained
July 26th 2012, 04:25 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
I just edited the original shadows a little bit. I'll definetly check yours out
July 26th 2012, 06:26 PM
fairy.gif
Kerrek
Peasant He/Him United States
oao 
Currently installing student Autodesk 3ds max 2013 'cause I'm a student.