hi there i was wondering if anybody new how to do a smartbomb script ive tried using bits of Smallgs absorbing damage script but i cant get it to work what i want is a powerup that is collected and when you press a key it uses a smartbomb to kill all in my range here is the code im using i manage to pick up object which hides then attach itself to me so the script still runs when i go other places the prompts come up but when i press the v key nothing happens some help would be much appreciated thanks Bonesy23438
g_smartbomb_collected = 0
g_smartbomb_activated = 0
local smartbomb_damage = 2000
local blast_range = 5000
local input_key = "v"
local state = {}
local picked_up = 0
local pressed = 0
local smartbomb_activated = 0
local smartbomb = 1
function smartbomb_pickup_init(e)
state[e] = "pick up"
end
function smartbomb_pickup_main(e)
if state[e] == "pick up" then
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 60 and g_PlayerHealth > 0 and g_PlayerThirdPerson==1 then
Hide(e)
CollisionOff(e)
PlaySound(e,0)
picked_up = 1
g_smartbomb_collected = 1
state[e] = "init"
elseif state[e] == "init" then
SetPosition(e,g_PlayerPosX,g_PlayerPosY,g_PlayerPosZ)
end
end
if pressed == 0 and state[e] == "init" then
Prompt("press " .. input_key .. " to activate smartbomb, " .. smartbomb .. " smartbombs's remaining")
elseif g_InKey == input_key and g_PlayerHealth > 0 then
PlaySound(e,1)
pressed = 1
g_smartbomb_activated = 1
state[e] = "actvated"
end
if smartbomb_activated == 1 then
for a = 1, 19999 do
end
if g_Entity[a] ~= nil then
if GetPlayerDistance(a) <= blast_range then
if ai_soldier_state[a] ~= nil then
SetEntityHealth(a,g_Entity[a]['health'] - smartbomb_damage)
g_smartbomb_activated = 0
Destroy(e)
end
end
end
end
end