WeaponScripts

From Empires Wiki
Revision as of 02:46, 28 February 2019 by Thexa4 (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Empires Scripting Documentation
Scripting Overview | Vehicle Script Overview | Vehicle Handling Script Overview | Weapon Script Overview | Armor Script Overview | Building Script Overview | Infantry Script Overview | Hint Messages | Loading Screen Script Overview | Tutorials



Overview

This is a glossary of all the attributes that can be used in a vehicle weapon script. The weapon script file can be found in scripts/vehicle_weapons.txt

You place comments in a script file by putting a "//" in front of the comment.

General Characteristics

Name: name given when selecting weapons.
HUD Name: name displayed in the weapon area of the vehicle HUD
Description: description given when selecting weapons
Icon: icon drawn in the GUI
HUD Icon: icon drawn in the vehicle HUD
Size: number of slots required when selecting weapons. Current possible values [1,2,3].
Type: 0=machine gun, 1=tank cannon, 2=artillery cannon, 3=missile launcher, 4=grenade launcher, 5=aircraft bomb bay
Cost: The amount of resources required(deducted from the team) to equip a tank with the weapon.
Team: Which team is allowed to use it. Current possible values ['IMP','NF','ALL'].
Research: The name of a research item that unlocks this weapon, taken from the research scripts.

Sound Characteristics

Sound Firing: The sound played when weapon is being fired.
Sound Impact: The sound played when the weapon makes its final impact.
Sound Reloading: The sound played when the weapon reloads.

Weapon Characteristics

Damage Type: The name of a damage type to be used by the resistance system.
Ammo Type: This value determines what things mg weapons can damage. 0=infantry, 1=infantry+vehicles, 2=buildings+vehicles+infantry.
Damage: The amount of damage inflicted to an enemy target on impact. This value is affected by many things.
MinimalDamage
Falloff
Falloffbase
Speed: The initial velocity of the projectile.
Gravity: effects of gravity on the projectile, only for projectiles. Gravity should normally be constant, although this value is often messed with to compansate for short-comings of the speed modifier.
Heat: Amount of heat inflicted on self when weapon is fired. Vehicles have 200 heat points before they over-heat.
Weight: weight in terms of effects on engine and weight restrictions for chassis
Cycle Time: time between shots in seconds
Clip Size: number of shots before reload.
Total Ammo Clips: number of possible reloads.
Reload Time: time spent reloading in seconds.
Projectile Spread: only applicable to machine guns at the moment. A value of 1 is likely a full 180 degree cone.
Heat To Target: Amount of heat inflicted on the target upon impact. (not included the heat added by the damage to heat modifier of armor).
Explosion Radius: The amount of area around the impact location of a projectile affected by the impact. Making this value too large can bog-down servers. Current range is from 0 to 2000+.
Explosion Force: amount of concussive force applied to physics objects in the blast radius.

Variables for missiles

Dumb Missile: '1' if missile flies straight ahead
Homing Missile: '1' if missile flies towards locked on target
Guided Missile: '1' if missile follows crosshairs after launch
Missile Range: max range in HL2 units (1 inch = 1) that the player can lock onto a target with a homing missile, or range from vehicle being fired from when a guided missile stops following the player's crosshairs
Lock On Time: time it takes for a homing missile to lock onto the target under the player crosshairs
Lock Range Modifier: modifies lock on time based on range (as range increases, lock on time increases based on the modifier: modifier * range to target + lock on time = total lock on time)
Countermeasure Effectiveness
Turning Ability: determines how effective the missile can turn to home in on its target or guide itself to the crosshair for a guided missile; 1.0 means the missile can turn instantly towards its target, 0.0 and the missile doesn't turn at all

Variables for bio damage

Player Bio Damage: damage inflicted to players every interval
Player Bio Time: total time to inflict damage to players
Player Bio Interval: time inbetween each infliction of damage to players
Vehicle Bio Damage: damage inflicted to a vehicle every interval
Vehicle Bio Time: total time to inflict damage to s vehicle
Vehicle Bio Interval: time inbetween each infliction of damage to a vehicle

Variables for particles

ExplosionSprite: explosion sprite to use for explosion, 0 = default, 1 = green (bio), 2 = blue (plasma)
ExplosionSpeed: how fast the explosion sprite fades (15 is default fps)
Tracer Type: Tracer effect, tracer names are logical, a list: tracer_du, tracer_bio, tracer_he, tracer_rifle, tracer_smg, tracer_vehiclemg, tracer_cg, tracer_plasma


source

		// get english text
		const char *name = pWeaponData->GetString("Name", "Name");
		const char *hudName = pWeaponData->GetString("HUD Name", "HUD Name");
		const char *description = pWeaponData->GetString("Description", "Description of item goes here.");

#if CLIENT_DLL
		// perform translation client only
		const char *transName = g_pVGuiLocalize->FindAsUTF8(name);
		Q_strncpy(vehicleWeapon[i]->name, transName, sizeof(vehicleWeapon[i]->name));

		const char *transHudName = g_pVGuiLocalize->FindAsUTF8(hudName);
		Q_strncpy(vehicleWeapon[i]->hudName, transHudName, sizeof(vehicleWeapon[i]->name));

		const char *transDesc = g_pVGuiLocalize->FindAsUTF8(description);
		ExpandPrintFKeyNames(vehicleWeapon[i]->description, sizeof(vehicleWeapon[i]->description), transDesc);
#else
		// just copy the english if not a client
		Q_strncpy(vehicleWeapon[i]->name, name, sizeof(vehicleWeapon[i]->name));
		Q_strncpy(vehicleWeapon[i]->hudName, hudName, sizeof(vehicleWeapon[i]->name));
		ExpandPrintFKeyNames(vehicleWeapon[i]->description, sizeof(vehicleWeapon[i]->description), description);
#endif

		Q_strncpy(vehicleWeapon[i]->icon, pWeaponData->GetString("Icon", ""), sizeof(vehicleWeapon[i]->icon));
		Q_strncpy(vehicleWeapon[i]->hudIcon, pWeaponData->GetString("HUD Icon", ""), sizeof(vehicleWeapon[i]->hudIcon));
		Q_strncpy(vehicleWeapon[i]->soundReloading, pWeaponData->GetString("Sound Reloading", ""), sizeof(vehicleWeapon[i]->soundReloading));
		Q_strncpy(vehicleWeapon[i]->soundImpact, pWeaponData->GetString("Sound Impact", ""), sizeof(vehicleWeapon[i]->soundImpact));
		Q_strncpy(vehicleWeapon[i]->soundFiring, pWeaponData->GetString("Sound Firing", ""), sizeof(vehicleWeapon[i]->soundFiring));
		vehicleWeapon[i]->size = pWeaponData->GetInt("Size", 1);
		vehicleWeapon[i]->type = pWeaponData->GetInt("Type", 0);
		vehicleWeapon[i]->cost = pWeaponData->GetInt("Cost", 5);
		vehicleWeapon[i]->ammoType = pWeaponData->GetInt("Ammo Type", 0);

		vehicleWeapon[i]->damage = pWeaponData->GetFloat("Damage", 50);
		vehicleWeapon[i]->explosionRadius = pWeaponData->GetInt("Explosion Radius", 0);
		vehicleWeapon[i]->explosionForce = pWeaponData->GetFloat("Explosion Force", 0);
		vehicleWeapon[i]->spread = pWeaponData->GetFloat("Projectile Spread", 0.001f);
		vehicleWeapon[i]->speed = pWeaponData->GetInt("Speed", 100);
		vehicleWeapon[i]->gravity = pWeaponData->GetFloat("Gravity", 1.0f);
		vehicleWeapon[i]->heat = pWeaponData->GetFloat("Heat", 0.1f);
		vehicleWeapon[i]->heatToTarget = pWeaponData->GetFloat("Heat To Target", 0.1f);
		vehicleWeapon[i]->dotRadius = pWeaponData->GetFloat("Damage Over Time Radius");
		vehicleWeapon[i]->dotLength = pWeaponData->GetFloat("Damage Over Time Length");
		vehicleWeapon[i]->dotInterval = pWeaponData->GetFloat("Damage Over Time Interval");
		vehicleWeapon[i]->m_flPlayerBioDamage = pWeaponData->GetFloat("Player Bio Damage", 0);
		vehicleWeapon[i]->m_flPlayerBioTime = pWeaponData->GetFloat("Player Bio Time", 0);
		vehicleWeapon[i]->m_flPlayerBioInterval = pWeaponData->GetFloat("Player Bio Interval", 0);
		vehicleWeapon[i]->m_flVehicleBioDamage = pWeaponData->GetFloat("Vehicle Bio Damage", 0);
		vehicleWeapon[i]->m_flVehicleBioTime = pWeaponData->GetFloat("Vehicle Bio Time", 0);
		vehicleWeapon[i]->m_flVehicleBioInterval = pWeaponData->GetFloat("Vehicle Bio Interval", 0);
		vehicleWeapon[i]->weight = pWeaponData->GetInt("Weight", 10);
		vehicleWeapon[i]->cycleTime = pWeaponData->GetFloat("Cycle Time", 0.1f);
		vehicleWeapon[i]->ammoClipSize = pWeaponData->GetInt("Clip Size", 10);
		vehicleWeapon[i]->ammoTotal = pWeaponData->GetInt("Total Ammo Clips", 1);
		vehicleWeapon[i]->ammoUnlimited = pWeaponData->GetInt("Unlimited Ammo", 1) != 0;
		vehicleWeapon[i]->reloadAmount = pWeaponData->GetInt("Reload Amount", 1);
		vehicleWeapon[i]->reloadTime = pWeaponData->GetFloat("Reload Time", 20);
		vehicleWeapon[i]->dumb = pWeaponData->GetInt("Dumb Missile", 0) != 0;
		vehicleWeapon[i]->homing = pWeaponData->GetInt("Homing Missile", 0) != 0;
		vehicleWeapon[i]->guided = pWeaponData->GetInt("Guided Missile", 0) != 0;
		vehicleWeapon[i]->range = pWeaponData->GetFloat("Missile Range", 2000);
		vehicleWeapon[i]->lockOnTime = pWeaponData->GetFloat("Lock On Time", 3.0f);
		vehicleWeapon[i]->lockOnRadius = pWeaponData->GetFloat("Lock On Radius", 10.0f);
		vehicleWeapon[i]->lockOnRangeModifier = pWeaponData->GetFloat("Lock Range Modifier", 0.001f);
		vehicleWeapon[i]->countermeasureEffectiveness = pWeaponData->GetFloat("Countermeasure Effectiveness", 0.9f);
		vehicleWeapon[i]->turningSpeed = pWeaponData->GetFloat("Turning Ability", 0.1f);
		vehicleWeapon[i]->framerate = pWeaponData->GetInt("Explosion Speed", 15);
		vehicleWeapon[i]->sprite = pWeaponData->GetInt("Explosion Sprite", 0);
		vehicleWeapon[i]->drawImpactEffects = pWeaponData->GetInt("Draw Impact Effects", 1) != 0;
		vehicleWeapon[i]->falloffStart = pWeaponData->GetInt("FalloffStart", 5000);
		vehicleWeapon[i]->falloffEnd = pWeaponData->GetInt("FalloffEnd", 10000);
		vehicleWeapon[i]->minimumDamage = pWeaponData->GetInt("MinimalDamage", 1);
		vehicleWeapon[i]->grenadeTimer = pWeaponData->GetFloat("Grenade Timer", 6);
		Q_strncpy(vehicleWeapon[i]->tracerName, pWeaponData->GetString("Tracer Type", "tracer_1"), sizeof(vehicleWeapon[i]->tracerName));
		Q_strncpy(vehicleWeapon[i]->muzzleFlashName, pWeaponData->GetString("Muzzle Flash", ""), sizeof(vehicleWeapon[i]->muzzleFlashName));