my stupid first item, HELP
I've attached a script to a potion in dinkedit. It's script doesn't work, let alone the actual item script. this is the potion script:
void main(void)
{
int &crap = free_magic()
}
void touch(void)
{
if (&crap > 0)
{
add_magic(itm-ptn, 438, 5)
say("`4How strange. I wonder what this is.", 1)
sp_active(¤t_sprite, 0)
}
}
please alert me whether it is the engine(doubtfully) or my script
void main(void)
{
int &crap = free_magic()
}
void touch(void)
{
if (&crap > 0)
{
add_magic(itm-ptn, 438, 5)
say("`4How strange. I wonder what this is.", 1)
sp_active(¤t_sprite, 0)
}
}
please alert me whether it is the engine(doubtfully) or my script
Just copy e.g. rpotion.c script and replace &strength += 1; with
add_magic("itm-ptn", 438, 5)
say("`4How strange. I wonder what this is.", 1)
and it should work.
add_magic("itm-ptn", 438, 5)
say("`4How strange. I wonder what this is.", 1)
and it should work.
put a semicolon ";" after each line, except for the if- and the void lines. Also you should put quotes around itm-ptn. Next thing is to add "sp_touch_damage(¤t_sprite, -1);" to the main proc, and it'll work.
Now I can pick up the item and all
, but the potion doesn't work. here is "itm-ptn":
void arm_magic(void)
{
int &form = 0
}
void use(void)
{
if(&form == 0)
{
int &bw = &base_walk
int &ba = &base_attack
int &bi = &base_idle
int &bd = &base_death
sp_base_walk(1, 640);
sp_base_attack(1, 630);
sp_base_idle(1, 610);
sp_base_death(1, 640);
&basehit = sp_dir(1, -1)
&basehit += 590
&strength += 10
&form = 1
}
if(&form == 0)
{
sp_base_walk(1, &bw);
sp_base_attack(1, &ba);
sp_base_idle(1, &bi);
sp_base_death(1, &bd);
&basehit = sp_dir(1, -1)
&basehit += 100
&strength -= 10
&form = 1
}
}

