Limiting number of carried weapons...

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
ZenBudha
Posts: 285
Joined: Wed Aug 17, 2005 6:06 am
Contact:

Limiting number of carried weapons...

Post 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.
Fear not the textures for the almighty stylus is with thee - Book of Zen
Gamespider
Posts: 51
Joined: Fri Jul 08, 2005 1:31 pm
Location: India

Post 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.
Lupus
Posts: 10
Joined: Tue Sep 27, 2005 9:17 am

Post 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]
Life is the software of reality...
If you think it isn't fair, ask God to hack the code!
Post Reply