Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Unlimited clips

Author
Message
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 13th Mar 2015 06:34
I've tried to make a script for the gun. It will check if player hold the 93r that player already have the gun. It checks for the ammo of the gun that player holds. If it below 100, it will add another 100 ammo but it doesn't work.



I love to make games

http://www.youtube.com/user/thespicy847
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 15th Mar 2015 02:43
TodeGamer
What version are you using, as the condition "currentweapon" was changed to "plrcurrentweapon" some time ago.

You might want to try something like this? Setup the variable first. Check if player is holding weapon, if ammo less than 100,add
100 to ammo. ( I take it the player has 200 rounds in clip???)

Place in trigger in level somewhere. Not tested, but let me know
if it works.
best

My games never have bugs. They just develop random features..
Lots and lots of random features...
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 15th Mar 2015 11:43
Quote: " I take it the player has 200 rounds in clip???"


No I didn't mean that. I mean unlimited number of reload times. Already did what you said but it doesn't work. I use version 1.20 with unofficial update 19e by s4real.



I love to make games

http://www.youtube.com/user/thespicy847
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 15th Mar 2015 18:19
TodeGamer
Almost forgot, if you just want the players weapon to have
unlimited ammo, set the weapons "reload quantity" to 0(zero).
That would be easiest method. No need for a script. Would that work
for you?

My games never have bugs. They just develop random features..
Lots and lots of random features...
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 16th Mar 2015 02:39 Edited at: 16th Mar 2015 02:41
I mean unlimted number of magazines. like in left 4 dead pistol. they have umlimted mags. Put 0 in the reload quantity will only umlimted ammo, not mags.

I love to make games

http://www.youtube.com/user/thespicy847
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 16th Mar 2015 19:44
TodeGamer
Quote: "I mean unlimted number of magazines"

One thing you could try is in the "ammo clip" property settings
near the bottom is "ammo quantity" you could set that to a very high number like 999? That way one clip gives the player a very high number. And the weapon itself, set the "reload" quantity to something you need (100/200?). See if that works for you?
But as for a script checking the players ammo quantity, I cant get
it working with V1.20
best

My games never have bugs. They just develop random features..
Lots and lots of random features...
Sinister Spoon
15
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 16th Mar 2015 23:41
Maybe you guys are looking at this wrong, instead of shooting for infinite ammo, how about just making sure the player doesnt run out of bullets?

Couldnt you just give the player a fresh weapon everytime they reload? Like give them a gun with a 10 round mag and only 20 rounds, enough for a single reload once the player has expended all 10 rounds, then when the player reloads use the giveplrweapon=x command to give the player another copy of the weapon with 10 rounds in it, the player will only ever have the one gun so they'll just get the ten rounds each time, and everytime they reload it gives them just enough to make it to their next reload, which then repeats the cycle so they never run out of ammo.

Instead of giving them all the ammo.

I dont use the giveplrweapon command but I use the resetplrweapon command, so if the command to remove the weapon works the command to give one should too in theory.

Il run some tests

smoke em if you got em
Sinister Spoon
15
Years of Service
User Offline
Joined: 9th Sep 2008
Location:
Posted: 17th Mar 2015 00:18 Edited at: 17th Mar 2015 00:26
OK so some things from the testing:

1st. It does work, I gave the test player a 10 round ww2 stock colt45, after 10 rounds the gun is depleted and clicks as it should, however the plrusingreload fails to trigger the giveplrweapon command so currently my way doesnt work automatically.

What I did manage to get working though, was to map a scancodekeypressed command to the R key, so a manual reload will In fact trigger the giveplr weapon command

2.As far as I know it requires an example of the weapon to exist physically in the level (spawn somewher the player cant get to ideally) or the weapon doesnt get given

So basically as it stands right now, there is a solution but it will take some effort to get the rough edges smoothed out.

3.As the trigger to give the player the second weapon is linked to the R key, if the player presses R repeatedly they give themselves an unlimited amount of ammo if they want, they still have to reload at the end of each clip though so you could use this to your advantage.

So basically if you want to test it do this:

Created a blank room ( i used hangar prefab) place a player start marker, right click and assign the player the ww2\colt45 using the player start marker options. set ammo quantity to 1 (this denotes the number of magazines for that weapon the player will be given)

Place an actual colt45 item from ww2 entities somewhere outside the room (the roof maybe so it doesnt fall out the map). right click on it and set the reload quantity to 10 ( so it reloads every 10 rounds)

Place a ww2 wall furniture sign down, set it to dynamic,always active and put this in its main

:state=0,scancodekeypressed=19:giveplrweapon=ww2\colt45

Fire off all 10 rounds, you will get the empty click, fire a few more times to confirm this, then hit R (making sure ur not holding any other keys, fpsc doesnt like recognising scancodekeys if your moving around using wasd etc) your weapon will now magically have another 10 rounds!

