The Dink Network

Reply to Re: Smallwood-Man! *DEV THREAD*

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:
 
 
August 9th 2010, 09:01 AM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
The only way you could change the vision mid talking to someone would to be to reload the screen and let the screen's main script change the vision as I said previously. But that would be weird as the NPCs will revert back to their starting cooridinates, and basically that screen would be as if you were walking into it anew except Dink would still be in the same spot.

I'm starting to think that you don't really need to use a vision in your case. Basically what a vision does is either get rid of certain sprites, or create more sprites on the screen. In most cases, there's no real need for visions.

If you want to create a sprite, we use the create_sprite() command. It's normally declared as a variable so you can modify it's stats on creation in case you wanted to give it a script or something. It is broken down into this:

int &newsprite = create_sprite(x , y , brain, sequence, frame);


On the other hand, if you want to get rid of something, you can use this:

sp_active(&sprite,0);


But if you're talking to someone, there's the problem of not knowing what sprites numbers to get rid of. It gets a little more complex here and requires some preparation. We will use get_sprite with this_brain() to find it.

First you need to get the sprite you want to disappear, and give it a custom brain. We'll give it brain 20 for this example. This will probably require you to give it a script unless you're using DinkEdit. Once you've done that, we can call on the sprite by it's new brain using the command mentioned earlier, and then kill it like so:

int &killme = get_sprite_with_this_brain(20,0);
sp_active(&killme,0);


The 0 on the end can be ignored; it's for ignoring a sprite during it's process.

Now this next bit would be for getting rid of multiple sprites at once. There's a special command for calling every sprite with a particular brain. It's assumed now that you set up all your sprites with the example brain 20. This is what you do.

int &killme;
kill_loop:
&killme = get_next_sprite_with_this_brain(20,0,&killme)
  if (&killme > 0)
  {
  sp_active(&killme,0);
  goto kill_loop;
  }


Well that's about it. Well, there's a more elegant way to kill off sprites than with sp_active (they will just poof) and that's with the shrink/grow brain which is 12. Just give it the brain, and set the brain_parm to what size you want it to be before it disappears like so.

sp_brain(&killme, 12);
sp_brain_parm(&killme,10)