Scripts / (NEED HELP) Explosion decal trigger

Author
Message
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 27th Sep 2016 17:25 Edited at: 27th Sep 2016 17:29
Hi!
I'm having issue with my explosion decal. I don't really know how to LUA script, so I don't know what to do.
When I added my decal, set it to spawn at start=no and add trigger, decal just 'flashed' there.
I solved this with https://forum.game-guru.com/thread/212167 , but then I got into another issue.
I wanted it to disappear, but it just loops there. And I don't know what to do
I would like it to disappear after 1 second for example (not sure how long animation is) or just stop it's loop.
Here's script that doesn't work (it doesn't even trigger - if you're good at LUA, please don't facepalm that much )

What can I do to achieve my 'goal'? Thanks in advance
PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 28th Sep 2016 22:28
Can I ask if your trying to use a custom decal ... Or are you just trying to trigger an explosion ?
The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 29th Sep 2016 07:06
synchromesh wrote: " Can I ask if your trying to use a custom decal ... Or are you just trying to trigger an explosion ? "

I'm trying to use explosion decal. I have a barrier in my game that disappears after gun is picked up. It's slightly behind terrain, so it's not in front of player.
I just want the explosion decal to be slightly seen
[I really have to learn LUA at some point, but since I don't have much free time now, I don't know when ]
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 29th Sep 2016 11:26
You don't need to use decal if you want just to explode item (barrier), make it explodable via item properties>explodable=yes.

When you shoot over barrier it explode, and explosion decal appears and disappears, after few seconds.

About your code, you can't hide something than you has destroyed before, in another words, you has to state if you want to destroy the item, or just hide it for later user.
Not time to test code now, so just and idea.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
synchromesh
Forum Support
10
Years of Service
User Offline
Joined: 24th Jan 2014
Location:
Posted: 29th Sep 2016 12:08 Edited at: 29th Sep 2016 12:12
Well not sure if this would help but this is what I had in mind ...
triggering a mine ( with a slight edit to the script )
You can put the mine anywhere or as many as you want with various triggers
and of course it will kill enemies and really have an effect on objects around it if that's what you want.

Originally I did this for faking Artillery fire in the distance ..
Let me know if its what you need and I will pass it on..

The only person ever to get all his work done by "Friday" was Robinson Crusoe..
PM
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 29th Sep 2016 16:33
This is a screen from my game:

When player walks up to sandbag, I have a script that destroys wood barricade.
And that's when I would like explosion decal to trigger. This should be player's view of explosion:

@synchromesh It looks good, but it seems too small, but I could test it
@3com I literally have no idea what I was doing there
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 29th Sep 2016 16:56 Edited at: 29th Sep 2016 18:03
If you make the barricade explodable in its properties, then in the script that triggers it to destroy use the line SetEntityHealth(e,0) where e = the entity number of the barricade, that should in theory reduce it to 0 health and trigger the explosion.

so for example:



Change the e in the line marked in green to the entity number of the barricade, name the script destroybarricade.lua and add it to your sandbag in properties, enter the properties of your barricade, and set it to explodable. Then in the game when you get within 80 units of the sandbag it should heoretically reduce the barricades health to zero and trigger the explosion.

(to find the entity number of the barricade, hover your mouse over the barricade in the editor and look on the bottom bar to the left, it should give you the info you need there)

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 29th Sep 2016 17:18
Another idea is to start a timer using LUA script and then after an amount of time enough to complete one explosion animation, you can destroy the entity in the script. This technique would work with any animation, not just explosions (a puff of smoke to reveal the appearance of a Wizard for example).
PC SPECS: Windows 8.1 Pro 64-bit, Intel Core i7-5930K (PASSMARK:13645), NVIDIA Geforce GTX 980 GPU (PASSMARK:9762) , 32GB RAM

Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 29th Sep 2016 17:45 Edited at: 29th Sep 2016 17:46
A Wild Bamber Appears!

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.

Attachments

Login to view attachments
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 29th Sep 2016 17:50 Edited at: 29th Sep 2016 17:54
Thank you all!
@Belidos
But it seems like I'm doing something wrong. Barricade number is 24, so I put it into your script.
I have associated it with sandbag and made barricade explodable and nothing happens
Did I forget something? :/



@LeeBamber
I'll try that
PM
Belidos
3D Media Maker
9
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 29th Sep 2016 18:00 Edited at: 29th Sep 2016 18:03
1. There's a typo in the script... it should be destroybarrier_init(e) and destroybarrier_main(e) not destorybarrier, sorry my bad i've edited the above post to correct it, try again with the new code.

2. Is it an object you're adding it to or a trigger zone? The script i did, you need to put into an object not a trigger zone.

3. Also, try increasing the PlayerDist number, at 80 you need to be practically on top of it.

As i said what i suggested was theoretical, i've never tried it myself and i might be wrong

i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 29th Sep 2016 18:40
Quote: " 1. There's a typo in the script... it should be destroybarrier_init(e) and destroybarrier_main(e) not destorybarrier, sorry my bad i've edited the above post to correct it, try again with the new code."

I copy pasted script name from script itself, so there was no issue with that Tried with 'new one', still nothing happens :/
Quote: " 2. Is it an object you're adding it to or a trigger zone? The script i did, you need to put into an object not a trigger zone."

I'm adding it to that sandbag. Trigger zone is for enemy spawn
Quote: " 3. Also, try increasing the PlayerDist number, at 80 you need to be practically on top of it."

Tried with 80, 200, 1000. Still nothing :/
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Sep 2016 18:45
change static mode to no
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 29th Sep 2016 18:58
Quote: " change static mode to no"

Do you mean sandbag? If yes, then it just disappears (probably falls through the terrain or something).
Also, this is what I've tried to code. Of course it doesn't work.

I should just give up and not waste my time anymore :/
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Sep 2016 19:57
yes the sandbag, if it's moving it's because of physics so either turn physics = no or set isimmobile = yes but use belidos's script as your own is indeed not going to work, you would need a toggle variable to stop the check from destroying the object before you wanted to trigger the timer.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 29th Sep 2016 21:46
Quote: "I should just give up and not waste my time anymore"

That is not the right attitude.

Follow the video tips, add the script to your scriptbank folder, and attach to your barrier.



Attach this script to your decal, place decal closest to barricade, add some explode sound, via properties.



In action



hth

3com




Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
JohnS_CZ
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location: Czech republic
Posted: 30th Sep 2016 19:25 Edited at: 30th Sep 2016 19:25
Quote: " yes the sandbag, if it's moving it's because of physics so either turn physics = no or set isimmobile = yes but use belidos's script as your own is indeed not going to work, you would need a toggle variable to stop the check from destroying the object before you wanted to trigger the timer."

Thank you so much! It works!
Quote: " That is not the right attitude. "

I know, it's just that I really started to get into Game Guru but not knowing LUA scripting is a huge slowdown.
And I get very frustrated when things aren't working as I planned
Quote: "Follow the video tips, add the script to your scriptbank folder, and attach to your barrier."

This is perfect! I'll definitely use this in the future!
'Sandbag solution' is better for my level, but yours could be used for some epic entrances!
@all
Thank you so much for helping me with this one, I really appreciate it.

One last question, are there any good tips, websites or videos, something for learning LUA?
Google found lots of them, but I'd like to hear your opinions if possible
Thanks again!
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Sep 2016 20:53
As you said there are a lot stuff about LUA out there, anyway I'm going to give'u something about:

http://www.lua.org/pil/1.html

http://www.lua.org/manual/5.3/

Lua in GG

http://steamcommunity.com/sharedfiles/filedetails/?id=398177770&insideModal=1

hth

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM

Login to post a reply

Server time is: 2024-12-22 22:27:51
Your offset time is: 2024-12-22 22:27:51