|
|
It is currently Tue May 21, 2024 12:23 pm
|
View unanswered posts | View active topics
|
|
|
|
|
Users browsing this forum: No registered users and 3 guests |
|
|
|
|
|
|
|
|
|
Author |
Message |
TE-Noxwizard
Joined: Tue Jun 07, 2005 5:59 pm Posts: 942 Location: Texas
|
Posted: Wed Jun 08, 2005 7:19 pm Post subject: Lesson Two
|
|
|
Since there were no questions about Lesson One, I'm moving into Lesson Two. It is shorter. We will be making the Railgun. It has two images.
In base, you need to: add the weapon to the armors you want to carry it (armordata.cs) in Item.cs: define ammo ($WeaponAmmo) add the weapon to weapon rotation Code: | $NextWeapon[Chaingun] = DiscLauncher; $NextWeapon[DiscLauncher] = GrenadeLauncher; $PrevWeapon[DiscLauncher] = Chaingun; $PrevWeapon[GrenadeLauncher] = DiscLauncher; |
define itemimagedata and itemdata define projectiles in baseprojdata and explosion tag in baseexpdata. you can create a new sound in nsound.cs if you like.. in station.cs: add to stations so you can buy Code: | $InvList[Disclauncher] = 1; $RemoteInvList[Disclauncher] = 1 |
add ammo to resupply from stations Code: | %cnt = %cnt + AmmoStation::resupply(%player,DiscLauncher,DiscAmmo,2) |
Weapon rotation can be a real pain. If you lock up while switching weapons forwards or back, check there.
Double weapons are fairly simple, heres a simplified version based on Annihilations Railgun.
First create a second weapon image to use:
Code: | ItemImageData Railgun2Image { shapeFile = "shotgun"; mountPoint = 0; mountOffset = { 0, -0.2, 0 }; mountRotation = { 0.005, 0, 0 }; weaponType = 0; projectileType = RailRound; accuFire = true; };
ItemData Railgun2 { description = "Railgun"; shapeFile = "shotgun"; className = "Weapon"; heading = $InvHead[ihWea]; shadowDetailMask = 4; imageType = Railgun2Image; showWeaponBar = true; showInventory = false; price = 0; }; |
Then include some code to mount and remove it when the parent weapon is mounted:
Code: | function Railgun::onMount(%player,%item) { Player::mountItem(%player,Railgun2,4); }
function Railgun::onUnmount(%player,%item) { Player::unmountItem(%player,4); } |
Author-Plasmatic
Last edited by TE-Noxwizard on Mon Sep 19, 2005 10:52 am, edited 1 time in total.
|
|
|
|
|
|
|
|
|
|
|
|
|
Author |
Message |
TE-Noxwizard
Joined: Tue Jun 07, 2005 5:59 pm Posts: 942 Location: Texas
|
Posted: Wed Jun 08, 2005 7:31 pm Post subject:
|
|
|
Anyway, you're probably wondering what everything is and does. Here's a breakdown.
Code: | $AutoUse[Blaster] = True; //Will be automatically put on $SellAmmo[BulletAmmo] = 25; //How much ammo to remove when dropping or selling it $WeaponAmmo[Blaster] = ""; //Name of ammo for that weapon, the blaster doesn't use ammo
$NextWeapon[EnergyRifle] = Blaster; // <-- Blaster's weapon cycle $NextWeapon[Blaster] = PlasmaGun; // <-- Blaster's weapon cycle $NextWeapon[PlasmaGun] = Chaingun; $NextWeapon[Chaingun] = DiscLauncher; $NextWeapon[DiscLauncher] = GrenadeLauncher; $NextWeapon[GrenadeLauncher] = Mortar; $NextWeapon[Mortar] = LaserRifle; $NextWeapon[LaserRifle] = EnergyRifle;
$PrevWeapon[Blaster] = EnergyRifle; // <-- Blaster's weapon cycle $PrevWeapon[PlasmaGun] = Blaster; // <-- Blaster's weapon cycle $PrevWeapon[Chaingun] = PlasmaGun; $PrevWeapon[DiscLauncher] = Chaingun; $PrevWeapon[GrenadeLauncher] = DiscLauncher; $PrevWeapon[Mortar] = GrenadeLauncher; $PrevWeapon[LaserRifle] = Mortar; $PrevWeapon[EnergyRifle] = LaserRifle;
//That is the weapon cycle, when you add a new weapon, you need to put it in the cycle.
ItemImageData BlasterImage //Defines the image that will be used { shapeFile = "energygun"; //Name of the image mountPoint = 0; //How it will be rotated
weaponType = 0; // 0 Single Shot, 1 Continuous, 3 Disc reloadTime = 0; //Time it takes to reload fireTime = 0.3; //Time it takes to fire minEnergy = 5; //Minimum energy needed to fire maxEnergy = 6;
projectileType = BlasterBolt; //Name of projectile being fired accuFire = true; //Tells if AccuFire is used for this weapon
sfxFire = SoundFireBlaster; //Name of sound on firing sfxActivate = SoundPickUpWeapon; //Name of sound when it is picked up };
ItemData Blaster //Defines the Blaster { heading = "bWeapons"; //Name of the category it is put in description = "Blaster"; //Description that will be in inventory className = "Weapon"; //Type of item shapeFile = "energygun"; //Name of shape used hudIcon = "blaster"; //Name of picture to show the ammo count, on the left shadowDetailMask = 4; //Amount of shadow imageType = BlasterImage; //Name of image defined for this weapon price = 85; //Price of weapon showWeaponBar = true; //Do you want it on the weapon bar? };
One more:
ItemData MortarAmmo //Defines the ammo { description = "Mortar Ammo"; //Name that shows up in the inventory className = "Ammo"; //What it is heading = "xAmmunition"; //What category it goes in (inventory station) shapeFile = "mortarammo"; //name of shape used for the ammo shadowDetailMask = 4; //Amount of shadow price = 5; //Cost };
ItemImageData MortarImage //Defines Image { shapeFile = "mortargun"; //Shape used for the gun's picture mountPoint = 0;
weaponType = 0; // Single Shot //Single shot, continuous fire, disc? ammoType = MortarAmmo; //Type of ammo used projectileType = MortarShell; //Name of projectile (DTS shape name) accuFire = false; //Will lob instead of shoot straight reloadTime = 0.5; fireTime = 2.0;
lightType = 3; //Light generated by projectile lightRadius = 3; //Radius of that light lightTime = 1; //Time that the light lasts lightColor = { 0.6, 1, 1.0 }; //Colors used
sfxFire = SoundFireMortar; sfxActivate = SoundPickUpWeapon; //Sound when you switch to it sfxReload = SoundMortarReload; //Sound used when it reloads sfxReady = SoundMortarIdle; //Idle sound };
ItemData Mortar //Defines the mortar { description = "Mortar"; className = "Weapon"; shapeFile = "mortargun"; hudIcon = "mortar"; heading = "bWeapons"; shadowDetailMask = 4; imageType = MortarImage; price = 375; showWeaponBar = true; validateShape = true; //Does it need to be validated by the client? }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
|
|
|
|
|
| |