void arm_magic(void)
{
int &form = 0
}
void use(void)
{
if(&form == 0)
{
int &bw = &base_walk
int &ba = &base_attack
int &bi = &base_idle
int &bd = &base_death
sp_base_walk(1, 640);
sp_base_attack(1, 630);
sp_base_idle(1, 610);
sp_base_death(1, 640);
&basehit = sp_dir(1, -1)
&basehit += 590
&strength += 10
&form = 1
}
if(&form == 0)
{
sp_base_walk(1, &bw);
sp_base_attack(1, &ba);
sp_base_idle(1, &bi);
sp_base_death(1, &bd);
&basehit = sp_dir(1, -1)
&basehit += 100
&strength -= 10
&form = 1
}
}
the point of it is to change you into something after pressing shift, then change you back after pressing it again
First of all, change
int &bw = &base_walk
int &ba = &base_attack
int &bi = &base_idle
int &bd = &base_death
into
&bw = sp_base_walk(1, -1);
&ba = sp_base_attack(1, -1);
&bi = sp_base_idle(1, -1);
&bd = sp_base_death(1, -1);
A -1 for a value in these cases means "return value". Also I would int the &bw, &ba, &bi and &bd in the arm proc. If used multiple times, it won't take up variable space...
Then the second if (&form == 0) should be changed into if (&form == 1)
and just before the ending "}" of an if-statement, place "return;" (without quotes).
Also, the last &form = 1 should be changed into &form = 0;
Then, place a semicolon ";" after each non-if-non-void line if there's non already. (Also not after a { or }, but I guess that makes sense...)
int &bw = &base_walk
int &ba = &base_attack
int &bi = &base_idle
int &bd = &base_death
into
&bw = sp_base_walk(1, -1);
&ba = sp_base_attack(1, -1);
&bi = sp_base_idle(1, -1);
&bd = sp_base_death(1, -1);
A -1 for a value in these cases means "return value". Also I would int the &bw, &ba, &bi and &bd in the arm proc. If used multiple times, it won't take up variable space...
Then the second if (&form == 0) should be changed into if (&form == 1)
and just before the ending "}" of an if-statement, place "return;" (without quotes).
Also, the last &form = 1 should be changed into &form = 0;
Then, place a semicolon ";" after each non-if-non-void line if there's non already. (Also not after a { or }, but I guess that makes sense...)
good:
he transforms once
bad:
he doesnt turn back into dink
his attack never changes
his strength doesn't change
i dont know how to do the recharge thing
he transforms once
bad:
he doesnt turn back into dink
his attack never changes
his strength doesn't change
i dont know how to do the recharge thing
Try this (most of this was suggested by Magic man):
void arm(void)
{
int &form = sp_base_walk(1, -1);
if (&form != 640) { &form = 0; }
if (&form == 640) { &form = 1; }
int &bw;
int &ba;
int &bi;
int &bd;
}
void use(void)
{
if(&form == 0)
{
&bw = sp_base_walk(1, -1);
&ba = sp_base_attack(1, -1);
&bi = sp_base_idle(1, -1);
&bd = sp_base_death(1, -1);
sp_base_walk(1, 640);
sp_base_attack(1, 630);
sp_base_idle(1, 610);
sp_base_death(1, 640);
&strength += 10;
draw_status();
&form = 1;
}
if(&form == 1)
{
sp_base_walk(1, &bw);
sp_base_attack(1, &ba);
sp_base_idle(1, &bi);
sp_base_death(1, &bd);
&strength -= 10;
draw_status();
&form = 0;
}
}
void disarm(void)
{
//Uh oh, you lose the values for &bw, &ba etc. so you better change back to normal while you still can
sp_base_walk(1, &bw);
sp_base_attack(1, &ba);
sp_base_idle(1, &bi);
sp_base_death(1, &bd);
&strength -= 10;
draw_status();
kill_this_task();
}
void pickup(void)
{
kill_this_task();
}
void drop(void)
{
kill_this_task();
}
This will screw up if you try to load a game saved after transformation, because the load will kill &bw, &ba, etc. I don't know how PotA solved this problem, but a solution clearly exists (most likely, using explicit values for &bw, &ba, etc.) Also, if you change weapons while transformed, Dink will return to his normal appearance. Sorry I couldn't help more.
void arm(void)
{
int &form = sp_base_walk(1, -1);
if (&form != 640) { &form = 0; }
if (&form == 640) { &form = 1; }
int &bw;
int &ba;
int &bi;
int &bd;
}
void use(void)
{
if(&form == 0)
{
&bw = sp_base_walk(1, -1);
&ba = sp_base_attack(1, -1);
&bi = sp_base_idle(1, -1);
&bd = sp_base_death(1, -1);
sp_base_walk(1, 640);
sp_base_attack(1, 630);
sp_base_idle(1, 610);
sp_base_death(1, 640);
&strength += 10;
draw_status();
&form = 1;
}
if(&form == 1)
{
sp_base_walk(1, &bw);
sp_base_attack(1, &ba);
sp_base_idle(1, &bi);
sp_base_death(1, &bd);
&strength -= 10;
draw_status();
&form = 0;
}
}
void disarm(void)
{
//Uh oh, you lose the values for &bw, &ba etc. so you better change back to normal while you still can
sp_base_walk(1, &bw);
sp_base_attack(1, &ba);
sp_base_idle(1, &bi);
sp_base_death(1, &bd);
&strength -= 10;
draw_status();
kill_this_task();
}
void pickup(void)
{
kill_this_task();
}
void drop(void)
{
kill_this_task();
}
This will screw up if you try to load a game saved after transformation, because the load will kill &bw, &ba, etc. I don't know how PotA solved this problem, but a solution clearly exists (most likely, using explicit values for &bw, &ba, etc.) Also, if you change weapons while transformed, Dink will return to his normal appearance. Sorry I couldn't help more.
Wow, the crazy stuff it does when you modify a post... anyhow, I think you know how to fix my brackets.
I don't think Dink has a base death or a base attack... Death is set in dinfo.c and attack animations are set in the weapon scripts...
Dink base idle is 10, dink base walk is 70.
EDIT: in the weapon scripts, different images are loaded by using the init() command. They are loaded in the seq's 102, 104, 106 and 108. If you equip a sword or bow, also the walk and idle animations are re-init()-ted...
Dink base idle is 10, dink base walk is 70.
EDIT: in the weapon scripts, different images are loaded by using the init() command. They are loaded in the seq's 102, 104, 106 and 108. If you equip a sword or bow, also the walk and idle animations are re-init()-ted...
August 23rd 2004, 02:07 PM

MiloBones


Doing an arm_weapon(); after changing back to Dink would make a lot of sense then...
Set sp_touch_damage(?t_sprite, -1);
in the main procedure of the script attached to the potion.
The other stuff of base walk, attack, idle are usually handled in arm, disarm of things like sword scripts. Take a look there.
As for dying... modify dinfo.c to check what the value of sp_base_walk is and then play the correct death sequence.
Also check your escape.c and savebot.c scripts do when loading a saved game if Dink is in disguise.
There's a start - I really should release PQ source, as I did all this stuff with the frog-bot, using the F-key to bring Dink in and out of disguise... I'm just not at my home computer right now.
in the main procedure of the script attached to the potion.
The other stuff of base walk, attack, idle are usually handled in arm, disarm of things like sword scripts. Take a look there.
As for dying... modify dinfo.c to check what the value of sp_base_walk is and then play the correct death sequence.
Also check your escape.c and savebot.c scripts do when loading a saved game if Dink is in disguise.
There's a start - I really should release PQ source, as I did all this stuff with the frog-bot, using the F-key to bring Dink in and out of disguise... I'm just not at my home computer right now.
August 23rd 2004, 08:37 PM

MiloBones


Oddly, my script should have exactly the opposite of the problem you're having. Try putting a return; line after &form = 1; in the use script. Otherwise, it will run the second if statement, which should turn you back into Dink. (weirdness)
Oh well, why patch a sinking ship?
Oh well, why patch a sinking ship?