User:Jbeta/weaponsets: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 22: Line 22:
*'''ammo''': ammo given
*'''ammo''': ammo given
*'''chance''': chance to get that weapon from the set, in ratio (i.e total sum of chances doesn't have to be 100, you could use 1:1:2:3:1 for example)
*'''chance''': chance to get that weapon from the set, in ratio (i.e total sum of chances doesn't have to be 100, you could use 1:1:2:3:1 for example)
''Note'': if chance isn't specified, the weapon is picked automatically and those below it are ignored.
*'''drop''': possibility to drop the weapon along with held ammo on death, on percentage
*'''drop''': possibility to drop the weapon along with held ammo on death, on percentage
*'''boost''': if the player gets this weapon, he also gets an extra powerup (currently '''armor''' is the only valid boost, may be expanded with stats later)
*'''boost''': if the player gets this weapon, he also gets an extra powerup (currently '''armor''' is the only valid boost, may be expanded with stats later)

Latest revision as of 00:30, 30 December 2006

Assigns weapons to a player based on map-defined weaponsets. Each weaponset may contain any number of weapons with a probability ratio, so that some weapons in the set are more unlikely to be obtained than others.
A drop chance (in percentage) can also be defined on the map file, to make that weapon have more or less chances to be dropped as a pickup, with the amount of ammo held at the moment of death.

Weaponset example

<parent>
	<weaponset>
		<weapon id="3" ammo="1"/>
	</weaponset>
	<weaponset>
		<weapon id="24" ammo="50" drop="100"/>
	</weaponset>
	<weaponset>
		<weapon id="25" ammo="20" chance="35" drop="50"/>
		<weapon id="34" ammo="15" chance="20" drop="50"/>
		<weapon id="29" ammo="120" chance="20" drop="50"/>
		<weapon id="31" ammo="80" chance="15" drop="50"/>
		<weapon id="17" ammo="2" chance="10" drop="50" boost="armor"/>
	</weaponset>
</parent>
  • id: weapon id
  • ammo: ammo given
  • chance: chance to get that weapon from the set, in ratio (i.e total sum of chances doesn't have to be 100, you could use 1:1:2:3:1 for example)

Note: if chance isn't specified, the weapon is picked automatically and those below it are ignored.

  • drop: possibility to drop the weapon along with held ammo on death, on percentage
  • boost: if the player gets this weapon, he also gets an extra powerup (currently armor is the only valid boost, may be expanded with stats later)

Usage

The weapon assignment function is:

table AssignWeapons ( player player, element parent, [ bool dropenabled = nil ] )

Returns a table with the chosen weapon elements if assignment was successful, false if all weaponsets were empty.