Help needed (and patience too)
Someone could please help me with this script?? The monster should disappear when you hit, but lose a bit of energy, it works good but he doesn´t loses energy, any ideas?? //evil magician
void main( void )
{
int &mcounter;
int &pap;
int &wherex;
int &wherey;
int &fsave_x;
int &kcrap;
int &fsave_y;
int &resist;
int &mcounter;
int &mtarget;
sp_brain(¤t_sprite, 9);
sp_target(¤t_sprite, 1);
sp_speed(¤t_sprite, 1);
sp_range(¤t_sprite, 60);
sp_distance(¤t_sprite, 60);
sp_timing(¤t_sprite, 33);
sp_exp(¤t_sprite, 400);
sp_base_walk(¤t_sprite, 820);
sp_base_attack(¤t_sprite, 810);
sp_defense(¤t_sprite, 18);
sp_strength(¤t_sprite, 35);
sp_touch_damage(¤t_sprite, 25);
sp_hitpoints(¤t_sprite, 40);
external("healthbar", "make_hbar");
preload_seq(582);
preload_seq(584);
preload_seq(586);
preload_seq(588);
set_callback_random("target",500,2000);
}
void hit( void )
{
sp_target(¤t_sprite, &enemy_sprite);
//lock on to the guy who just hit us
wait (1000);
&wherex = sp_x(¤t_sprite, -1);
&wherey = sp_y(¤t_sprite, -1);
say("`6dang you", ¤t_sprite);
&pap = random(3, 1);
if (&pap == 1)
{
int &mcrap = create_sprite(&wherex, &wherey, 7, 167, 1);
sp_seq(&mcrap, 167);
playsound(24, 22052, 0, 0, 0);
int &mcrap2 = create_sprite(100, 143, 7, 167, 1);
sp_seq(&mcrap2, 167);
sp_x(¤t_sprite, 100);
sp_y(¤t_sprite, 143);
}
if (&pap == 2)
{
int &mcrap = create_sprite(&wherex, &wherey, 7, 167, 1);
sp_seq(&mcrap, 167);
playsound(24, 22052, 0, 0, 0);
int &mcrap2 = create_sprite(429, 151, 7, 167, 1);
sp_seq(&mcrap2, 167);
sp_x(¤t_sprite, 429);
sp_y(¤t_sprite, 151);
}
if (&pap == 3)
{
int &mcrap = create_sprite(&wherex, &wherey, 7, 167, 1);
sp_seq(&mcrap, 167);
playsound(24, 22052, 0, 0, 0);
int &mcrap2 = create_sprite(288, 301, 7, 167, 1);
sp_seq(&mcrap2, 167);
sp_x(¤t_sprite, 288);
sp_y(¤t_sprite, 301);
}
}
}
void die( void )
{ int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 6);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
external("emake","xlarge");
} There are more 2 "voids" at the script, Void target and Void Attack, but I guess that the problem isn´t at these "voids" so I didn´t posted here.
void main( void )
{
int &mcounter;
int &pap;
int &wherex;
int &wherey;
int &fsave_x;
int &kcrap;
int &fsave_y;
int &resist;
int &mcounter;
int &mtarget;
sp_brain(¤t_sprite, 9);
sp_target(¤t_sprite, 1);
sp_speed(¤t_sprite, 1);
sp_range(¤t_sprite, 60);
sp_distance(¤t_sprite, 60);
sp_timing(¤t_sprite, 33);
sp_exp(¤t_sprite, 400);
sp_base_walk(¤t_sprite, 820);
sp_base_attack(¤t_sprite, 810);
sp_defense(¤t_sprite, 18);
sp_strength(¤t_sprite, 35);
sp_touch_damage(¤t_sprite, 25);
sp_hitpoints(¤t_sprite, 40);
external("healthbar", "make_hbar");
preload_seq(582);
preload_seq(584);
preload_seq(586);
preload_seq(588);
set_callback_random("target",500,2000);
}
void hit( void )
{
sp_target(¤t_sprite, &enemy_sprite);
//lock on to the guy who just hit us
wait (1000);
&wherex = sp_x(¤t_sprite, -1);
&wherey = sp_y(¤t_sprite, -1);
say("`6dang you", ¤t_sprite);
&pap = random(3, 1);
if (&pap == 1)
{
int &mcrap = create_sprite(&wherex, &wherey, 7, 167, 1);
sp_seq(&mcrap, 167);
playsound(24, 22052, 0, 0, 0);
int &mcrap2 = create_sprite(100, 143, 7, 167, 1);
sp_seq(&mcrap2, 167);
sp_x(¤t_sprite, 100);
sp_y(¤t_sprite, 143);
}
if (&pap == 2)
{
int &mcrap = create_sprite(&wherex, &wherey, 7, 167, 1);
sp_seq(&mcrap, 167);
playsound(24, 22052, 0, 0, 0);
int &mcrap2 = create_sprite(429, 151, 7, 167, 1);
sp_seq(&mcrap2, 167);
sp_x(¤t_sprite, 429);
sp_y(¤t_sprite, 151);
}
if (&pap == 3)
{
int &mcrap = create_sprite(&wherex, &wherey, 7, 167, 1);
sp_seq(&mcrap, 167);
playsound(24, 22052, 0, 0, 0);
int &mcrap2 = create_sprite(288, 301, 7, 167, 1);
sp_seq(&mcrap2, 167);
sp_x(¤t_sprite, 288);
sp_y(¤t_sprite, 301);
}
}
}
void die( void )
{ int &hold = sp_editor_num(¤t_sprite); if (&hold != 0) editor_type(&hold, 6);
&save_x = sp_x(¤t_sprite, -1);
&save_y = sp_y(¤t_sprite, -1);
external("emake","xlarge");
} There are more 2 "voids" at the script, Void target and Void Attack, but I guess that the problem isn´t at these "voids" so I didn´t posted here.
Don't put a wait(); command into the hit(void) procedure, it kills it.
Don't put a wait(); command into the hit(void) procedure, it kills it.
Not true, the script should work fine. I don't see anything that would make him invulnerable in there either.
One thing that might cause it is that he has sp_nohit(¤t_sprite,1); somewhere. Maybe somewhere else in the script, or in the editor? Try putting a sp_nohit(¤t_sprite,0); in his main procedure... /Might possibly even be the healthbar script that causes that.
Also, this is propably a needless remark, but Dink needs to have more than 18 strength to be able to hurt him effectively.
Not true, the script should work fine. I don't see anything that would make him invulnerable in there either.
One thing that might cause it is that he has sp_nohit(¤t_sprite,1); somewhere. Maybe somewhere else in the script, or in the editor? Try putting a sp_nohit(¤t_sprite,0); in his main procedure... /Might possibly even be the healthbar script that causes that.
Also, this is propably a needless remark, but Dink needs to have more than 18 strength to be able to hurt him effectively.
Thanks scratcher and metatarasal!!
He died! The problem was the "sp_nohit(¤t_sprite,0);", the "wait()" wasn´t at the first script that i´ve made, I just though that the "wait()" would solve the problem (because I saw a script with it).
One more thing, (that´s why I´ve said patience) and how about this one...
It´s the "Rage Sword", that earns more power when you defeat an enemy, when you kill the enemy you earn 2 &rage, everithing is OK except that if the enemy is killed with another sword (ClawSword, for example), the Rage Sword becomes stronger (what I´ve wanted), but if the enemy is killed with the Rage Sword, it doesn´t gets stronger!! And when you disarm it, Dink loses his strenght.
Example: With ClawSword I had 25 ATK points, I´ve killed a monster with the Rage Sword, it supposed to win 1 ATK point, but it doesn´t, and when I disarm the Rage Sword I´ve lost this Extra point, with my ClawSword i´m now 24 ATK points, I think that the game doesn´t update my extra point (so I don´t earn the ATK point), but when I disarm, the game counts that point (so I lost 1 ATK point).
Sword Arm/Disarm Void
void arm(void)
{
//sword range
sp_distance(1, 50);
sp_range(1, 40);
//sword strength added
&strength += &rage; (&rage variable = 35)
void disarm(void)
{
sp_attack_hit_sound(1, 0);
&strength -= &rage; (the disarm should be -35, but it counts the extra Rage point, so -36)
sp_distance(1, 0);
sp_range(1, 0);
kill_this_task();
}
I´ve tried use an "update stats" "draw_stats", but it keeps the same problem...
Help me please!!
Your names already are at the credits of my D-Mod, thanks!!
He died! The problem was the "sp_nohit(¤t_sprite,0);", the "wait()" wasn´t at the first script that i´ve made, I just though that the "wait()" would solve the problem (because I saw a script with it).
One more thing, (that´s why I´ve said patience) and how about this one...
It´s the "Rage Sword", that earns more power when you defeat an enemy, when you kill the enemy you earn 2 &rage, everithing is OK except that if the enemy is killed with another sword (ClawSword, for example), the Rage Sword becomes stronger (what I´ve wanted), but if the enemy is killed with the Rage Sword, it doesn´t gets stronger!! And when you disarm it, Dink loses his strenght.
Example: With ClawSword I had 25 ATK points, I´ve killed a monster with the Rage Sword, it supposed to win 1 ATK point, but it doesn´t, and when I disarm the Rage Sword I´ve lost this Extra point, with my ClawSword i´m now 24 ATK points, I think that the game doesn´t update my extra point (so I don´t earn the ATK point), but when I disarm, the game counts that point (so I lost 1 ATK point).
Sword Arm/Disarm Void
void arm(void)
{
//sword range
sp_distance(1, 50);
sp_range(1, 40);
//sword strength added
&strength += &rage; (&rage variable = 35)
void disarm(void)
{
sp_attack_hit_sound(1, 0);
&strength -= &rage; (the disarm should be -35, but it counts the extra Rage point, so -36)
sp_distance(1, 0);
sp_range(1, 0);
kill_this_task();
}
I´ve tried use an "update stats" "draw_stats", but it keeps the same problem...
Help me please!!
Your names already are at the credits of my D-Mod, thanks!!
You're welcome.
Yeah, you're right about the problem; The &rage points you gain while having the sword equipped aren't automatically added to the points you had when you equipped the sword.
One way to fix this would be to make another global, and use it when arming and disarming the sword, eg.
arm:
&ragenow = &rage;
&strength += &ragenow;
disarm:
&strength -= &ragenow;
That still doesn't update the sword's strength while you gain rage points when it's armed though. I'm not sure if the following would work
&rage += 1;
arm_weapon();
or just double your strength.
Yeah, you're right about the problem; The &rage points you gain while having the sword equipped aren't automatically added to the points you had when you equipped the sword.
One way to fix this would be to make another global, and use it when arming and disarming the sword, eg.
arm:
&ragenow = &rage;
&strength += &ragenow;
disarm:
&strength -= &ragenow;
That still doesn't update the sword's strength while you gain rage points when it's armed though. I'm not sure if the following would work
&rage += 1;
arm_weapon();
or just double your strength.
Thanks again Scratcher! You´re helping a lot!!
But I´ve found a new problem...
The Evil Magician (the script is already posted), I´ve added him to the Dink main game, he walks normally, but when I used it´s script at my D-Mod he walks like a turtle!!(Speed)
I´m using at my D-Mod the same Main, INI and script that´s at the main game, What do you think??
(Sorry if i´m making many questions for you, it´s because i´ve been waiting until I had many question to solve, to use an topic for all, and if you´re tired for answering me, can say. I´m already very grateful to you.)
But I´ve found a new problem...
The Evil Magician (the script is already posted), I´ve added him to the Dink main game, he walks normally, but when I used it´s script at my D-Mod he walks like a turtle!!(Speed)
I´m using at my D-Mod the same Main, INI and script that´s at the main game, What do you think??
(Sorry if i´m making many questions for you, it´s because i´ve been waiting until I had many question to solve, to use an topic for all, and if you´re tired for answering me, can say. I´m already very grateful to you.)










