29 个评价
EMS: Random Item Spawning Script
由 Rectus 制作
This is a slightly simpler version of the random item spawning script I made for Gun Hunt. It is only usable with the Extended Mutation System in the Left 4 Dead 2 Beta.

The script gives you the ability to randomly spawn items at preset spawnpoints at any time you choose. It's a similar to the weapon spawning in Killing Floor, or the Battlefield 3 Scavenger mode. It is made to work in an EMS mutation script, but can with some modification work with map level scripts as well.


NOTE!
The up to date version of the script is avalable in VSLib[github.com].
   
奖励
收藏
已收藏
取消收藏
Usage
Download: VSLib github
https://github.com/L4D2Scripters/vslib

Pastebin links (old version without class):
Script[pastebin.com]
Entity Group[pastebin.com]

The spawner uses an array of vectors or VSLib entities for spawn points.

To use the script, include it into any script with:
IncludeScript("VSLib");

To intitialize a spawner create a spawner object:
VSLib.RandomItemSpawner(spawnArray, itemArray = null, flags = 0)

There are two optional argumets:

itemList: Use a custom item list of the same format as the one below.
flags:
RANDOM_USEPARTICLES: Spawns a fireworks particle effect where an item spawns.
RANDOM_ALLOWMULTIPLEITEMS: Can spawn multiple items on the same spawnpoint during a single call of SpawnRandomItems().

Example:
mySpawner <- VSLib.RandomItemSpawner(mySpawnArray, myItemArray, (RANDOM_USEPARTICLES | RANDOM_ALLOWMULTIPLEITEMS));


Items are spawned with: SpawnRandomItems(amount)
Where amount is the number of items spawned. The function returns an arrray with the entity objects of the items spawned.

Example:
spawnedItemArray = mySpawner.SpawnRandomItems(5);
Spawn lists
This list determines what items can spawn, and the probability of each weapon spawning. If no list is specified, the default one below is used.

The item probability is relative to the other items, the actual spawning probability is the items probability divided by the probabilities of all items added together.

Melee weapons and upgrades get converted to other entities when they spawn. They are untrackable, and will not be returned by the spawning function.

ent: Classname of the item. The spawn list currently supports the entities specified below.
prob: This is the probability for the item to spawn.
ammo: The ammo reserves primary weapons spawn with. Weapons spawn with double the value set. Set to null on other items.
melee_type: Works the same way as on a weapon_melee_spawn. Set to null if not a melee weapon.

myItemArray <- [//[] //Entity: Probability: Ammo: Melee type: {ent = "weapon_rifle" prob = 10, ammo = 50, melee_type = null }, {ent = "weapon_shotgun_spas" prob = 10, ammo = 10, melee_type = null }, {ent = "weapon_sniper_military" prob = 10, ammo = 15, melee_type = null }, {ent = "weapon_rifle_ak47" prob = 10, ammo = 40, melee_type = null }, {ent = "weapon_autoshotgun" prob = 10, ammo = 10, melee_type = null }, {ent = "weapon_rifle_desert" prob = 10, ammo = 60, melee_type = null }, {ent = "weapon_hunting_rifle" prob = 15, ammo = 15, melee_type = null }, {ent = "weapon_rifle_m60" prob = 2, ammo = 50, melee_type = null }, {ent = "weapon_grenade_launcher" prob = 2, ammo = 50, melee_type = null }, {ent = "weapon_smg_silenced" prob = 20, ammo = 50, melee_type = null }, {ent = "weapon_smg" prob = 20, ammo = 50, melee_type = null }, {ent = "weapon_shotgun_chrome" prob = 20, ammo = 10, melee_type = null }, {ent = "weapon_pumpshotgun" prob = 20, ammo = 10, melee_type = null }, {ent = "weapon_pistol_magnum" prob = 5, ammo = null, melee_type = null }, {ent = "weapon_pistol" prob = 10, ammo = null, melee_type = null }, {ent = "weapon_adrenaline" prob = 10, ammo = null, melee_type = null }, {ent = "weapon_pain_pills" prob = 20, ammo = null, melee_type = null }, {ent = "weapon_vomitjar" prob = 3, ammo = null, melee_type = null }, {ent = "weapon_molotov" prob = 10, ammo = null, melee_type = null }, {ent = "weapon_pipe_bomb" prob = 10, ammo = null, melee_type = null }, {ent = "weapon_first_aid_kit" prob = 1, ammo = null, melee_type = null }, // Note: These items don't retain their entities when spawned, and cannot be tracked. {ent = "weapon_melee_spawn" prob = 10, ammo = null, melee_type = "any" }, {ent = "upgrade_spawn" prob = 3, ammo = null, melee_type = null }, // Laser sight only {ent = "weapon_upgradepack_explosive" prob = 5, ammo = null, melee_type = null }, {ent = "weapon_upgradepack_incendiary" prob = 7, ammo = null, melee_type = null }, //[] ]
16 条留言
Rectus  [作者] 2018 年 7 月 29 日 上午 12:35 
I'm not sure, I haven't tried it. This is a library meant to be accessed from inside another script though, so you wouldn't really have any gain from loading it from a console commnad.
WAIT 2018 年 7 月 28 日 下午 5:45 
does script_execute work for this? I don't want the IncludeScript
Alexey_Sklyar 2018 年 5 月 22 日 下午 12:45 
Left 4 Dead 2 Beta как удалить с аккаунта стим?
sighrltat02 2018 年 2 月 22 日 上午 4:32 
wo:GiveHug:w
Fina 2017 年 11 月 23 日 下午 3:50 
wow
Rectus  [作者] 2017 年 4 月 30 日 上午 12:27 
Check out the dates on the guide. People were using the beta when there was actual stuff to beta test.
H3X_COKX 2017 年 4 月 29 日 下午 8:32 
why would you make a guide for a beta that no one plays?
@@ 2016 年 4 月 29 日 下午 11:11 
...
Rectus  [作者] 2016 年 3 月 6 日 上午 10:45 
Are you sure? I don't think it does unless they ported over the entity spawning functions.
Royal Menace 2014 年 12 月 26 日 下午 7:47 
wow
:gmod::sadelf: