It is currently 19 May 2013, 09:55

Post new topic This topic is locked, you cannot edit posts or make further replies.  Page 1 of 1
 [ 1 post ] 

[APPROVED] Making a powered/unpowered weapon


Author Message
 Post subject: Making a powered/unpowered weapon
PostPosted: 15 Dec 2010, 16:54 
Offline
Commander Keen  A rather ghastly dragon
User avatar
Joined: 11 Dec 2009, 20:01
Posts: 2661
Every once in a while, I see a post asking how to make weapons affected by a Tome of Power, or a weapon that doesn't implement it 100% correctly, so here's a tutorial to explain it.

First off, there are three wiki pages to look at:
  • PowerupGiver with the Powerup.Type WeaponLevel2: This is the powerup that activates it. For creating a new weapon, it's not necessary to deal with, but it helps to explain how the system works. For testing, you can use the Powerup console cheat to activate.
  • Weapon.SisterWeapon: This goes on both the unpowered and powered weapons, it's what tells the WeaponLevel2 powerup what weapons go together.
  • +Weapon.Powered_Up: This tells it what weapon to use when under the effects of a WeaponLevel2 powerup. Without this or Weapon.SisterWeapon, it can't work.

I'll use Doom's Pistol to illustrate. This is it before we add support for WeaponLevel2.



To get started, we create a second weapon inheriting from the pistol:



You'll notice there is a LOT less code here, in the powered version. That's because with inheritence, it's getting information like states and properties from the original. If you want to change anything, replace it in the new version, like with this Fire state.

Something to remember, if the powered version has its own Ready state, it will play the Lower and Raise animations when the WeaponLevel2 powerup starts and ends. You can see this with the Staff in Heretic.

Next, we add Weapon.SisterWeapon and the +Weapon.Powered_Up flag.



That links them together. It should be just that easy; when a WeaponLevel2 powerup is activated the Pistol2 weapon will automatically become the PoweredPistol2 weapon. You now have a version of Doom's pistol that can be affected by a Tome of Power.
Currently reading: Blood Ravens, The Dawn of War Omnibus
_________________
Total approved submissions: 78
Total approved updates: 21
Total rejected: 2


Top
 Profile  
 
Display posts from previous:  Sort by  
Moderators: Ghastly, NeuralStunner

Post new topic This topic is locked, you cannot edit posts or make further replies.  Page 1 of 1
 [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest


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
You cannot post attachments in this forum

Search for:
Jump to: