The Dink Network

Reply to Re: Pig farming

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
October 31st 2012, 10:16 AM
anon.gif
shevek
Ghost They/Them
 
Well, it's clear to me now that a sack of pig feed cannot be turned into a lethal weapon, as for it's animation when used, it's far to complicated for me to understand yet, so some copy-paste action will do it.

If you want Dink to whack the sack on the opponent's head, then you need to draw an animation for that, indeed. If you want to use the normal feeding animation as a weapon ("look! I'm throwing acidic/radioactive/whatever stuff on you!") that should work without much trouble. Still, I think your approach to first get the rest working is very sensible.

I need to drop some pig food on an object (which is in one part of the screen) and start converation that way. How it is done?

First hint: this happens at the start of the original game. You can check how it's done there.

The pig food is treated as a weapon by the engine. When press ctrl when it is armed, the "use" function from its script gets executed. You can create a feeding animation for it and create the feeding sprite. If you really want to use it as a weapon, this sprite can have a missile brain, which means it can hit things (with speed 0 it will not move like an actual missile). In fact, you should use the brain I call "flare", which is a missile which runs only one animation sequence.

However, it's more easy to just see if Dink is standing at the right spot while feeding, and if so, consider the thing "hit". In that case, you don't need to create a missile.

Speaking about conversations, how can I, for example, make two sprites speak with Dink (three man conversation)?

All the say_* functions have as their second argument the sprite which does the talking. You can put a number there, which should always be 1 (because the other numbers you don't know beforehand). 1 is Dink. You can also put a variable there, such as &hold or &crap (which is used a lot in the original source, but you can use any name you like). First you assign a number to the variable, then you can use it in places like say_stop (but also all the sp_* functions).

In principle, the editor knows which numbers belong to which sprites, but I haven't ever seen a dmod use that information (with my editor, you would let the editor use it, those interested can see the source of Karel ende Elegast, for example bedroom.c). What people do, is to use global variables. Make sure you have them defined in main.c, then assign a value to them in the sprite's main() function:
void main()
{
&girl = &current_sprite;
}


Then the global variable &girl contains the sprite number of the sprite that started the script. Then you can use a command like:
say_stop("Dink! I hate you!", &girl);

to make the girl say something. This works from other sprites as well (because &girl is global, its new value is known by all scripts). Using &current_sprite directly wouldn't work, because it has a different value for a different script.

A conversation is simple several sprites saying things in turn. Often, the conversation is started from one sprite's script and the other person is Dink. In that case, things are simple, because both sprite numbers are known (&current_sprite and 1 respectively). If you want more people, or if you want sprites to talk from other locations (for example, a shopkeeps saying "don't touch that!" when you try to do things to his merchandise), you can use the above system.