Jump to content

Some HUD Elements Updated


havenphillip
 Share

Recommended Posts

  • 2 months later...
Ok, with the crawler I'll take a look again.

I have two questions or requests to you.

I downloaded some monster models from the workshop. How can I include the prefab (as well as the crawler) in my project?

Can you help me create a munitions pickup script for the weapons in the project? I have already loaded the models for the ammunition from the workshop.
Link to comment
Share on other sites

It's because the grenade weapon doesn't have a "clip" variable. One thing you could try is adding these in the Start() function of the Fps_GrenadeView.lua script. That will get you past that error:

    self.clipammo = 1
    self.clipsize = 1
    self.ammo = 1

Basically the ammo script is trying to figure out what numbers to display. It's asking the pipebomb script "How much ammo do I display?" and the pipebomb script is like "I don't know what you're talking about. I've never heard of clip, or clipsize, or clipammo, etc." So you have to add the variables in the pipebomb script so it can tell the ammo.lua PostRender() what to display. I used "1" which is completely arbitrary. The next thing will be to figure out how to get the pipebomb to count down as you chuck grenades.

Link to comment
Share on other sites

Thank you for the info. I have now added this to the script. See Attachment.

That works too. I can choose between the weapons and the grenade. If I throw the grenade, then it works too. 
However, the game then freezes. Sometimes it freezes after throwing a grenade, sometimes after two or three throws. 
This always happens when I want to run with the player afterwards.

Do you have any idea?

 



 

 

Unbenannt.jpg

Link to comment
Share on other sites

Yeah. It was freezing up on me, too. I have a fix. Just for fun I was working on it last night. It has to do with a line in the FPS_Grenade.lua script.

Open the FPS_Grenade.lua script right next to the other script.

Go down to about line 480 and look for "self.entity:Release()"

Uncomment it or change it to "self.entity:Hide()"

Then, just under that write:

           if self.entity:Hide() then
                self.entity:Release()
            end

 

Like this:

release.thumb.png.1caf7cde8981163a0c75201e9e183621.png

Link to comment
Share on other sites

Also, if you want the ammo.lua script to display the actual count of grenade ammo you have you can fix that in the Fps_GrenadeView.lua script by making use of the comparable variables that script already has.

Open Fps_GrenadeView.lua

Add this (change this) under the Start() function:

    self.clipammo = self.GrenadeAmmo
    self.clipsize = self.MaxGrenades
    self.ammo = self.MaxGrenades

 

In the Fire() function under "self.GrenadeAmmo = self.GrenadeAmmo - 1" add this:

    self.clipammo = self.clipammo - 1

 

Like this:

clipamm0.thumb.png.f62c7a722def22a117f6a02bd03d5d6f.png

Link to comment
Share on other sites

Cool, man. Enjoy it.

I think I recall reading you are pretty new. If you haven't checked out Aggror's Project Saturn series on YouTube I would highly recommend. That's where I started two years ago with no prior coding experience. He explains things really well and introduces a lot of the concepts. He shows how to make a health bar, health kit, an inventory system, respawn the player, and a few other things. Plus he's an actual coder and is frequently on here answering questions, and he's always been really patient with me. Josh did a good job making the Leadwerks lua language accessible and once you start to get it you catch on quick.
 

 

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...