Here's some untested pseudo code
Code:
function hitEvent()
{
if(event_type == event_entity)
{
if(you == player)
{
player.health -= 50; //reduce player health
}
ent_remove(me);
}
if(event_type == event_block)
{
ent_remove(me);
}
return;
}
action arrowFly
{
var arrowCounter
my.enable_block = on;
my.enable_entity = on;
my.event = hitEvent;
my.passable = on;
while(arrowCounter < 100) //play with this (arrow's flight time)
{
my.skill20 = 10; //play with this (arrow's speed)
my.skill21 = 0;
my.skill22 = 0;
move_mode = ignore_passable;
ent_move(my.skill20,nullvector); //or use c_move
if(vec_dist(my.x,you.x) < 50)
{
my.passable = off;
}
wait(1);
}
ent_remove(me);
}
action arrowBox
{
var counter;
while(1) //play with this number (amt of time between firing an arrow
{
if(counter == 50)
{
you = ent_create(arrowMDL,my.x,arrowFly);
}
counter += 1;
if(counter < 50)
{
counter = 0;
}
wait();
}
arrowBox creates an arrow everytime the counter gets to fifty. When the counter is greater than fifty, the counter resets. The arrow flies straight out along x-axis until its counter reaches 100 ticks, its flight time. At 100, the while loop is broken so the arrow removes itself. If the arrow hits an object named player, health is reduced and the arrow is removed. If the arrow hits a block, it is removed.