Scripts / item drop script

Author
Message
Sicbot69
6
Years of Service
User Offline
Joined: 28th Apr 2017
Location:
Posted: 29th Aug 2018 13:15
Hi, is their a script for say like hitting a barrel like 10 times then it breaks and drops a new item?
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 29th Aug 2018 18:20
to make it actually break you would need an animation or to replace it with a model that appears broken (or both).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 1st Sep 2018 03:25
I'm not sure if you found your answer yet since you haven't indicated it has been solved. The breaking of an object is already covered. However, you can also use an exploding barrel. After hitting/shooting it 10 times it will explode. What you can do is place an object within or under the barrel. Here is the script to assign to the barrel to hit 10 times.



When you place the barrel on the map use the highlighted properties. Make sure the strength (health of object) is large enough that it will not explode too soon. Either set IsImmobile or Physics On ? to "no". Both set to "no" is not required. Then make sure that Explodable is set to "yes".



The health pack in the barrel can be spawned but you don't want to take a chance that the player will tip over the barrel. If you allow the player to tip over the barrel then make sure and do not spawn the object at start and use activateifused after the barrel is exploded (after the tenth hit).



There is one other thing, if you tip over the barrel and it starts rolling then the health pack will not go with it. AmenMoses has created the ability to attach an entity to aother entity. The only thing I'm not sure of is if a non-spawned entity can be attached to a spawned entity. The simple fpm for this is attached and the video follows.

Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory

Attachments

Login to view attachments
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Sep 2018 10:25
you could just position the item wherever you want it when the 10th hit lands, no need to move it before that.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Flatlander
GameGuru Master
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 1st Sep 2018 20:20 Edited at: 1st Sep 2018 20:25
I was kind of waiting to hear from the author of this post. But for others tuning in, I would like to mention that you can place the object anywhere on your map. It will only then be visible after you hit the barrel 10 times in which it will destroy the barrel. This could be a part of a mission or an objective to be done before the game is won.

The following video shows the health pack will appear on the table after the objective is accomplished.



As I said, you can put it anywhere. How about under another barrel in which you leave clues as to it's being there. Clues only show up when you obtain the first objective -- blowing up the barrel with 10 hits.



Use your imagination and instinct on creating an interesting and fun game.

Addendum

I forgot to mention that I introduced another command into the script. It can be used as a safeguard to make sure the entity exists before you act on it.

Alienware Aurora R7 with SSD 256GB boot drive ( C: ) and a secondary drive ( D: ) that is 2TB
Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz 3.19 with Intel Turbo-burst
Installed RAM 16.0 GB
64-bit operating system, x64-based processor
Windows 10 Home
NVIDIA GeForce GTX 1070 with 8192 MB GDDR5 and 8095 MB shared system memory

Login to post a reply

Server time is: 2024-04-19 01:42:06
Your offset time is: 2024-04-19 01:42:06