Repeat over and over and over again til your satisfied Ive solved your problem

Few things, sometimes it just gives you the ammo straight into your gun and doesnt trigger a reload, so you might want to tweak the code to play the reload animation everytime the player receives a new clip, and probably try and link the scancodekey=19 condition to an ammo condition so the player cant spam the R key over and over, not that this would really hurt as the way its set up, even if they did this, the gun would still reload every 10 rounds regardless of how much ammo the player accumulates, so you could try and figure out how long it takes to fire off the entire magazine, say 8 seconds, then script the giveplrweapon command, to happen every 7 seconds so the player ALWAYS has ammo.

It just doesnt strike me as needing to be as complicated as involving variables, the player is always reloading, the action needs to centre around the reload action itself, as long as the weapon is reloading every 10 rounds and never runs out of ammo, does it really matter if its complicated variable based or just based on the fact that theres a constant trigger here we can use, regardless of the variable, admittedly its a very low tech solution compared to checking and monitoring the players ammo count but it works at least


Alternatively set the ammo quantity in the player start marker to 9999 (as far as i can tell this defines the number of reloads you get, the reload quantity option in the weapon determines the number of rounds fired before a reload so to control how often the player reloads, spawn a copy of the weapon the player will be using in the leve, and edit its properties to set the properties of how and when the players weapon will reload)

So you could give the player a colt 45 via start marker, set the ammo quantity to 99999, then place an item variant in the level, right click on the item, and use its properties to set the RELOAD quantity to 10, then the player should reload every 10 rounds, but have access to 99999 reloads.

As far as i can tell this only works if you spawn a copy of the weapon you are giving the player, somewhere in the level and manually edit ITS properties to act as a control for the weapon the player is using.

Seems weird but thats how its working out for me during testing.

Which it seems like it shouldnt, but if it works it works

Hope this helps

smoke em if you got em
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 19th Mar 2015 05:13
Thanks, Sinister Spoon!! Also Can I hide the ammo count? (The one after the "/". I mean the remaining ammo the player have.)

I love to make games

http://www.youtube.com/user/thespicy847
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 19th Mar 2015 05:56
Hey Sinister Spoon good work around That should work.

@TodeGamer
Quote: "hide the ammo count"

Yes, it's easy. In the map-editor go to file\build game\level settings\global script. Click the "edit" button to open the
"setuplevel.fpi" Scroll down until you see "Ammo Numeric"- numeric.dds and X & Y coordinates. The first is the texture file with the actual numbers. The X & Y are the coordinates where the numbers are placed on the screen. You can either replace the numeric.dds file with a blank or adjust the X&Y coordinates.
To see your changes click on the "preview" button at bottom.
best

My games never have bugs. They just develop random features..
Lots and lots of random features...
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 19th Mar 2015 07:02 Edited at: 19th Mar 2015 07:04
@ncmako

I mean hide the ammo counter, see the pic. Make the palyer can only see the reload quantity. Also how to make it like this:

When player switch gun to 9sr hide it
Switch to other unhide it.

I love to make games

http://www.youtube.com/user/thespicy847

Attachments

Login to view attachments
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 19th Mar 2015 14:29
TodeGamer
Yes, exactly! Those hud's/numbers are controlled from the global script "setuplevel.fpi". It tell the engine where to place the
hud's & numbers on screen. Just take a look at it. Try placing
a negative value "-" in front of the X & Y ammo coordinates. Then
preview it. The numbers will be off screen.
The same goes for the little picture hud where the numbers are
displayed inside.
Make note of any changes if you need to revert back!

My games never have bugs. They just develop random features..
Lots and lots of random features...
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 19th Mar 2015 14:47
@ncmake

Didn't you see the pic? I mean only the back part. That method remove all the numbers counter.

I love to make games

http://www.youtube.com/user/thespicy847
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 19th Mar 2015 16:31
TodeGamer
I see what you mean. You want to show the number of clips
available. Not the number of rounds left. I may be wrong,
but I believe they are tied together in the setuplevel.fpi

My games never have bugs. They just develop random features..
Lots and lots of random features...
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 20th Mar 2015 04:35
ncmake

This is my theory: When the player is holding the specific gun, add another hud on the top of that part. If the player isn;t holding, hud the hud. Is this possible?

I love to make games

http://www.youtube.com/user/thespicy847
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 20th Mar 2015 06:10
TodeGamer
Yes, absolutely! Great work around
Easy script with a trigger. "plrcurrentweapon=x" & "hudshow=x"

My games never have bugs. They just develop random features..
Lots and lots of random features...
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 20th Mar 2015 06:11
ncmako

Thanks!! I own you a lot!!!

I love to make games

http://www.youtube.com/user/thespicy847

Login to post a reply

Server time is: 2024-04-25 07:04:39
Your offset time is: 2024-04-25 07:04:39