Scripts / Request: Breaking items script (Like tables and barricades)

Author
Message
Mipastu
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 16th Feb 2015
Location: Finland
Posted: 11th May 2015 18:22
Im pretty new on this... And im requesting script that i can brake entities like tables and barricades.
I want to learn LUA the best i can, But as a "newbie" Im asking for this, Or even advice how to make one.

(I tried "explode" feature, But player will take damage from it even if its set to 0, Some bug maybe?)
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 12th May 2015 23:16
Exploding object that break into pieces are made in a 3d program and then exported to GG. Then you need the script to initialize the animation inside the model.

A script alone will not break apart a model that is not made for this. Sorry.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Mipastu
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 16th Feb 2015
Location: Finland
Posted: 14th May 2015 12:35
i need it only to play sound and then the barricade "dissappears" ?
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 15th May 2015 03:57
Do you want to initiate this thru a trigger zone or from the object itself?
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Mipastu
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 16th Feb 2015
Location: Finland
Posted: 15th May 2015 13:31 Edited at: 15th May 2015 13:40
I want it to break when i punch it couple times with hatchet.

So from the entitie.
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 17th May 2015 01:53
is there a way to shoot at an object and it just disappears?
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 17th May 2015 10:25
Quote: "is there a way to shoot at an object and it just disappears?"

Yes, should be no problem. You could even do it yourself. Give the entity a strenght value higher 0 and write in the script:


that should do the trick
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th May 2015 17:28 Edited at: 17th May 2015 17:48
Quote: "Quote: "is there a way to shoot at an object and it just disappears?"
Yes, should be no problem. You could even do it yourself. Give the entity a strenght value higher 0 and write in the script:


that should do the trick"


