The Dink Network

Item Problems

June 10th 2007, 11:52 PM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
I have a problem regarding part of my D-mod where Dink has his axe sharpened by someone, I tried adding a condition using a global variable so if "&weapon >= 2" when Dink armed the axe it would give him 2 bonus attack points.
I know there is probably a better way involving disarming the axe or dropping it from his inventory briefly but I couldn't find any problems in DinkC editor or any easy-looking solutions in the reference make the script work, when Dink armed the axe it would give him +5 attack, as it should have but when he disarmed the axe it would only take off 3 attack so it increase every time he armed it. I tried that once with a clawsword and got it up to 1000 attack but that's not what I want here.

This is the disarm and arm part of the script.

void disarm(void)
{
sp_attack_hit_sound(1, 0);

&strength -= 3;
sp_distance(1, 0);
sp_range(1, 0);
kill_this_task();

if (&weapon >= 2)
{
&strength -= 2;
}

}

void arm(void)
{
//sword range
sp_distance(1, 55);
sp_range(1, 45);
//sword strength added
&strength += 3;

if (&weapon >= 2)
{
&strength = 2;
}

What I added in was the if "(&weapon >= 2)" parts, this is Dan's axe script I copied so apart from what I put in it would be flawless.
June 11th 2007, 12:15 AM
burntree.gif
Striker
Noble She/Her United States
Daniel, there are clowns. 
if (&weapon >= 2)
{
&strength = 2; &strength += 2;
}
June 11th 2007, 01:07 AM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
Hmm, on the script it is like that but when I copied it it seems to be missing.

That's what it really is.

if (&weapon >= 2)
{
&strength += 2;
}
June 11th 2007, 01:22 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Does that mean your problem is solved? I think it should be. I couldn't find any other problems with it so it should work.

Striker, how did you do that strikeout thing? Is it like [s]this?[/s]
June 11th 2007, 01:43 AM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
No, what I mean is that the one I first posted wasn't actually what was in the script, it was as how Striker changed so I don't know how it would have been different, anyway it was the disarming I was having trouble with not the arming so there must be still something wrong.
I looked in MAIN.c just to make sure and the global was actually there so I don't know what is stuffing up.
June 11th 2007, 01:57 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
This probably won't work, but try changing:

if (&weapon >= 2)
{
&strength -= 2;
}

to:

if (&weapon >= 2)
{
&strength -= 5;
}

I don't think this'll do it, but it's worth a try. If it takes of too much, try messing around with the number it takes off till you get it right. I've found with some other languages that you have to try and trick it into doing what you want it to do. And it works. So give it a shot.
June 11th 2007, 02:09 AM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
Yeah I tried adding 1 point that it took off to compensate but it didn't seem to do anything so I think it might be something to do with that part because that rest works.
June 11th 2007, 02:13 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
So are you saying that you changed it to &strength -= 3; and it didn't do anything at all? Try rewriting the script. That might do it.
June 11th 2007, 03:15 AM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
It was at 2 and I changed it to 3 with no noticeable difference (I don't think I saved it though) but just now I changed it to 4 and it worked
Thanks for all your help, I doubt I would have been able to fix it on my own even if it was just something I missed.
June 11th 2007, 04:54 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
You're welcome Hades. Any time!
June 11th 2007, 05:23 AM
goblinm.gif
It shouldn't work, because kill_this_task() usually kills the script! In general put everything before kill_this_task.
June 11th 2007, 05:41 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Oh, I didn't notice that. But, it only kills the task if he disarms it doesn't it?
June 11th 2007, 04:40 PM
goblinm.gif
Yes. The kill_this_task() is necessary, but it should be the last thing in the disarm procedure.
June 11th 2007, 06:58 PM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
Err this is only the small part I added on, the whole script looks like this.

It's actually an axe but no-one bothered to change the editor notes.

//item sword1 shortsword

void use( void )
{
//disallow diagonal punches

if (sp_dir(1, -1) == 1) sp_dir(1, 2);
if (sp_dir(1, -1) == 3) sp_dir(1, 2);
if (sp_dir(1, -1) == 7) sp_dir(1, 8);
if (sp_dir(1, -1) == 9) sp_dir(1, 8);

&basehit = sp_dir(1, -1);
&basehit += 100; //100 is the 'base' for the hit animations, we just add
//the direction
sp_seq(1, &basehit);
sp_frame(1, 1); //reset seq to 1st frame
sp_kill_wait(1); //make sure dink will punch right away
sp_nocontrol(1, 1); //dink can't move until anim is done!
wait(200);
playsound(8, 8000,0,0,0);

}

void disarm(void)
{
sp_attack_hit_sound(1, 0);

&strength -= 3;
sp_distance(1, 0);
sp_range(1, 0);
kill_this_task();

if (&weapon >= 2)
{ <<<What I added is here
&strength -= 4;
}

}

void arm(void)
{
//sword range
sp_distance(1, 55);
sp_range(1, 45);
//sword strength added
&strength += 3;

if (&weapon >= 2)
{ <<And here
&strength += 2;
}

sp_attack_hit_sound(1, 10);
sp_attack_hit_sound_speed(1, 8000);
init("load_sequence_now graphics\axe\walk\d-sw1- 71 43 64 69 -14 -10 14 10");
init("load_sequence_now graphics\axe\walk\d-sw2- 72 43 35 70 -21 -10 19 10");
init("load_sequence_now graphics\axe\walk\d-sw3- 73 43 28 69 -13 -9 13 9");
init("load_sequence_now graphics\axe\walk\d-sw4- 74 43 66 75 -14 -12 20 12");

init("load_sequence_now graphics\axe\walk\d-sw6- 76 43 27 69 -23 -10 23 10");
init("load_sequence_now graphics\axe\walk\d-sw7- 77 43 38 94 -20 -10 20 10");
init("load_sequence_now graphics\axe\walk\d-sw8- 78 43 30 96 -15 -12 15 12");
init("load_sequence_now graphics\axe\walk\d-sw9- 79 43 31 80 -13 -9 13 9");

init("load_sequence_now graphics\axe\idle\d-si2- 12 250 74 73 -17 -12 16 9");
init("load_sequence_now graphics\axe\idle\d-si4- 14 250 57 103 -11 -12 16 10");
init("load_sequence_now graphics\axe\idle\d-si6- 16 250 30 92 -15 -9 11 9");
init("load_sequence_now graphics\axe\idle\d-si8- 18 250 35 106 -15 -12 15 9");

init("load_sequence_now graphics\axe\hit\d-sa2- 102 75 52 92 -23 -12 24 11");
init("load_sequence_now graphics\axe\hit\d-sa4- 104 75 74 90 -23 -13 23 14");
init("load_sequence_now graphics\axe\hit\d-sa6- 106 75 33 92 -18 -14 18 10");
init("load_sequence_now graphics\axe\hit\d-sa8- 108 75 46 109 -17 -16 17 10");
int &basehit;
}

void pickup(void)
{
Debug("Player now owns this item.");
kill_this_task();
}

void holdingdrop( void )
{ //this is run if the item is dropped while it is armed
init("load_sequence_now graphics\dink\walk\ds-w1- 71 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w2- 72 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w3- 73 43 38 72 -14 -9 14 9");
init("load_sequence_now graphics\dink\walk\ds-w4- 74 43 38 72 -12 -9 12 9");

init("load_sequence_now graphics\dink\walk\ds-w6- 76 43 38 72 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w7- 77 43 38 72 -12 -10 12 10");
init("load_sequence_now graphics\dink\walk\ds-w8- 78 43 37 69 -13 -9 13 9");
init("load_sequence_now graphics\dink\walk\ds-w9- 79 43 38 72 -14 -9 14 9");

init("load_sequence_now graphics\dink\idle\ds-i2- 12 250 33 70 -12 -9 12 9");
init("load_sequence_now graphics\dink\idle\ds-i4- 14 250 30 71 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i6- 16 250 36 70 -11 -9 11 9");
init("load_sequence_now graphics\dink\idle\ds-i8- 18 250 32 68 -12 -9 12 9");

}

void drop(void)
{
Debug("Item dropped.");
kill_this_task();
}

EDIT: Hmm copying some stuff from Notepad to Mozilla sometimes seems to stuff up, I had to change some stuff back to how it really is.
June 12th 2007, 09:37 AM
sob_scorpb.gif
Hades
Peasant He/Him Australia
Remember you're unique, just like everyone else. 
This post isn't really about my item problems as they are all fixed now but I didn't want to clutter up the board any more and this thread was started by me anyway.

I have recently been doing a lot of work on my 'City' D-mod and have just created a diary thing in my profile, it really helps to know what you have just done and what you still need to do as it is easy to get muddled and a sea of thoughts. I suggest anyone who is making a D-mod do this and it helps to have it on the DN as other people can read it as well.