Home   Help Search Login Register  

Author Topic: Spies  (Read 2575 times)

0 Members and 1 Guest are viewing this topic.

Offline CrashDome

  • Members
  • *
Spies
« on: 18 Nov 2003, 19:33:04 »
As far back as I can remember, there were a few people who wanted a good way to allow the player to kick it James Bond style and be able to walk around town without the local enemies shooting you on site. SetCaptive proved to be very useful in that it prevents the enemy from shooting you BUT - there was no way of really telling when a good time to setcaptive to False(at least that I have seen yet).

So, I present this idea for everyone to play around with:
http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=7238dadfbadf330db2ef76a438847c88;act=ST;f=7;t=35170
It's my post from the official forums, but I figure there is probably a better audience here. You can find a link to the file there (source and PBO) and attached
« Last Edit: 23 Nov 2003, 21:02:34 by CrashDome »

DBR_ONIX

  • Guest
Re:Spies
« Reply #1 on: 20 Nov 2003, 23:43:52 »
I'm not a scripter. Yet.. But an idea..
What about taking of the setcaptive thing when the unit attacks another friendly, or takes a weapon from his back..?
- Ben

Offline CrashDome

  • Members
  • *
Re:Spies
« Reply #2 on: 21 Nov 2003, 02:45:43 »
What about taking of the setcaptive thing when the unit attacks another friendly
Good ideas, but I didn't want the person to be able to run around with a drawn weapon in plain site.
or takes a weapon from his back..?
If I remember correctly, you cannot accurately find out when a unit has a weapon in hand or not? I think?

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Spies
« Reply #3 on: 23 Nov 2003, 10:55:47 »
I tried it, should be fun - if i could fire my gun.

At start it's all fine, but after i hide my gun and get it out again i can't fire it or reload. It seems i have no ammo for it.

I bet it's a problem with the pull.sqs where the player gets his former weapons. Maybe the player gets the gun first, the mags later, that could be a problem.

Offline CrashDome

  • Members
  • *
Re:Spies
« Reply #4 on: 23 Nov 2003, 20:45:21 »
The problem is that you haven't loaded your clip and is a common problem when adding weapons via a script to a unit. To do so you must "Toggle Weapons" I think it is space bar - (or "r" to reload a clip).
The common solution is to script-load magazines first, then weapons, but I do not remove the magazines so I cannot "re-add" them first  :)

In short, this is a problem with "addweapon" command... not my script.

There is a problem with my script though... as I found out, you can pick up another person's weapon and ammo and use it while being "Captive". The solution is (for scripters) to replace putaway.sqs with this:
Code: [Select]
private ["_unit"]

_unit = _this select 0
;make sure no one shoots unit
_unit setcaptive true
;get units weapons
MyWeapons = weapons _unit
;remove weapons
{_unit removeweapon _x} foreach MyWeapons
;remove the action for hiding
_unit removeaction holster
;add the action for unhiding
pull = _unit addaction ["Pull out weapons","pull.sqs"]

;Added - 23.11.2003 - prevents player from remaining setCaptive when grabbing other weapons
@(count (weapons _unit) != 0)
? (Captive player): [player] exec "pull.sqs"

exit

What this will do:
If a player grabs a new weapon, "captive" is set to false. All hidden weapons are added back to player EXCEPT the one the new one replaced. i.e if a units hides an UZI and Glock 17, then later grabs an AK-47, the UZI is lost but the Glock 17 is added back.
I did not fully test(only enough to make sure it works), so please notify me of errors.

I will upload new version asap as link in next post.
« Last Edit: 23 Nov 2003, 21:56:03 by CrashDome »

Offline CrashDome

  • Members
  • *
Re:Spies
« Reply #5 on: 23 Nov 2003, 21:59:49 »
Here is version 1.1

Fixed:
Ability to grab other weapons while still being captive (no one shoots back)


Offline Blanco

  • Former Staff
  • ****
Re:Spies
« Reply #6 on: 06 Jan 2004, 17:29:38 »
hi, Chrashdome

I found a tiny bug in this great script :

When you pull your weapons out, you always have to press spacebar to select the weapon before you can use it

I could solve this :

in the pull.sqs change this line


Code: [Select]
{_unit addweapon _x} foreach MyWeapons

into this :

{_unit addweapon _x;_unit selectweapon _x} foreach MyWeapons

It works but I'm not sure this is the right thing to do because with this code the unit selects ALL the weapons in the weapons array. But I works...

A suggestion :

Is it possible to change the script so that the player can't hide primary weapons (only handguns)?
Because I think in reallife you can't hide an M16 in one piece in you pockets  :P

And there is no command like ?Player haslongcoat :D

Search or search or search before you ask.

Offline CrashDome

  • Members
  • *
Re:Spies
« Reply #7 on: 07 Jan 2004, 07:10:37 »
Yes, it can be tailored to whatever your needs are. I made it cover everything because it is easier to go from there and back out what you dont want.

About the selecting of weapons.... try it by pulling out a secondary weapon and see if it ends up giving you something else. If it doesn't do that (cant check it myself) then you have found the work around it needed!!

Edit: or the selecting with the space bar could be like the actual unhiding of the gun... who's the quicker "draw" and all the like.......... ok... I am reaching a bit
« Last Edit: 07 Jan 2004, 07:11:55 by CrashDome »

Offline Blanco

  • Former Staff
  • ****
Re:Spies
« Reply #8 on: 16 Jan 2004, 19:50:22 »
I tried to modify it so the player can only hide handguns but it doesn't work. Hiding & pulling out actions works ,but when the player drops his handgun or take another weapon from a fallen soldier, the script fails.
And I was wrong. Handguns are not secondary weapons, they're primary. A LAWlauncher is a secondary weapon

Also, is there a way to remove the addactions when the player got no weapons at all and he's not hiding them?

I  think it's impossible, but maybe you know how...

« Last Edit: 16 Jan 2004, 19:52:46 by Blanco »
Search or search or search before you ask.

Offline CrashDome

  • Members
  • *
Re:Spies
« Reply #9 on: 17 Jan 2004, 05:55:35 »
Since the script relies on the "weapons" command it must apply to all weapons.

If BIS put in a "HandGuns" command (or something similar) it would definately be possible.

I will look into this a bit further but here is a start:
in init.sqs define allowed handguns:
HandgunsAllowed = ["beretta",etc......]

then replace  putaway.sqs with:
Code: [Select]
private ["_unit","_continue"]

_unit = _this select 0
;make sure no one shoots unit
_unit setcaptive true
;get units weapons
MyWeapons = weapons _unit
;check to make sure player only has handgun before allowing him/her to "putaway"
_continue = true
{if !(_x in HandgunsAllowed) then {_continue = false} } foreach MyWeapons
? !(_continue): exit
;remove weapons
{_unit removeweapon _x} foreach MyWeapons
;remove the action for hiding
_unit removeaction holster
;add the action for unhiding
pull = _unit addaction ["Pull out weapons","pull.sqs"]

;Added - 23.11.2003 - prevents player from remaining setCaptive when grabbing other weapons
@(count (weapons _unit) != 0)
? (Captive player): [player] exec "pull.sqs"

exit

This will not allow the player to put away weapons if they are carrying anything other than the allowed weapons.