Scripts / Implebug script help ;)

Author
Message
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 22nd Nov 2018 16:33 Edited at: 22nd Nov 2018 16:35
Hey all, The Imps have a new weapon "The Implebug" (dunno where I got the idea for this from lol) this basically flies around the map randomly (this and the sounds getting louder part I have working) until it comes into range of the player in which its supposed to fall out of the sky and explode (line 46,bit I'm stuck with) if I set the player distance to a greater than it works but less than it doesn't ? can anyone spot what I'm missing here? Cheers guys looks real nasty doesn't it rofl
here's the script so far



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

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Nov 2018 17:34
are you sure it can get within 3000 units of the player at its current height?
maybe you should check for a flat distance (i.e. no Y in the calculation) here 'if GetPlayerDistance(e) <= 3000 then'.

you should really add some states to your script to make it easier to debug what is happening in each stage
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Nov 2018 17:42
You have this in your init.

soundrange[e]=GetPlayerDistance(e)

That means it will only run once and never be updated. It seems a bit random to me, lol. Still if they appear randomly positioned I suppose it will work
I imagine that this

is running as well as the final distance check here

So the music will never end. You need to make sure one or the other runs, not both. You may have issues with your second distance check nestled inside the first as well. If soundrange[e] is less than 20000 then the second part will never run at all.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 22nd Nov 2018 17:44 Edited at: 22nd Nov 2018 18:46
Seemed to work fine when > was used m8 flew off into the distance a bit and blew up, the MoveDown was toying with GravityOff.
Yeah its a bit of a bodged together script m8 as I've just started to cobble it together atm to see how it would react
@ DVader yeah the music stopped and started again lol still working on it.

@smallg States I take it you mean e.g alert or player spotted etc so I could use say if player spotted = view range then ….do whatever?
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
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Nov 2018 19:03 Edited at: 22nd Nov 2018 19:04
Smallg means to add a prompt or text for important stats and stages of the code. Simply so you can see what is running and what your variables/arrays are doing.

You can change stage to different values in each condition to see the code that is running correctly. You can also print your variables to see if they are working as expected.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 22nd Nov 2018 19:10
Ah right got you sry this kind of scripting is new ground for me
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
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Nov 2018 19:27 Edited at: 22nd Nov 2018 19:41
It's just a way to visualise what your code is doing. A self made debug system if you will. You will soon see if certain areas ever run It can be really helpful when your scripts have many stages and you can't see why some code is not working
A little tidying is also not a bad idea ;p Makes it easier to see the loops.

I've also added a new distance check so the height will not be taken into account for the bombing run. It should work, if it gets within range, but bear in mind I have just typed it in here directly
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 22nd Nov 2018 19:59 Edited at: 22nd Nov 2018 20:03
Thanks m8 ,That gave an error at line 19 "attempt to call a global sqrt a nil value"? just reading through your changes what is sqrt?
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
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd Nov 2018 20:37
it should be math.sqrt
sqrt = square root
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 22nd Nov 2018 21:21
Ah yeah missed that
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 22nd Nov 2018 21:23 Edited at: 22nd Nov 2018 21:39
ahh right thanks guys makes sense now then errors on "attempt to call a global MoveDown (e,v) hmm that's odd its not in the global.lua there's move up, back and forward but no down? I now have it rotating towards the player
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
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 22nd Nov 2018 22:14
Probably just use MoveUp with a -ve value?
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 22nd Nov 2018 22:54
haha good plan m8 thanks will try that
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
Honkeyboy
3D Media Maker
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 27th Nov 2018 13:17 Edited at: 28th Nov 2018 11:55
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


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
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 28th Nov 2018 19:32
_exit functions are only called for characters.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 28th Nov 2018 19:48 Edited at: 28th Nov 2018 19:51
Quote: "_exit functions are only called for characters."

unless it has changed that isn't true, as long as the entity can die it should call the exit (i.e. not always active)

@honkey you put the exit function inside the main function
not sure what you are trying to do with the sprite but looks like you wanted it to disappear when too close? this should work.
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
9
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 29th Nov 2018 13:49 Edited at: 29th Nov 2018 19:06
Thanks smallg getting mixed results with these your edit seems to flash the sprite on screen after the entity explodes (you can see this right at the end) but it does continue to flash



The previous edit i have it moving off the screen fine (i had used paste sprite instead of set sprite) so does works fine up to the exit although i have the down set too harsh as you can see it just drops instead of glides toward the player



the impleballooner




I have 3 similar scripts for 3 types of flying enimies the implebug (in video) the impleballooners (last vid)and the implebommers (very similar to the bug) all pretty much the same script with slightly different behavours e.g the ballooners fly right over the player and drop on his head wheres the other two are intended to sort of dive at the player. Both of the above scripts are not adding the coins or coin fragments to the player display, if i put them in the script elsewhere they just add infinate amounts and keep adding so it looks like the exit part isnt working at all :/

Cheers for the help

Edit: think I may have it sorted yes it was the model wasn't set as a character :/ do'h I've been checking all the global commands today looking for something that would make the bommers dive at the player as apposed to just dropping to the ground and couldn't find anything any ideas?
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
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Nov 2018 19:27
Well the C++ code that calls the _exit function in GG was inside logic checking that the entity is a character last time I looked. Dunno if that was added at some point as we've only been able to see the code this year.


Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-12-22 14:07:03
Your offset time is: 2024-12-22 14:07:03