• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Can't limit spell fire...

M

MurDocDoc

Guest
Hello GameMaker Community,i'm new to Gamemaker and i wanna make a small RPG game.
I have 2 issues that's been bugging me for the last 3 days.First one and the most annoying ... can't limit spell fire.
I implemented mana variable etc,it consumes all the mana upon fire (mana regen works) but i can fire all the time(even when mana is 0/10).....
Second issue is how to put different damage values to different swords.(I use sprites to pick weapon for the ground and replace it..). Please ,need help :( !Issues.png
 
K

Kuro

Guest
What code are you running inside Alarm 0?

Also for the second question need a bit more information about your set up. If you're using sprites for swords, would need to know what object, if any is managing those sprites.
 
Last edited by a moderator:
T

tomsaram

Guest
Checking mana value when the projectile is already created is rather unconventional, but whatever.
if( obj_player_stats.mana >= 5 ){
obj_player_stats.mana -= 5;
//create whatever particles
alarm[0] = room_speed/8;
obj_player_stats.alarm[1] = room_speed*2;
}
else
{
instance_destroy();
}
 
M

MurDocDoc

Guest
->Inside alarm[0] from obj_projectile:

instance_destroy();



->Inside scr_swap_weapons :
/// scr_swap_weapons (new_weapon)
var new_weapon = argument0;
var temp = weapon_sprite;
weapon_sprite = new_weapon.sprite_index;
new_weapon.sprite_index = temp;

->inside scr_move_state:
if (obj_input.swap_key) {
var nearest_weapon = instance_nearest(x, y, obj_weapon_item);
if (place_meeting(x, y+4, nearest_weapon)) {
scr_swap_weapons(nearest_weapon);
}

->and inside obj_weapon_animation create event:
/// Initialize the weapon animation parent
dir = 0;
depth = -y;

step event:
/// Animation
if (image_angle >= dir-45) {
image_angle -= 18;
} else {
instance_destroy();
}


end step event:
/// Follow the player
if (instance_exists(obj_player)) {
x = obj_player.x;
y = obj_player.y;
} else {
instance_destroy();
}
 
M

MurDocDoc

Guest
FATAL ERROR in
action number 1
of Step Event0
for object obj_player:

Unable to find any instance for object index '100179'
at gml_Script_scr_move_state (line 42) - p.creator = id;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_scr_move_state (line 42)
called from - gml_Object_obj_player_StepNormalEvent_1 (line 3) - script_execute(state);
 
M

MurDocDoc

Guest
What code are you running inside Alarm 0?

Also for the second question need a bit more information about your set up. If you're using sprites for swords, would need to know what object, if any is managing those sprites.

->Inside alarm[0] from obj_projectile:

instance_destroy();



->Inside scr_swap_weapons :
/// scr_swap_weapons (new_weapon)
var new_weapon = argument0;
var temp = weapon_sprite;
weapon_sprite = new_weapon.sprite_index;
new_weapon.sprite_index = temp;

->inside scr_move_state:
if (obj_input.swap_key) {
var nearest_weapon = instance_nearest(x, y, obj_weapon_item);
if (place_meeting(x, y+4, nearest_weapon)) {
scr_swap_weapons(nearest_weapon);
}

->and inside obj_weapon_animation create event:
/// Initialize the weapon animation parent
dir = 0;
depth = -y;

step event:
/// Animation
if (image_angle >= dir-45) {
image_angle -= 18;
} else {
instance_destroy();
}


end step event:
/// Follow the player
if (instance_exists(obj_player)) {
x = obj_player.x;
y = obj_player.y;
} else {
instance_destroy();
}
 
Top