Page 1 of 1

Limiting number of carried weapons...

Posted: Thu Sep 22, 2005 4:42 am
by ZenBudha
What I am basically working on for Titan-IC is using pawns for ammo, and weapons. This way instead of just walking over them you have to stop and pick them up via the use key.

But what I am wanting is for the player to only be able to have 4 weapons at a time. 2 of them are always there and are pretty much the basic/default weapons pistol/knife.

Then I want the player to be able to pck up two other weapons, and if they have 4 weapons total have to drop one of their non-default weapons in order to pick another weapon up.

I just can't seem to come up with an easy way to do this. Any ideas would be greatly appreciated.

Posted: Thu Sep 29, 2005 1:19 pm
by Gamespider
This should be fairly easy with scripting.

1. Each time the player picks up a weapon, increase a given number say 'n' by 1.

2. Also add an if clause to check weather the number reached the limit. If so, let the user take the weapon. If else, display the drop weapon message.

3. When the player presses the drop key, decrease the number by 1.

Posted: Fri Sep 30, 2005 4:28 am
by Lupus
Hmmm... This is how I'd go about this(Can't promise it'll work...)

Set up a trigger to be activated by weapons upon pickup. Have a dummy pawn with a script that would check the state of the pickup trigger and any weapon control input(akin to the half-life weapon script). This should be in low level. When the pickup trigger hits(weapon acquired), it'll check to see if a slot is open, and then give the player the weapon if possible. You'll also need a spawn trigger for the weapons, in case they can't hold anymore(use the spawn trigger to restore the weapon so it doesn't simply disappear.) I would also suggest having this script manage ammunition as well(this will samake it easier to grab only the bullets from a weapon of a variety the player already posesses.)

Hope this helps. If you try it, keep me informed.[/code]