Left 4 Dead 2

Left 4 Dead 2

39 ratings
Break Objects = Get Rewards (Vscript)
   
Award
Favorite
Favorited
Unfavorite
Game Content: Scripts, Miscellaneous
Game Modes: Single Player, Co-op
File Size
Posted
Updated
43.022 KB
14 Dec, 2024 @ 7:13am
13 Feb @ 11:40pm
3 Change Notes ( view )

Subscribe to download
Break Objects = Get Rewards (Vscript)

In 1 collection by kurochama
Useful "Side-Dish" Mods (Especially for Bots)
46 items
Description
This is a variant (or you can also call this the little brother) of my Item Randomizer mod. I just used few simple scripts here to give some rewards to players who break objects.

Q: "What makes it different from Manacat's item spawner when breaking some boxes?"
A: "This one is uses my 'Item Randomizer' mod as the reference, so the scripts inside are much simpler. The basic mechanisms should be similar, but on this mod, not only boxes, item can also spawn when breaking window glasses & any breakable objects."
Q: "As this also spawns items on destroyed boxes, will this have a problem if used together with Manacat's mod with similar mechanisms?"
A: "Instead of a problem, you may get double rewards instead, from Manacat's & this mod if you're lucky."
Q: "One more question. As this basically spawns an item, will this increase the number of entities each time the rewards spawn?"
A: "The mechanism is like a 'Give & Take'. The destroyed object is basically removed from a map, & at the same time a new item is spawned on the destroyed object location. So, the number of entities shouldn't increase. & you can also configure a cleanup timer & the spawn chance for rewards via cfg file, so the rewards won't spawn too often & there's a regular cleanup timer to regularly remove rewards that are not picked by survivors."

So, to put it simply, this mod allows survivors to get some rewards anytime they break an object, no matter if it's a door, window glass, crate, box, small object, anything. The chance of getting rewards can be configured via cfg file. & here's an animated preview for the example, while waiting until I upload the video preview:


List of available features on "break objects - get rewards.txt" cfg file:
  1. Object Breaker Mode: Which mode is used & who can get the rewards (survivors only/ SI + tank only/ all). Special infected & tank only get random health recovery rewards when breaking objects (for now).

  2. Object Breaker Type: Which type of player can get the rewards (bots only/ players only/ all).

  3. Reward Chance: The percentage or reward drop on each object destroyed. Min= 1 (1%), max= 100 (100%, always drop rewards).

  4. Troll Reward Mode: When enabled, sometimes survivors will get some troll rewards, like a special infected, witch or even tank spawning on the destroyed object, or some debuffs like getting biled, fire triggered on the ground etc. The chance for troll rewards are 33.3%, so 66.7% chance is for normal rewards.

  5. Object Cleanup Countdown: A regular cleanup timer on spawned rewards when reloading a gun. When the timer exceed the value of this feature, the rewards will be removed. The value is equal to second. Min= 0 (0 second, instant cleanup after reloading), max= no limit.

As this is only a mod for fun, just edit the cfg file as you like, with your own preferred settings. & have fun...

NOTES:
  • A video preview will be added later.
  • The reward results are completely randomized, from melee, pistols, T1 guns, T2 guns, throwables, healing items etc.
  • There's a "special gnome" dropped on the ground when breaking objects. This gnome is "Ammo Dealer Gnome" that will disappear after a survivor presses E on him (this is actually ammo piles with gnome skin, & just one-time-use). Even he will disappear if you press E when ammo is still full. So, touch him only when you really need ammo. This gnome will also disappear when "Object Cleanup Countdown" is triggered.
25 Comments
ww 3 Jan @ 3:47am 
To utilize the CommandABot() function, you would apply the retreat command and the attack command in this manner.
ww 3 Jan @ 3:47am 
To utilize the CommandABot() function, you would apply the retreat command and the attack command in this manner.
ww 3 Jan @ 3:46am 
To utilize the CommandABot() function, you would apply the retreat command and the attack command in this manner.
ww 28 Dec, 2024 @ 3:02am 
Take a closer look at the console, it will be of greater help.
ww 28 Dec, 2024 @ 2:58am 
Later, I will explain to you why the ‘bug’ command can be used to debug bots. For now, just use the ‘bug’ command and follow the appropriate steps to debug the bots, and keep exploring.
ww 28 Dec, 2024 @ 2:54am 
In fact, it is very useful for creators of survivor bot mods, but most people are likely to think of it merely as a command to open a bug report. To be honest, I don’t want these commands to be buried; they should be known to creators.
ww 28 Dec, 2024 @ 2:51am 
@kurochama For the ‘bug’ command, once you try it, you will discover a whole new world, which means you no longer have to debug bots with just your naked eye, but will have more information at your disposal.
kurochama  [author] 27 Dec, 2024 @ 9:48am 
@ww , thanks for the info for the cvars. For "sb_rescue_vehicle_loading_range" I'm not sure if that cvar could help much in making bots hurry to go to rescue vehicle, but it's worth a try on my bot mods. as for "bug" command, I haven't tried it yet, as I usually used "Think" function to modify the survivor bots, so it's also a new command to me.
ww 27 Dec, 2024 @ 5:29am 
Additionally, you can use the “bug” command in the console to debug the SurvivorBots. Simply ignore the popup form that appears and click “Return to Game.” To stop debugging, enter “bug” again and cancel the form. This might help you.
ww 27 Dec, 2024 @ 5:26am 
In the console, there is a command called sb_rescue_vehicle_loading_range, which determines “How close to the arrival point of the rescue vehicle SurvivorBots try to get.” Its default value is 300. You can try gradually increasing or decreasing this value to test its effects.