Scripts / help with sci fi drone script

Author
Message
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 5th Mar 2016 13:36
Hi all I'm working on 3 Alien attack drones (1 type pictured) I have a half working script the drone will spot and chase the player but still arnt attacking
heres what I have so far

local attack_delay = {}
function drone_init(e)
attack_delay[e] = 250
descent = 0
totaldescent = 0
rotation = 0
flying = 1
attacking = 0
firing = 0
end

GravityOff(e);

function drone_main(e)
CollisionOff(e)
--PlayerDist = GetPlayerDistance(e)
descent = math.random(-500,500)
rotation = math.random(-100,100)

if GetPlayerDistance(e) < 500 then
flying = 0
attacking = 0
firing = 1
end
if GetPlayerDistance(e) < 1000 and GetPlayerDistance(e) >50 then
flying = 0
attacking = 1
firing = 0
end
if GetPlayerDistance(e) > 1500 then
flying = 1
attacking = 0
firing = 0
end
if flying == 1 then
MoveForward(e,100)
if g_Entity[e]['y'] < 700 then
MoveUp(e,20)
end
RotateY(e,rotation)
totaldescent = totaldescent + descent
elseif attacking == 1 then
MoveForward(e,100)
if g_Entity[e]['y'] > g_PlayerPosY then
MoveUp(e,-20)
end
RotateToPlayer(e)
totaldescent = totaldescent + descent
elseif stinging == 1 then
MoveForward(e,100)
MoveUp(e,20)
RotateToPlayer(e)
if GetTimer(e) > attack_delay[e] then
HurtPlayer(e,1)
attack_delay[e] = GetTimer(e) + 250
end
totaldescent = totaldescent + descent
end

if totaldescent <-50 then
MoveUp(e,10)
totaldescent = totaldescent + 10

anyone know what I'm missing? Thx

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Mar 2016 15:02 Edited at: 5th Mar 2016 15:04
can you post the full script and please use the lua code tags?


i assume this is edited from another script, the problem looks to be this line
Quote: "elseif stinging == 1 then"

it should read
Quote: "elseif attacking == 1 then"
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 5th Mar 2016 15:31 Edited at: 5th Mar 2016 15:43
yeah smallg its one of yours I think, the insect script not quite got the hang of the insert code thing :/ do I just highlight the code and click the code>LUA?

the drones work fine I just needed them when they come into a reasonable range to fire their guns and play my minigun .wav , the insect script performs a melee type attack, heres the 3 drones approaching the player

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 5th Mar 2016 16:31
looks more like one of Gtox's scripts.
either way just open notepad++ and press control+h and replace all stinging with attacking.
and i dont see any sound called in there either so you're going to want to add it, i recommend PlaySoundIfSilent(e,1) in this case.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 5th Mar 2016 17:35
Ok smallg ty ive tried changing stinging to attacking = no go I also tried adding a gun to the fpe same thing :/ i'll try to get the sound in when I get the guns working for now while I play with that I made an alien mechwasp 3-5 of these and you find yourself running for your life or get stung to death

Attachments

Login to view attachments
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 7th Mar 2016 17:10
Does your model have a FIRESPOT. This is a bone or an object (a separate small cube hidden inside the object will do) named FIRESPOT (all caps)? This tells gameguru where to fire from and if it's missing it won't fire.

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 7th Mar 2016 17:16 Edited at: 7th Mar 2016 17:39
I would suggest you watch this twitch broadcast from 21:45, Ravey shows us how to create and import a hover tank, and how to make the LUA script etc, in there he explains the FIRESPOT etc. The exact same principles should apply to your drone.



Talking of which, boredom at work produced this today...



Edit: oops forgot to add the video

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2016 18:15
it's using HurtPlayer(e,1) and not FireWeapon(e) so technically it doesnt need a firespot, it is however a good idea to try add firespots to your models (especially now you can hide the weapon) as it will allow for the engine to calculate things like accuracy and if the model can actually "see" the player.

like i said before, we can't really help unless you post the full script
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 7th Mar 2016 19:18 Edited at: 7th Mar 2016 19:50
That was the full script initially smallg that's all I had i'll check out the firespot as I'm making a few models atm so im sure it'll be useful @belidos like the model just added FIRESPOT to a model will try it out ok added a weapon to the fpe and firespots to the wings
i'll try to add the code hopefully get it right this time lol :/
this is what I have so far:


yay got that bit right the drones track and find the player ok but fly up to about 10 ft away then just stop, no guns firing no damage taken
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 7th Mar 2016 20:45
GameGuru only supports one FIRESPOT at the moment as far as know, so best to put it in the middle, so it doesn't look odd.

i7, NV960 4GB, 16GB memory, 2x 4TB Hybrid, Win10.
i5 , AMD 6770 1GB, 8GB memory, 512GB Generic SATAIII + 2TB Seagate Baracuda SATAIII, Win7.
i3, Radeon integrated graphics, 4GB memory, 512gB Generic SATAII, Win8.1.
Q6600, Intel integrated graphics, 2GB memory, 180GB Generic SATAII, WinXP.
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 7th Mar 2016 21:34
ok ive done that, still doesn't shoot at the character just chases him around till I get bored and blow it up lol
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 8th Mar 2016 18:15
ok i wasnt sure because the initial code doesnt have the 2 ends so there might easily have been extra code missing.
anyway this works but you may need to wait for the rotation of characters to get fixed.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 8th Mar 2016 20:34
ok smallg and thanks m8

Login to post a reply

Server time is: 2024-05-03 13:59:02
Your offset time is: 2024-05-03 13:59:02