Jump to content

Weapon Name


Slimwaffle
 Share

Recommended Posts

I was wondering how I would go about getting weapon name to print to screen? I checked all the code and can't find a reference to name anywhere. The closest I found was weapon file. Which prints the weapon file path to screen but does not change when swapping weapons.

Link to comment
Share on other sites

Is the weapon a prefab or a model? Asking because sometimes this doesn't work for prefab parent meshes - only the child mesh. On models, it appears to work all the time. Anyways, this is how you get the name like as shown in the editor when placed in a scene:

entity:GetKeyValue("Name")

 

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

This is what I came up with that compiles without error. But its not printing a name value to screen.

wep = self.weapons[self.currentweaponindex].entity:GetKeyValue("Name")

context:SetBlendMode(1)
context:SetColor(0,1,1,255)    

context:DrawText("Weapon = " ..wep , 20,(context:GetHeight() - 80))

Link to comment
Share on other sites

I searched everywhere. There is no reference to name. I think I am going to have to add something in myself. 

I think maybe along the lines of on weapon pick up if weapon file is = "path to mp4.pfb" then name of next index = "mp4"

Not sure if that will work.

Seems a bit tedious. Would saving all the file paths (For each item) and the equivalent name (for each item) to a table and then search matching string in table and returning name value work better?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...