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 / Weapon Limit = 3

Author
Message
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 4th Nov 2008 09:43
I searched and searched already... so don't yell at me if this topic is out there already.

I'm trying make my game function in such a way that the player can only hold three weapons at a time, along with a knife. And perhaps, while I'm at it, only a certain amount of ammunition for each of these three weapons.

Per say, a rifle, a pistol, and a grenade.

And in order to do this, the pickup script would have to be compatible with some kind of "Press F to pick up ____" type thing, as well as a "dropcurrentweapon" type thing

And of course, the player cannot drop the knife.

Any suggestions about how I might begin yet another dauntless task?

I'm thinking that if there is a static variable for the number of weapons the player currently has, and if there is a way to tell what each weapon is, this process will become phenomenonally easier.

Also, the pickup script will have to be edited so that instead of automatically picking up the weapon as the player walks over it, the text "Press F to pick up ___" will be displayed. And when the player presses F, the weapon is picked up/swapped with the weapon the player is currently wielding

i know how i'm going to do the pickup script
i do not know how to limit the number of weapons the player can carry at one time

Suggestions?

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Toasty Fresh
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: In my office, making poly-eating models.
Posted: 4th Nov 2008 11:41
Well, I think Ply's Mod has a weapon limit that you can set to three. I was thinking of a script like this, I would be very crude, but quite possible. If you used Airmod's reset weapons command, and have it happen when you press enter and you pick up the weapon when you press enter, you could have something functionable.

eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 4th Nov 2008 16:37
hmmm
i might just end up having to go with a mod but i was hoping to avoid that...

mods are somewhat dangerous, especialle because not all machines will behave the same way in response to the changes made by the mod to the original engine

especially because i'm running vista on both of my machines

anywho

thanks
i'll check out ply's mod

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Nov 2008 03:38 Edited at: 5th Nov 2008 03:41
Quote: "mods are somewhat dangerous, especialle because not all machines will behave the same way in response to the changes made by the mod to the original engine"


Mods are not dangerous!

So far every bug that people have reported to me, I have been able to duplicate on my machine. Now, this applies to actual BUGS, bu we cannot foresee if they install it incorrectly or do something else wrong to keep it from working for them... but if you build a game using a Mod, the built game will run the same on your computer and everyone else's so long as they don't have hardware issues or denied file access permission.

[EDIT]

Quote: "And perhaps, while I'm at it, only a certain amount of ammunition for each of these three weapons."


And I guess while I'M at it, I'll let you know how to do this using Ply's Mod (as it cannot be done with the official version or any other Mod at this time)

When setting up your weapons, go into their gunspecs and BIND their ammo to variables. (You can find out how to do this in the gunspec section of the readme) Now you can make a process script to check each ammo variable for exceeding your cap, and if they do, then set the ammo variables TO the cap that you decide... that will keep the player from getting any more ammo than they need.

[/EDIT]


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Nov 2008 03:43
Quote: "i know how i'm going to do the pickup script"


Seeing that, I'm going to assume that your game is going to be in one giant level, right?

If not, then I don't think you truely understand how you're going to do the pickup script.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 5th Nov 2008 04:12
well, it's going to be as many levels as i can do actually

i have 17 chapters at hand, 6 of which have their story complete
and each chapter will be broken up into smaller "levels" in order to reduce loading time and performance complications

don't know if that will actually help performance, but the way i thought of it when i decided to do that it made sense

so here's how i imagine the pickup script working:
when the player walks over a weapon, or near a weapon, instead of automatically picking it up, the text "Press F to pick up [weapon name]" will appear
and, of course, the player will only be able to pick up the weapon if he/she presses F
now with the mod i should be able to limit the number of weapons the player is allowed to carry at one time

with this functionality, the player WILL automatically pick up a weapon if he/she does not have three weapons yet

and if he/she does have three weapons, pressing F will "trade" the weapon the player is currently wielding with the one on the ground

a tad ambitious, yes
but it makes for better gameplay in the long run

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 5th Nov 2008 07:29
Well, it's the "trade weapons" part that's going to be the most trouble.

The official version of FPSC allows you to drop items.... technically, but it requires you to script that into the item, which means that item has to be on the floor. And even though the player carries weapons with them to the next level, THAT weapon (although picked up off the floor in the previous level) no longer HAS a script and so... cannot be dropped.

The Mod will allow you to remove the player's weapon, but it won't drop it on the ground.


You see... creating a weapon entity through code that not only HAS the right model, but has a script to go along with it and everything else needed by an entity... would be very taxing. The reason the official version can drop a weapon on the ground is because that weapon entity is already made. However, if you have that weapon and LEAVE the level from which that weapon belonged, then you can no longer drop it because that weapon entity and it's script are no longer present.


Hope that cleared some things up for you.


The one and only,


Those who live in the past, are destined to insanity. Those who live only for the future, will be slaves to their ambitions.
Those who live in the moment... only they, are truly happy.
eXone 42zero
18
Years of Service
User Offline
Joined: 31st Oct 2006
Location: 7!9
Posted: 5th Nov 2008 17:16
yes that did actually
thanks

hmmm
well, that's the desired behavior
what i will probably end up doing is just leaving the ability to carry unlimited weapons and ammunition, but just make weapons and ammunition scarce throughout the level

for example

a 6 shell loading shotgun in a (mostly) zombie level
but the player will only find a box of five or six shells every few minutes, and so must conserve ammo wisely instead of spraying and praying

we will see

i should have a part of the first level done within a month if you'd like to see my "masterpiece"

haha

"There's more to life than being really, really, ridiculously good looking." - Derek Zoolander

Login to post a reply

Server time is: 2024-11-24 13:28:49
Your offset time is: 2024-11-24 13:28:49