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 / Limited ammo? Is this possible?

Author
Message
TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 29th Jun 2013 11:45
Does anyone know how to set a limited ammo?

For example:

Colt47, ammo per clip = 7
I want to limite maximum ammo that player can carry = 49

Is this possible?

If yes gimme some tutorial.

I love to make games

http://www.youtube.com/user/thespicy847
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 30th Jun 2013 06:47 Edited at: 30th Jun 2013 06:58
maybe the reloadqty=x in the gunspec file for that weapon?

gamecore/guns/ww2/colt45

if you make it 7 per clip, then just limit their access to the clips they can pick up

if there is only the weapon + 6 ammos in the map, then they won't have more than the 49

TodeGamer
11
Years of Service
User Offline
Joined: 11th Sep 2012
Location: Bangkok,Thailand
Posted: 30th Jun 2013 15:20
I know that but I want to make it look like other games.
Such as: Left 4 dead
Player can pickup weapons with the limite ammo. If plr find another mag, he can't pick it up.

I love to make games

http://www.youtube.com/user/thespicy847
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 1st Jul 2013 03:20 Edited at: 1st Jul 2013 03:49
You would need a script using a variable for the pickups.
Then increment the variable by one for the ammo pickups, while also checking that variable in the ammo pickup script to prevent the pickup if var >= x
Checking the value before the increment would work best, so do the increment when you allow the pickup, and do not increment it if denying them.

You would also need to check for the user pressing the R key, and decrement the variable when they reload the weapon.
You would want to check for the key release (scancodekeypressed=0) after checking for them pressing the R key (scancodekeypressed=19) before decrementing.
That way it would not subtract more than one from the variable each time they reload.
You would also need to know their current ammo level to prevent subtracing anything from the variable if the reload key is pressed when the ammo is full.
Partial reloads (when clip is not empty) would foul the count up though.
Not sure if there is a variable for the ammo level available in the FPI, because I have been away for awhile and my FPI scripting conditions/actions knowledge is not up to date.
I think it was added in awhile back, but not sure if it was or not.
I guess I need to go look.


EDIT

It looks like they now have a plrisusingreload condition now.
That is much better than using the R key method, just in case they are using a different key or joystick for reloading.
Sweet

I don't see any condition that can read the value of internal variable used for the player's ammo
I guess there is an internal variable for each weapon slot's ammo level, but I see no FPI condition to read them.
It would be nice if we only had access to the variable for the current slot being used (one used for ammo count display)
No real need to read the ones not being used or for having any actions for changing them, but it would be nice to know the ammo level of the current weapon.
Maybe that will be coming in reloaded, if we are lucky.
Maybe I was dreaming, but I could have sworn I caught mention of a condition like that somewhere.

Burger
11
Years of Service
User Offline
Joined: 22nd Jun 2012
Location: New Zealand
Posted: 1st Jul 2013 10:11
Quote: "I don't see any condition that can read the value of internal variable used for the player's ammo
I guess there is an internal variable for each weapon slot's ammo level, but I see no FPI condition to read them."


I was reading through the script syntax list and found this:



So in theory could you apply this to detecting the amount of ammo?

$CA is perhaps the interesting one here, so for example varless=$CA 49:pickup ammo, or something?

Just thought it might help.

- An Instinctive Fear IndieDB page, download demo today!
ncmako
12
Years of Service
User Offline
Joined: 19th Feb 2012
Location: Hendersonville,NC
Posted: 1st Jul 2013 16:56
Hi everyone, a lot of Q's lately about limiting ammo
Yes the $CA variable just might work. I used it to display a hud of shells left in a weapon..http://forum.thegamecreators.com/?m=forum_view&t=202409&b=23
Works like a charm. $CA together with "PLRPICKON=X
Description: This sets whether the player can pick up using the right mouse click or not." should do the trick?

Login to post a reply

Server time is: 2024-04-20 13:17:35
Your offset time is: 2024-04-20 13:17:35