OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Cpl. Vagabond on 16 Mar 2003, 01:18:02

Title: Surrendering
Post by: Cpl. Vagabond on 16 Mar 2003, 01:18:02
Can someone here please build me a script which once activated would enable 'removeallweapons' and 'setcaptive true' and make it so if you wonder more than 10 metres away or pick up a weapon your 'setcaptive true' turns to 'setcaptive false'

Basically this would enable you to surrender in a mission with AI and my be it could be done so that a message appears on the enemies screens (MP) saying that you surrender.
Title: Re:Surrendering
Post by: wi77ard on 16 Mar 2003, 01:59:24
try this

;surrender script
player removeallweapons this;
player setcaptive true;

@player hasweapon "";

player setcaptive false
exit

;end of script


i haven't tested it coz busy right now, but lemme know if works

wi77ard
Title: Re:Surrendering
Post by: Cpl. Vagabond on 16 Mar 2003, 12:20:20
it didn't work and when i modifyed it to

;surrender script
removeallweapons this;
this setcaptive true;

@player hasweapon "Bizon";

player setcaptive false
exit

;end of script

I didn't have an error message but it didn't work i still had my weapons and i still got shot.

does anyone think they can fix this for me please.
Title: Re:Surrendering
Post by: dmakatra on 16 Mar 2003, 14:48:14
DonÂ't know this haveweapons shit, but I have a script for ya.

_GL = _this select 0
_DaGuy = _this select 1

_DaGuy setcaptive true
Removeallweapons _DaGuy
_GL setpos getpos _DaGuy

#loop

(_DaGuy distance _GL) < 10 : goto "shootdabastard"

goto "loop"

#shootdabastard

_DaGuy setcaptive false



Probably wont work but do you get da picture? :D ;)
Title: Re:Surrendering
Post by: Cpl. Vagabond on 16 Mar 2003, 15:52:39
i've got it working with

removeAllWeapons player;
player setCaptive true;
removeAction "Surrender";

@player hasweapon "Bizon, Glock, BAS_M14AIMPOINT, BAS_M249, BAS_M249spw";

player setcaptive false
exit

;end of script

but this only works for the guy named 'player' and if you want it for multiple blokes then it would be a pain in the a**
Title: Re:Surrendering
Post by: dmakatra on 16 Mar 2003, 15:59:08
OK, so I make a "all in one".


_player = _this select 0
_GL = _this select 1

removeAllWeapons _player
_player setCaptive true
_GL setpos getpos _player
removeAction "Surrender"

#loop
? _player hasweapon "Bizon, Glock, BAS_M14AIMPOINT, BAS_M249, BAS_M249spw" : goto "shoot"
? (_player distance _GL) < 10 : goto "shoot"
~0.1
goto "loop"

#shoot
_player setcaptive false
exit


How about that? :D
Title: Re:Surrendering
Post by: Cpl. Vagabond on 16 Mar 2003, 16:42:37
Nope it didn't work...i still got shot. but it might be better if:-

1: surrender
2: lose your weapons & set captive true
3: you get 10 seconds to get within 6 metres of an enemy
4: once your within 10 metres 1 enemy infantry out of the group with follow you
5: if your armed or move more than 10 metres away then setcaptive false

if it's not possible for armed i wouldn't mind specifying the weapons

p.s do u know where i can get any good  tutorials for learning how-to write sqs files?
Title: Re:Surrendering
Post by: dmakatra on 16 Mar 2003, 16:59:32
Here you go! (http://www.ofpec.com/editors/browse.php?category=1_3)

Johan Gustavssons tute is the best.