Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 07:00:02 PM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Few errors with my TTT weapon I am making.
Pages: [1]
Author Topic: Few errors with my TTT weapon I am making.  (Read 7353 times)
Tom
Poster

Posts: 10


« on: July 01, 2010, 12:08:59 PM »

So basically I am making a traitor weapon that will allow the user to run faster and then slower. The fast and slow part is done but I get a few errors.



http://pastebin.com/aGd2yDe9

That's my code.

And the crowbar look is messed up, it looks like he's trying to aim with it. How would I go about making the crowbar look like the regular crowbar looks. (How he's like holding it out), Instead of him trying to shoot something with it.

Any help is appreciated.

Also, I made this icon: How would I about converting it for use with ingame pictures in the menu?

Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #1 on: July 01, 2010, 12:43:52 PM »

http://pastebin.com/aGd2yDe9

That's my code.

You are getting the errors because you are not deriving the weapon from the TTT baseclass. Use:
  SWEP.Base = "weapon_tttbase"

The model will hold it wrong because "crowbar" is not a valid HoldType value. Set it to:
  SWEP.HoldType = "melee"

Other things:
- Don't set SWEP.WeaponID. It's only for the weapons that come with TTT. Have you looked at the code for weapon_tttbase? It has a lot of comments that tell you these things.
- Don't define a SWEP:Initialize() override unless you know what you're doing. The TTT weapon base does important things in that function.
- Because "isRunning" is global, you will run into weird behaviour when multiple traitors use the weapon. Make it SWEP.isRunning.
- Test regularly on a listen server rather than singleplayer. Singleplayer is special and you will not see certain issues. For example, the client has no "SetWalkSpeed" function for players because it's server-side. Your code will try to set the player's speed on the client in multiplayer and give an error.

Quote
Also, I made this icon: How would I about converting it for use with ingame pictures in the menu?

/gamemodes/terrortown/template/icon.psd

Stick your image on that background in photoshop. Export to VTF (BGRA8888, point sample, no mipmap, no level of detail). Make sure you give it a unique filename (eg. with your server name in it) because otherwise it can clash with icons from other servers. Make a VMT based on the VMTs for standard TTT icons. Stick a resource.AddFile in your weapon code to make clients download it.

If I were you I'd just use the standard crowbar icon until the weapon itself was fully working and turns out to be fun and balanced, or all that effort will be for nothing. To use the crowbar:
  SWEP.Icon = "VGUI/ttt/icon_cbar"

I would like to write a guide about custom weapons with more detail than this, because I realise it's tough to make a weapon right now unless you're well versed in Gmod's Lua stuff, but I just don't have time right now. Maybe in a few weeks.
Tom
Poster

Posts: 10


« Reply #2 on: July 01, 2010, 10:29:23 PM »

Thanks so much for the detailed reply. It helped me a lot.

By the way, the icon took no longer than 10 minutes ^^;
Tom
Poster

Posts: 10


« Reply #3 on: July 02, 2010, 01:19:19 PM »

Okay, i've come up with more problems. I changed HoldType to melee, yet I still see this for some reason.



When I want it to look like this:



Also, when I converted my icon to VTF and VMT format, stuck it in VGUI/ttt, and then changed the code to use that icon, all it does is come up with a black box.

Here is my current code: (please realize that I'm extremely new to lua and I am trying to learn as fast as I can)

http://pastebin.com/jxVW1TjA

Thank you for any reply

« Last Edit: July 02, 2010, 01:31:05 PM by Tom »
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #4 on: July 02, 2010, 04:19:56 PM »

I've just gone ahead and fixed a couple of Lua issues and such:
http://pastebin.com/FHtk5Qik

I have no idea why the holdtype wouldn't work properly. Maybe one of the issues I've fixed created an error or something that prevented the weapon from working properly.

Could you upload the icon somewhere?
Tom
Poster

Posts: 10


« Reply #5 on: July 02, 2010, 07:35:03 PM »

Sure, I uploaded the icon before I converted it to VTF and VTM format and the VTF and VTM files that I converted from.

http://rapidshare.com/files/404556718/erroricon.zip.html

Also, if you come up with a fix for the holdtype could you post it in this thread? The entire base of the weapon is that a traitor can have a weapon that looks like a crowbar but it's something different.

Thank you for fixing the code for me, as well.
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #6 on: July 02, 2010, 07:40:27 PM »

I'm not looking for a fix for the holdtype, you'll have to do that yourself. It works for every other weapon, so it's a problem with this specific one.

The VTF seems fine, but your VMT is wrong. Check out the VMT files that come with TTT, like icon_armor.vmt.
Tom
Poster

Posts: 10


« Reply #7 on: July 02, 2010, 07:51:41 PM »

I'm not looking for a fix for the holdtype, you'll have to do that yourself. It works for every other weapon, so it's a problem with this specific one.

The VTF seems fine, but your VMT is wrong. Check out the VMT files that come with TTT, like icon_armor.vmt.


After looking at icon_armor and changing my icon to match that it works. Thanks for your help. It means a lot :)
Tom
Poster

Posts: 10


« Reply #8 on: July 02, 2010, 08:12:08 PM »

I've been trying to look for the crowbar weapon, but I cannot find it in weapons or anywhere else, can you direct me to where it is?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #9 on: July 02, 2010, 09:33:03 PM »

The entity name is weapon_zm_improvised.
Tom
Poster

Posts: 10


« Reply #10 on: July 02, 2010, 11:42:43 PM »

Thanks, I added these lines, and the model works fine now. It's awesome :D

SWEP.Primary.Delay = 0.5
SWEP.Primary.Ammo = "none"
SWEP.Secondary.Ammo = "none"
SWEP.NoSights = true
Meta-Stick
Poster

Posts: 481


it contains, a daisy box


« Reply #11 on: July 02, 2010, 11:59:25 PM »

What server is this on?

Just grab some bottles and stick them in girls...
Tom
Poster

Posts: 10


« Reply #12 on: July 03, 2010, 12:08:28 AM »

What server is this on?


It isn't on any servers yet, unfortunately. I will probably get it on Chiefeh's though.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Few errors with my TTT weapon I am making. « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.023 seconds with 17 queries.