The Dink Network

2 more development qestions.

April 5th 2011, 06:45 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
ok question 1 is: How do you make a meelee spell that only works on buildings(they are scripted)
and the second is:what is the best way to use vision with tiles(if it is possible with WDE)
the rest of the mod i know how to.
April 5th 2011, 07:01 AM
boncag.gif
JugglingDink
Peasant He/Him United Kingdom
Streetfish 
I'm not sure if it's possible to use tiles with visions, unless you make background sprites which look like tiles

As for your other question, I believe if you look in dam-fire.c in the source there's a bit which probably looks something like this:

int &scrap;
int &fcrap;
&scrap = sp_pseq(&missile_target, -1);
&fcrap = sp_pframe(&missile_target, -1);

if (&scrap == #You'd put the sequence number here#) 
{
if (&fcrap == #You'd put the frame number here#) 
{
sp_script(&missile_target, "burndown");
}

}


This would see if what it hit was that sequence and frame combo, then if it was it will attach the burndown.c script to it.
Bare in mind that there might be problems with my script, because I didn't copy-paste. It will probably work, but if it doesn't let me know and I can be suitably embarrassed

EDIT: Forgot to mention, you would need to attach that script to the spell. So if you shot out a green fireball, for example, you'd then attach the above script to it. You said you were using a melee spell? I'm not sure what you mean, but it might not work if it doesn't involve shooting anything...
April 5th 2011, 07:14 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
I see well will try the copy paste segment of dam-fire.(and with meelee i meant non ranged (eg Dink doing the punching and not a projectile)). and will wait til got more people telling(if it does require sprites then will recolor those with dink-color instead of the tiles)
April 5th 2011, 09:58 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
You can not use vision to control tiles. You can however attach a script to a screen to change the tiles around with load_tile(), but I don't think it alters the hardness (never done this before). Also, it just changes the actual files around for the tiles, not the individual tiles.

Depending on what you want it to do, you can use multiple map files as well to swap around Just make sure you never touch any sprites on the other maps or things will get hairy. If you take this path it will require experimentation and I suggest you finish the whole game first, THEN create the second, third, ... map to alter the tiles so you're 100% sure sprite numbers won't be altered.
April 5th 2011, 02:52 PM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
You can not use vision to control tiles. You can however attach a script to a screen to change the tiles around with load_tile(), but I don't think it alters the hardness (never done this before). Also, it just changes the actual files around for the tiles, not the individual tiles.

Depending on what you want it to do, you can use multiple map files as well to swap around Just make sure you never touch any sprites on the other maps or things will get hairy. If you take this path it will require experimentation and I suggest you finish the whole game first, THEN create the second, third, ... map to alter the tiles so you're 100% sure sprite numbers won't be altered.


I see guess sprites or warps is easier then(I know how to script warps 2 ways(the counter changing one and touch warps(E.G. Sprite attributes) dunno which would work he best though)
April 5th 2011, 07:05 PM
spike.gif
Something like this should work for checking that it's Dink punching the sprite:

if (sp_brain(&missle_source,-1) == 1)
{
int &dogfist = compare_magic("dog-fst");
if (&dogfist == 1)
{
say("Dink came and whacked me good, SOB, I am now turning into a puppy.",&current_sprite);
//etc
}
}


There's a problem, though, in that this works just as well if Dink just has dog fist *armed* and hits the thing with his normal fist. Maybe checking &magic_level or some fidgetry with globals... I don't know.
April 6th 2011, 05:55 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
thanks scatcher for now it will do and will test later(then i have all to test the game till the final boss so basically the rest of the the mod with a minor detail or 2 off.)
April 7th 2011, 09:37 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
ok final got it to work sorta and now whenever i hit it with the spell obtained the game crashes(got windows 7)

//script of the buildings and all can be wrecked
void main (void)
{
sp_brain(&current_sprite,10);
//just so to make the next lines make sense to the engine and since speed is not edited essentially making it standstill targets
sp_hitpoints(&current_sprite,100);
sp_defense(&current_sprite,50);
}

void hit (void)
{
int &wrs = compare_magic("mgw");
if (&wrs == 1)
{
say("it works",1);
hurt(&current_sprite , 100);
}else
{
say("ouch! there has to be a better way to wreck a building",1);
}
}

void die (void)
{

&wrecks += 1
say("and that's home no &wrecks ",1);
int &hold = sp_editor_num(&current_sprite);
if (&hold != 0)
editor_type(&hold, 1); 
}



dunno why though I've seen mods with stationary bosses(CC2 to be more exact) and i've seen dragons in many dmod's attacking themselves with the hurt command.
April 7th 2011, 09:49 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Try to set sp_nohit() to 1 just before using hurt(). When nohit() is 0 and you use hurt(), it'll trigger hit() again, which can cause weird things to happen.

I don't think you want sp_nohit() to be 1 all the time, since then you could hit the building with ordinary fists, and it wouldn't make a punch sound, which would be rather weird.

Don't forget to set it back to 0 after the hurt() line.
April 7th 2011, 10:46 AM
anon.gif
Ghostyghosty
Ghost They/Them
 
Does he say "it works" before it crashes? If it crashes out too fast to see try changing it to say_stop to test.

And you have a semi-colon missing
void die (void)
{
  &wrecks += 1;
April 7th 2011, 11:35 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
ok will try that

and @Ghostyghosty with that command it isn't needed(in my other scripts used the counter comands don't use it and work fine.
April 7th 2011, 05:33 PM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
well darn stuck again because for some reason the authority figure doesn't want to walk form off-screen to on-screen

I've tried anything i can imagine but the figure just doesn't appear nor say it's lines which it was supposed to say when done walking
so here is the section that draws the figure(so i don't spoil what you have to do to make it appear)

freeze(1);
say_stop("Ah that was a great way to relieve my boredom.",1);
say_stop("what a shame it is already over becuase ther is nothing left to destroy or kill",1);
int &knt = create_sprite(230,450,26,231,1);
&story = 1
//well we don't want it ta happen again after you gained victory now do we?
sp_base_walk(&knt,230);
sp_speed(&knt,1);
move_stop(&knt,8,210,1);
say_stop("`%Ah after a hard days of work the 'boredom' of my hometown is a welcome change.",&knt);
unfreeze(1);
sp_script(&knt,"knt");

and the rest i wanted to add after i saw it worked properly. but after fiddling for a few hours i still couldn't get the sprite(even tried giving it a brain other then 0). so i dunno what else i could have missed to work properly(I really doubt it is the command "dink_can_walk_off_screen")
April 7th 2011, 06:53 PM
dinkdead.gif
I tested that bit, it doesn't work with brain 26 but works fine with brain 16, which I guess you meant. It works with brain 0 too though, so maybe there's something else wrong somewhere?

And it really is good to always use a semi-colon at the end, even if it seems to work without it things like that can suddenly decide not to, or it might cause problems only in certain cases etc.... just stay on the safe side
April 8th 2011, 04:35 AM
knights.gif
merder
Peasant He/Him Netherlands
The Voice in the back of your head! 
ok will try with the typo correction. and well sparrow i dunno if you had it but somehow with counters it never worked with the semi-colon(maybe because it then wants to put it to 1; instead of the needed 1).

turns out it was the typo and darn is it easy to overlook those glad that the people here are so eager to help.