OK I've been playing around with this script and have it sort of working as in it now will fly around and when it comes into range of the player will turn and kind of dive towards him. The issue I'm having now is that the sprite on screen stays on screen also the kills part in the exit isn't working properly as if the script isn't being destroyed properly ?
would this be because the entity is always active? if so how can I stop the script from running?
I'm kinda confused .com lol
local speed = {}
g_impv=0
g_coinf=0
function implebug_init(e)
speed[e] = 500
var = 0
GravityOff(e)
CollisionOff(e)
----- Icon
bug_icon_posX = 10
bug_icon_posy = 50
bug_icon_sizeX = 80
bug_icon_sizey = 10
bug_sprite = LoadImage("scriptbank\\images\\imp\\01.png")
bug_icon = CreateSprite(bug_sprite)
SetSpriteSize (bug_icon,bug_icon_sizeX,bug_icon_sizey)
SetSpriteDepth (bug_sprite, 100)
SetSpritePosition(bug_icon,300,300)
bug_icon2_posX = 80
bug_icon2_posy = 80
bug_icon2_sizeX = 10
bug_icon2_sizey = 10
end
function implebug_main(e)
PlayerDist = GetPlayerDistance(e)
-- find 2D distance (ignore Y)
local Ent = g_Entity[ e ]
local PDX, PDZ = Ent.x - g_PlayerPosX,
Ent.z - g_PlayerPosZ;
PlayerDist= math.sqrt( PDX*PDX + PDZ*PDZ )
if var == 0 then
SetAnimationFrames(71,90)
if g_Entity[e]['animating'] == 0 then
LoopAnimation(e);
g_Entity[e]['animating'] = 1
end
end
MoveForward(e,(100 + speed[e]))
if PlayerDist >= 20000 then
SetRotation(e,0,g_Entity[e]['angley']+math.random(-45,45),0)
end
if PlayerDist <= 3000 then
PasteSpritePosition(bug_icon, bug_icon_posX, bug_icon_posy)
RotateToPlayer(e)
MoveUp (e, -150)
GravityOn(e)
end
if PlayerDist <= 600 then
SetSpritePosition(bug_icon,300,300)
end
if PlayerDist <= 200 then
SetEntityHealth(e,0)
end
function implebug_exit(e)
g_impv = g_impv + 1
g_coinf = g_coinf + math.random(5 , 25)
Destroy(e)
end
end
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel
I only smile because i have absolutely no idea whats going on