Home   Help Search Login Register  

Author Topic: Prisoner grab switch  (Read 597 times)

0 Members and 1 Guest are viewing this topic.

Offline DarkAngel

  • Members
  • *
  • The night is my friend.
    • DarkAngels Missions
Prisoner grab switch
« on: 04 Aug 2004, 18:23:39 »
Hey folks,

I'm trying to make a prisoner snatch script for Vietnam style missions, the idea is that when a group gets to a certain size they each perform the following:

; _x = man to be captured
; _joiner = interpreter, to attach men to group
; _captivegroup = the group to be joined

_x = _this select 0
_joiner = _this select 1
_captivegroup = group _joiner

; housekeeping

removeallweapons _x
_x setCaptive true

; playmove and speak
_x globalchat "I surrender!"
_x playmove "EffectStandSur"

; join

@ _joiner distance _x < 5

_x playmove ""
[_x] join _captivegroup

exit

I usually make _joiner the player, so you have to go up to the surrendered guy yourself.

2 problems:

1) setcaptive doesn't seem to work
2) the animation isn't played.

The actual joining works fine, as does removeweapon.

Any thoughts?
"Moondark" in Beta Testing

Nulear_Man

  • Guest
Re:Prisoner grab switch
« Reply #1 on: 05 Aug 2004, 05:12:29 »
try debuging it

_x = _this select 0
_joiner = _this select 1
_captivegroup = group _joiner

; housekeeping

removeallweapons _x
_x setCaptive true
? !(Captive _x) : Hintc "_x Is Not Captive"

; playmove and speak
_x globalchat "I surrender!"
_x playmove "EffectStandSur"
; Try _x Switchmove "EffectStandSur"
; you Sure its not "FXStandSur"

; join

@ _joiner distance _x < 5

_x playmove ""
[_x] join _captivegroup

exit

Offline DarkAngel

  • Members
  • *
  • The night is my friend.
    • DarkAngels Missions
Re:Prisoner grab switch
« Reply #2 on: 05 Aug 2004, 11:46:01 »
Thanks Nuclear_Man.

I added in the debug code and when I set the script off for individual targets it seems to work, apart from PlayMove/Switchmove for some reason. But when I use a seperate script to run it for the whole group, _x does NOT become captive. Here's the script, can anyone tell me what i'm doing wrong?

_surgroup = _this select 0
_joiner = _this select 1

; use trigger to detect how many men in squad, should kick off script.
; Effects: Drop weapons, play anims, stand still.

_groupunits = units _surgroup
_a = 0
_aunits = count _groupunits

#loop
_bloke = _groupunits select _a
[_bloke,_joiner] exec "prisoner.sqs"
_a = _a + 1
?_a>_aunits:goto "end"
goto "loop"

#end
exit
"Moondark" in Beta Testing

Nulear_Man

  • Guest
Re:Prisoner grab switch
« Reply #3 on: 09 Aug 2004, 00:00:12 »
For the loop i Would do this insted

aunits = aunits - 1
; This is used because if this is the array [1,2] units will return 2 and
;groupunits select will be 1

#loop
? _a > aunits : goto "end"
_bloke = _groupunits select _a
[_bloke,_joiner] exec "prisoner.sqs"
_a = _a + 1
goto "loop"

Offline DarkAngel

  • Members
  • *
  • The night is my friend.
    • DarkAngels Missions
Re:Prisoner grab switch
« Reply #4 on: 11 Aug 2004, 12:29:46 »
Added in aunits=aunits-1 after initialising aunits. Still doesn't seem to work though.

What am I doing wrong??? ???
"Moondark" in Beta Testing

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Prisoner grab switch
« Reply #5 on: 11 Aug 2004, 13:49:24 »
Hmm... I'll try to take a closer look at this later. Right now, I'm pretty tired. One thing to point out though: you should never use the variable _x in scripts. The reason is, in commands like "count" and "foreach", the variable _x is used in a special way. So to avoid any confusion if you ever later use those commands, you should just make it a habit to never use _x as a variable. Try something more descriptive anyway, like _captive or something.

As for the switchmove, try switchmove "FXStandSurDown". Also, you can have the captive actually put his weapon down (so the player can pick it up) using the "action" command:

_unit action ["DROP WEAPON", _unit, 0, 0, (primaryweapon _unit)]

You should still use removeallweapons after that though, to get rid of grenades and such.

Oh yeah, and while you're at it, try my surrender script I wrote. Grab it here: http://www.ofpec.com/editors/resource_view.php?id=679
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!