just to fix this but that only works for characters, you need to manually check the HP of normal objects (still needs to have an actual HP value set in it's properties though as corno said

so inside the main(e) part of the script use this


edit; noticed the OP wanted a sound to play
break_object.lua


life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 17th May 2015 18:30
thank you for your help but i didn't understand all of it yet.
i have a wooden barrier, it's called "Wood barricade" and is from the "scenery" of the GG stock media!
i want to crash this barrier with a melee weapon to reveal a secret way.
could you tell me what i have to do and where i would have to write what? i doesn't need a sound effect but it would be nice if it wouldn't be too difficult. i have no clue about this. i have to open the FPE file, right? and edit it? sorry for being so stupid

http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th May 2015 18:38 Edited at: 17th May 2015 18:41
nope, open a blank text file (in notepad is fine)
copy the entire code snippet into it

save it as
Quote: "break_object.lua"
(note: not .txt)
open your gameguru folder and find the scriptbank folder and copy/paste the file you created inside

now when in game guru editor right click the wooden barrier and assign the script to it, give it some HP and give it a sound effect at slot 0

to find the weapon ID number for the weapon you are holding you use
Prompt(g_PlayerGunID)
inside the main(e) part of the code - i'm not sure if everyone gets the same values or how it is worked out.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 17th May 2015 18:54
thanks for this help! i just did that. i created the lua file and did what you see in the picture. what did i do wrong? it doesn't work
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th May 2015 19:52
for scripts to work the object must be dynamic (i.e. static = no -> it'll have a green glow instead of red) - it's at the top of the properties menu there
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 17th May 2015 21:36 Edited at: 17th May 2015 21:40
Quote: "scriptbank\break_object.lua1: unexpected symbol near '1'"

this is what i get when i start...

EDIT:
it was my fault, i messed up the script and the line numbers... now it works! but without the sound i put in slot 0
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 17th May 2015 22:46
Make sure you also adjust the fpe file with something like this.



Harry
Harry
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 17th May 2015 23:28
glad you fixed the issue, it only plays the sound for the weapon you set (or as the script says - set to 0 for all)
@harry you dont need to do that if you set the sound yourself (that's only to auto assign the sound)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 18th May 2015 06:22
thanks for your help @all! i will take a look at this again tonight.

ps.: i tried to hit the barricade with a pipe and shoot it with tha colt1911 but in both cases i had no sound.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 23rd May 2015 23:58
can you help me with this? this is a screenshot of what i did. it does not work anymore. since the last update. is there a connection or do i have a mistake in there that i didn't see??
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th May 2015 16:26 Edited at: 24th May 2015 16:38
when you say it doesnt work can you be a bit more specific about which part doesnt work? is it causing an error now? does the sound just not play? etc

it might just be that the weapon number (12) has changed
edit; oh and you need to give it a strength value again, 0 is unkillable
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 24th May 2015 19:49
oh sorry, i mean, when i hit the barricade with a melee weapon it doesn't break. nothing happens. i had this working already and i wanted to make the sound work and now it doesn't work at all. i messed up something.

what do you mean, strengh value? i have 0 now, but i had this before already. wich value would be right for that?
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th May 2015 20:55
it does indeed work with 0 strength i just thought the invulnerability would protect it but apparently not... well it depends how many hits you want it to take as to how much strength to give it, anything below the weapons damage value will be 1 hit and so on.

it's still working fine for me, try deleting the object from the editor and placing a new 1
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 25th May 2015 01:47
so... i deleted the object and i did everything again. i compared it to the screenshot and it still doesn't work. when i hit the barricade it doesn't break?!
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 25th May 2015 10:58
Quote: "so... i deleted the object and i did everything again"

If you did this, so likely weapon id has changed, so you has to change it in script too.
In another words after that, "Weapon variable" is not = 12.

if g_PlayerGunID == weapon or weapon == 0 then
PlaySound(e,0)
end

Then weapon is not = 12 or 0, so the if stament does not met, as smallg suggest above.

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

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

PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th May 2015 17:09
well the weapon requirement is only for the sound, it will still break no matter which weapon you are using

try moving the object forward a bit, i see in your screenshot it's inside another wall, perhaps it's registering you are hitting the other wall and not the barricade
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 25th May 2015 19:32
now it can be destroyed but before i can do so it's falling to the ground
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th May 2015 20:15
ok getting there then
now set it immobile and it should work fine
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 25th May 2015 21:37
ah! that was my error! thank you!
but the sound... is this right in the fpe file?

;Sound
soundset = audiobank\3woodD.wav
soundset1 = audiobank\3woodD.wav

?
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 26th May 2015 19:42
this is what my actual file looks like. when i hit the wll with the pipe it breaks but i don't get the sound that i attached. is there something wrong? i'm using the script you posted here and changed nothing in the fpe file.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th May 2015 21:16
most likely just not the correct weapon id - these change i believe so we cant really help you other than what i've already posted

Quote: "to find the weapon ID number for the weapon you are holding you use
Prompt(g_PlayerGunID)
inside the main(e) part of the code - i'm not sure if everyone gets the same values or how it is worked out."


otherwise just use this version
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 27th May 2015 12:51
thank you for helping me. my biggest problem is the lack of understanding. this is really a strange world for me. i will try this and tell you what happened. i totally don't know what a weapon index is or where i can find it but i will try your new code. just exchange with the original "break_object.lua"
sorry, i'm really dumb on this.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 27th May 2015 13:07
thank you for helping me. my biggest problem is the lack of understanding. this is really a strange world for me. i will try this and tell you what happened. i totally don't know what a weapon index is or where i can find it but i will try your new code. just exchange with the original "break_object.lua"
sorry, i'm really dumb on this.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 29th May 2015 17:36
i tried it again with another weapon, with the axe and the colt 1911 but it didn't work with sound. the rest is working. if i don't get the sound working it's still okay. i can beat down the wall and go thru it.
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti

Login to post a reply

Server time is: 2024-04-27 05:05:37
Your offset time is: 2024-04-27 05:05:37