This section of the guide details how to install VICE into non-infantry weapon types, which encompass virtually every other unit type, other than TGT.
See the "VICE Unit Overview" page for a description of each unit type.
A vehicle or fixed-type sensor must always be a nonphantom object (never an attachment). Bullet hits to any prim in the vehicle will cause damage, as well as bombs detonating near it. Unfortunately, current limitations to SL's collision system mean that hits to an avatar sitting on the vehicle will not be felt by the VICE sensor (but this is a rare occurance, in practice).
Installation:
To install VICE into a vehicle or fixed-position gun, you will need the following components:
- A VICE sensor script, corresponding to the desired unit class. This must be placed in the root prim of the object
- A control script, created by you, which listens to the end user and controls the VICE scripts through link messages. Typically, this control script will also be responsible for vehicle controls and physics.
**Examine the VICE ALA Test Aeroplane to see a full working example.
Optional components:
- VICE bullet rezzer scripts, with accompanying bullet object and melee attack object
Vehicle/Fixed bullet rezzers should be placed in the guns you want the bullet to emerge from. For CMG, LMG & HMG, bullets will always rez 3.5m in front of the gun, oriented to fire in the local +z direction of the prim they were placed in (this is convenient because it will line up with any "particle bullets" used by TCS. CAN also follows this default rez orientation, although a custom rez orientation may be specified.
The CMG, LMG and HMG bullet rezzer scripts come in 2 pieces: a master script and a slave script. You will need to place both scripts into the same prim, in order to have a working gun .
Bullets for each weapon type are unique, so you will need to match them by name (for example the "VICE HMG Bullet Rez v1.2.0" script uses the "VICE HMG Bullet Rez v1.2.0" bullet object.
When you first insert any bullet rezzer kit which include s a slave script, the slave script will rez bullets constantly in the direction of fire. Do not be alarmed, however- those bullets are not combat-enabled and cannot hurt other VICE combatants. To stop this constant rezzing, place the "Disable VICE Bullet Slave script" script into the same prim as your bullet rezzer; it will disable any slave scripts it finds.
- A VICE bomb rezzer script, configuration notecard, and VICE bombs (placed in any prim of the weapon). See the "VICE Bombs" section of the guide for more details.
For working examples, please try the VICE ALA Test Aeroplane, which is a fully-functional fighter biplane with VICE installed.
Link Messages
To enable VICE and start shooting stuff, your control or trigger script must send the "seated" message to the linkset, then the "vice ctrl" message to enable VICE. Then simply send the "gun ctrl" message to the linkset when the gunner starts or stops firing.
The following is a complete listing of all of the link messages that can be SENT TO a VICE vehicle sensor:
integer is the numerical value you send in the link message's integer field. Integers are all whole numbers. TRUE=1, FALSE=0.
string is the text you send in the link message's string field. Strings are always in a "text" format.
key is the uuid you send in the link message's key field. Keys are typically in uuid format, although you can get extra functionality by using the field to communicate text and numerical values. This can be accomplished by preceding non uuid values in the key field with (key)
Description self explanatory
integer |
string |
key |
Description |
is_seated |
"seated" |
gunner_key |
associates an avatar's uuid with the combat sensor.
is_seated value of 0, or FALSE, disassociates the av; values >1 or TRUE associate it with gunner_key, which is uuid of avatar. INF gunner_key should be llGetOwner(). |
vice_on |
"vice ctrl" |
"" |
turns VICE on and off.
vice_on value of 0, or FALSE, turns VICE off. All other values turn it on. |
gun_fire |
"gun ctrl" |
rez_offsets |
Controls firing of the gun
for full auto mode/weapons, gun_fire value of 0, or FALSE, ceases fire. All other values fires gun.
for semi auto mode/weapons, gun_fire value of 1, or TRUE causes single bullet to be rezzed.
rez_offsets offers a non-default bullet rez position and rotation offset, and is only available in semi-auto mode.
rez_offsets is parsed as a string with 2 comma-separated values: rez_pos_offset and rez_rot_offset. A typical value for rez_offsets might be "<2.3,-0.38,-0.2>,<0.0,0.0,0.0,1.0>", with rez_pos_offset=<2.3,-0.38,-0.2> and rez_rot_offset=<0.0,0.0,0.0,1.0> (zero rotation). In this case, the bullet would fire in the default direction but have a different rez offset position than default. <2.3,-0.38,-0.2> (which is used by the SSG test gun) might be a good rez offset value for a kneeling infantryman. |
team |
"vice team" |
"" |
joins a team.
team=0 indicates no team, team 1~4 selects one of 4 possible teams. See "VICE Teams & Channels" for more information. |
channel_type |
"channel" |
channel_password |
joins a combat channel.
channel_type=0 joins the default public combat channel. channel_type=1 joins a private combat channel, specified by channel_password.
using "ff" as a prefix and appending to channel_password allows friendly fire to be turned on. See "VICE Teams & Channels" for more information. |
0 |
"death message" |
death_message |
sets a custom death message that another avatar will see when they kill you.
message is contained in death_message and is limited to 30 characters. |
0 |
"kamikaze" |
"" |
initiates kamikaze mode.
only aircraft units, and the BLA unit support this feature. Your vehicle will become a bomb that will detonate on collision with any object (except VICE bullets), or the ground. It cannot be turned off once you turn it on. |
bomb_control |
"bomb" |
"" |
sent by control script to instruct bombs to drop.
bomb_control>=0 drops bomb(s). bomb_control=0 will drop all bombs available in the payload, while bomb_control=1,2,3 or 4 instructs rezzer to drop certain bomb in the payload.
reloading time for bombs is 10 seconds once payload is expended. |
The following is a complete listing of all of the link messages that are RECEIVED FROM a VICE vehicle sensor:
integer is the numerical value received from the incoming link message's integer field. Integers are all whole numbers. TRUE=1, FALSE=0.
string is the text received from the incoming link message's string field. Strings are always in a "text" format.
key is the uuid you received from the incoming link message's key field. Keys are typically in uuid format; VICE uses the key field to send information that can be stored and kept as other variable types.
Description self explanatory
integer |
string |
key |
Description |
vice_stats |
"vice stats" |
link_hit |
Combination of all of a unit's VICE combat stats, in one line. received when combat is initialized, or whenever stats change.
vice_stats=(kills&63)<<26 | (deaths&63)<<20 | (hits&4095)<<8 | hp&255
This means that the maximum number of kills/deaths is 63 each, hits (damage dealt to other combatants) goes up to a maximum possible of 4095, and maximum HP is 255. By combining the stats, I believe that overall lag can be reduced, since any script interested in the combat statistics (like a HUD) only has to check for a single link message string. See the table below to for easy access to VICE stats parsing.
link_hit indicates the link that an incoming bullet collided with whenever HP has decreased. For splash damage (bombs etc) link_hit="-1" (LINK_SET). Otherwise, link_hit should always equal "1" for attached infantry guns, which means that the "avatar link" was hit. |
reload_state |
"reload" |
"" |
received to indicate ammunition status of SCG, SMG, SSG, and CAN.
reload_state=0 indicates ammo is depleted (SCG and SMG only), reload_state=1 indicates reload is complete and gun is ready to fire (SCG,SMG,SSG,CAN). |
overheat_state |
"overheat" |
"" |
received to indicate overheat state of machine gun/cannon (CMG,LMG,HMG)
overheat_state=1, or TRUE indicates the gun is overheated and unable to fire. overheat_state=0, or FALSE indicates the gun is able to fire. Sent by only one gun to reduce link message chatter. |
crash_code |
"crash" |
killer_id |
received when the player dies.
See Crash Code table below for listing of all Crash Codes that are sent by VICE sensors |
bomb_contol |
"bomb" |
"" |
received after a bomb is reloaded.
bomb_control=-1,-2,-3,-4 received by the bomb the rezzer to indicate which bomb is ready to be dropped again, after reloading finishes. |
Crash Code table
crash_code |
Explanation |
0 |
uncrashed (unit regenerated) |
1 |
TCS initiated crash |
3+ |
VICE initiated crash |
3 |
death by SCG |
4 |
death by LMG |
5 |
death by HMG |
6 |
death by CAN |
7 |
death by SMG |
8 |
death by SSG |
9 |
death by MLE |
10 |
death by CMG |
13 |
death by SMB |
14 |
death by MDB |
15 |
death by LGB |
16 |
death by TRP |
17 |
death by KMK |
18 |
death by CMB |
Parsing VICE Stats
Variable |
How to extract from vice_stats |
vice_kills |
(vice_stats>>26)&63 |
vice_deaths |
(vice_stats>>20)&63 |
vice_hits |
(vice_stats>>8)&4095 |
vice_hp |
vice_stats&255 |
Other Notes
- Larger unit types are intended to be used in conjunction with infantry. For example, the AHA has low allocation for guns and is mostly armed with bombs. This is because defensive guns should be associated with the unit's crew members, who might be armed with a CMG or similar weapon.
- Extremely large vehicles (such as an 80m long multimove ship in several linksets) are recommended to be set as VICE Targets, with the battle stations (AA guns, torpedo launchers, etc) configured as fixed-position guns. This way, attackers can kill individual crew members before sinking the entire ship.
As mentioned above, it is very important to set llPassCollisions(TRUE) in every child prim script, on vehicles programmed for kamikaze attacks or special crash effects. Otherwise, such scripted child prims will block all ground collisions and result in an embarrassing lack of crashing.
|