header image
Home arrow Scripting Overview
Scripting Overview PDF Print E-mail
Written by VICE Admin   
Apr 02, 2009 at 02:02 AM

NOTICE: VICE is a constantly evolving and improving combat system.  It works very well with everything we've tested so far, but  as more people use VICE in different products, it's likely that we will discover bugs.  Minor bugs will be addressed in minor updates (like v1.0.0 -> v1.0.1), but more major bugs/exploits will be addressed in more major version updates (like v1.0 -> v1.1), and will result in incompatibilities between the 2 versions.  We plan to keep the scripting interface as uniform as possible between releases, so usually you'll only need to replace the VICE scripts with the newer version.  If you plan to sell VICE-enabled vehicles or weapons, be prepared to issue updates to your customers (either manually or through some automated update system). If you do not provide or offer any kinds of updates, but sell a VICE equipped product, your products may find themselves out of date and incompatible with newer versions.

Providing your customers with updates is not only recommended for VICE equipped products, but it is recommended for any product that contains complex scripting (vehicles in particular), as Second Life in itself is frequently changing and can sometimes break or change content (your customers will thank you for staying on top of technology and improving your products).

 

BASIC SCRIPTING KNOWLEDGE IS RECOMMENDED: Because VICE is an open combat system that allows you to freely choose how to use various link message triggers (versus doing everything for you, and thus impeding creativity), some basic scripting knowledge is strongly recommended if you are interested in scripting VICE vehicles. Included in the SDK are several example vehicles and weapons with full mod control scripts that have VICE integrated. Be opening up these examples and dissecting the control scripts, you can have an idea of how to implement it into your existing builds.

To make the best use of VICE, a basic understanding of these core LSL (Linden Scripting Language) functions and formats is recommended. Understanding these core functions is critical if you are to script anything in Second Life-- a good grasp of these basic functions will provide you with a better understanding of your own scripts. This is particularly important for any content creator that is selling a product (you should know what is going on in your own scripts, or any scripted objects you sell).

  • The format of llLinkMessage
  • Sending a link message
  • Receiving a link message
  • Extracting variables from link messages
  • Storing and recalling various variables (integer, float, key)
  • Setting up conditional statements (if, else, else if, ==, !=, TRUE, FALSE, >, >=, <, <=, |, ||)

Your typical VICE vehicle or weapon will have the following components:

  • A VICE sensor script, which must be placed in the root prim of the weapon/vehicle
  • One or more VICE bullet  rezzer scripts, with accompanying bullet object.  Keep the weapon loadout limits in mind when doing so, or the gun won't work
  • For attachment-based infantry guns, any prim in the linkset will work.  Except for a special case of the SSG, Bullets will always rez at an offset of <1.6,0.0,0.0> relative to the direction the avatar is facing, in the "forward" direction.

  • For non-infantry guns , bullet rezzers should be placed in the guns you want the bullet to emerge from.  For 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).

  • When you first insert any bullet rezzer kit which includes 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 trigger/control script, created by you, which listens to the end user and controls the VICE scripts through link messages. For vehicle makers, the control script is your flight/drive script.

  • Optionally, a bomb rezzer script, configuration notecard, and VICE bombs (can be placed in any prim within 10m of where you'd like to rez the bombs).  Any VICE bomb must contain the "VICE Bomb" script, along with another script to trigger the VICE bomb to explode.  A VICE bomb must have it's object name prefixed with the type of bomb it is; the name must start with "VICE CMB", "VICE SMB", "VICE MDB", "VICE LGB", or "VICE TRP" to be recognized and considered a VICE bomb by the bomb rezzer and detonate properly. 

    IMPORTANT:  be sure to add the VICE Bomb script last, and keep a copy of the bomb in your inventory, because the VICE Bomb script will call llDie() on detonation, or if it's rezzed by an avatar.  The best way to edit a bomb after it becomes VICE enabled is to attach it to your avatar, possibly while your avatar hovers to avoid collision events.

  • Optionally, VICE sensor scripts with integrated TCS compatibility (VICE+TCS) is available (only for INF, ALA, and AMA units), and must be placed in the root prim with the corresponding VICE sensor script.


To enable VICE and start shooting stuff, your control script must first 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. 

For more information about each unit and weapon, please see VICE Unit Overview

For more information about scripting each type of unit, please click on the name of one of the Scripting Guides in the left navigation bar.


Last Updated ( Apr 02, 2009 at 09:34 PM )
Login Form
Username

Password

Remember me
Password Reminder
No account yet? Create one