Jump to content
havenphillip

Some HUD Elements Updated

Recommended Posts

Thank you for your great work. I have some elements built into my project. As a basic level, I use The Zone. that fits 100 percent.
  • Like 1

Share this post


Link to post
Share on other sites
Hello,

I have a question about the crawler prefab. I noticed that the AI of the crawler is slightly different than the regular monster script.

Can it be, or is it just me? I think the crawler runs rather in a zigzag and not directly to the player.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Include a crawler.pfb in your game? Can't you just drag and drop the prefab into the screen? Not sure what you mean.

But here's a basic ammo pickup script. Just add one of your ammo models to your scene and attach this script to it. Also you might need to add a collision shape to your ammo model.

 

ammo_pickup.lua

Share this post


Link to post
Share on other sites
I have now downloaded and installed the explosion example from the steam workshop.

If I want to pick up the bomb prefab as a player now I get the following error message.



Do you have a chance to install the grenade in your HUD script?

Unbenannt.jpg

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.
 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Create Your Account

Sign in

Already have an account? Sign in here.

Sign In Now

×