--script by smallg --trigger distance is the entity name & damage applied is the strength of the entity --how fast the arrow will travel local speed = 1000 --set to 1 to let arrow reset, set to 0 for 1 time only trap local repeating = 1 --how far away to determine a hit local hit_distance = 70 --larger value means it takes longer to reset local reset_mod = 20 local trigger_distance = {} local damage = {} local startx = {} local starty = {} local startz = {} local firing = {} local hit = {} function trap_arrow_init_name(e,name) trigger_distance[e] = tonumber(name) CollisionOff(e) firing[e] = 0 hit[e] = 0 end function trap_arrow_main(e) CollisionOff(e) if startx[e] == nil or starty[e] == nil or startz[e] == nil then startx[e] = g_Entity[e]['x'] starty[e] = g_Entity[e]['y'] startz[e] = g_Entity[e]['z'] else if damage[e] == nil then damage[e] = g_Entity[e]['health'] else if firing[e] == 0 then if GetPlayerDistance(e) <= trigger_distance[e] then hit[e] = 0 firing[e] = 1 end elseif firing[e] == 1 then MoveForward(e,speed) if GetPlayerDistance(e) < trigger_distance[e] * 2 then Show(e) if GetPlayerDistance(e) <= hit_distance and hit[e] == 0 then HurtPlayer(e,damage[e]) hit[e] = 1 end else Hide(e) end if GetPlayerDistance(e) > trigger_distance[e] * reset_mod then if repeating == 1 then firing[e] = 0 SetPosition(e,startx[e],starty[e],startz[e]) else Hide(e) Destroy(e) end end end end --damage value set end --start position set end --main function function trap_arrow_exit(e) end