OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: marcus3 on 15 Mar 2005, 14:05:30

Title: lock picks
Post by: marcus3 on 15 Mar 2005, 14:05:30
is there some script where you can walk up to a car then choose "pick lock"
then based on you skill you ether unlock or fail?

thanks

Title: Re:lock picks
Post by: Grunt249 on 15 Mar 2005, 14:18:41
I don't think there is a script like this yet, but it sounds fairly easy to do. One question I can think will be asked is, how will the skill be based?

It could call for the script to have seperate areas for each skill level, and the higher the level, the more chance of success. For example, at "noob" level the chances are 1/10th...while at "expert" level the chances are 7/10th.

Each locked vehicle would have a trigger near it, and when someone gets within the trigger it calls a script to first detect the skill level, then go to the proper area in the script for that skill. Then, it will pretty much just pick a random number between 1 and 10, and say the person was "noob" level, if the random number chosen was 1 it would unlock, all other numbers and it's a fail.

The part I don't know yet is the script needed to constantly monitor each person to detect their skill level, and to upgrade it as needed. I'm still new to scripting, but maybe this is a start?
Title: Re:lock picks
Post by: marcus3 on 15 Mar 2005, 14:26:53
or
in a int.sqs you can put
guylevelatlockpicking = 1
1 being noob and 10 being grandmaster
then when you walk up to a car a script starts something
where it checks your level then go's to a random number like
you walk up to car click "lockpick" script checks level
then if you level was at 3 lets say then it would do this
choose a random number between 3 and 10. if the number comes back as 10 it unlocked. but if it comes back as 6 then its not unlocked.
so the higher you level at lock picking the better chance at unlocking it.
and after you pick a few locks you will go up a level like this
manlevelatlockpick = manlevelatlockpicking +1
then...
........
.........
..........
............
............
how to do all that?
Title: Re:lock picks
Post by: marcus3 on 15 Mar 2005, 15:30:52
here is something after you walk into a trigger you get a action "pick lock" this is the sqs

hint "picking"
~4
?(jasonlockpicklevel<3) :goto "level3lock"

#level3lock
carlock = random 5
?(carlock<4): lockedcar lock false: hint "unlocked"
?(carlock<5): hint "did not work"
?(carlock<3): hint "did not work"
?(carlock<2): hint "did not work"
?(carlock<1): hint "did not work"

its a start what you think?
Title: Re:lock picks
Post by: marcus3 on 16 Mar 2005, 19:35:08
i dont know what to do next......help
Title: Re:lock picks
Post by: marcus3 on 16 Mar 2005, 22:59:51
me thinks that nobody wants to help
Title: Re:lock picks
Post by: Pilot on 17 Mar 2005, 17:09:09
Try changing the .sqs to something like this:
Code: [Select]
hint "picking"
ManName playmove "medic"
~4
?(jasonlockpicklevel<3) :goto "level3lock"

#level3lock
carlock = random 5
?(carlock<1): goto "locked"
?(carlock<2): goto "locked"
?(carlock<3): goto "locked"
?(carlock<4): goto "unlocked"
?(carlock<5): goto "locked"

#locked
hint "Did not work"
exit

#unlocked
lockedcar lock false
hint "unlocked"
exit
Where ManName is the name of the lock picker.
Title: Re:lock picks
Post by: marcus3 on 17 Mar 2005, 19:09:07
ok me try
Title: Re:lock picks
Post by: marcus3 on 17 Mar 2005, 21:06:51
thanks this works good!
Title: Re:lock picks
Post by: XCess on 18 Mar 2005, 17:10:52
Dude, this would be so easy it's stupid. Just a lot of numbers is all.

=====================================================
; XCess' LockPick Script v0.1b
; Developed at marcus3's request
; Note: This code is untested

; pik_action.sqs
; This script controls the action menu for XCS_LockPick.

; man with pick skills
XCS_Pik_man = _this select 0
; set picklock level to 0
XCS_Pik_lev = 0
; Var to stop action adding more than once
_Pik_act = 0


#loop
; Check to see if a lock is nearby
XCS_Pik_car = nearestObject [XCS_Pik_man, "car"]
?(XCS_Pik_man distance XCS_Pik_car) < 2.5 && locked XCS_Pik_car && (_Pik_act != 1): XCS_Pik_lok = XCS_Pik_man addaction ["Pick Lock","pik.sqs"]; _Pik_act = 1
?(XCS_Pik_man distance XCS_Pik_car) > 2.5 || !(locked XCS_Pik_car) : XCS_Pik_man removeAction XCS_Pik_lok; _Pik_act = 0

; End Script
? XCS_Pik_End : exit
~2

goto "loop"

=====================================================

; ; XCess' LockPick Script v0.1b
; Developed at marcus3's request
; Note: This code is untested

; pik.sqs
; This script deals with the lock picking

_chance = random 10 - XCS_Pik_lev

?(_chance <= 1): goto "unlok"
hint "pick failed"
exit

#unlok
XCS_Pik_car lock false
?(XCS_Pik_lev < 9) : XCS_Pik_lev = (XCS_Pik_lev + 0.5)
hint "car unlocked"
XCS_Pik_man removeAction XCS_Pik_lok
exit

=====================================================

Two scripts. Untested as I don't have flashpoint installed on this computer. Could probably be improved a hundred fold with some testing but it should work as is.

To end the script make the condition XCS_Pik_End true (XCS_Pik_End = true).

Skill will increase after every successful pick. Skill level can be set at any time with the XCS_Pik_lev global. 9 is maximum.

Title: Re:lock picks
Post by: XCess on 20 Mar 2005, 13:13:19
i hate it when topics die after i post :(
Title: Re:lock picks
Post by: marcus3 on 21 Mar 2005, 12:26:59
why do you think they die?
Title: Re:lock picks
Post by: XCess on 21 Mar 2005, 17:25:14
Lol.. well it must be either everyone one the board hates me or because the threads are solved..
You tried the script? Any good?
Title: Re:lock picks
Post by: Blanco on 21 Mar 2005, 19:03:48
Code: [Select]
#loop
; Check to see if a lock is nearby
XCS_Pik_car = nearestObject [XCS_Pik_man, "car"]
[b]?(XCS_Pik_man distance XCS_Pik_car) < 2.5 && locked XCS_Pik_car : XCS_Pik_lok = XCS_Pik_man addaction ["Pick Lock","pik.sqs"][/b]
?(XCS_Pik_man distance XCS_Pik_car) > 2.5 || !(locked XCS_Pik_car) : XCS_Pik_man removeAction XCS_Pik_lok

; End Script
? XCS_Pik_End : exit
~2

goto "loop"

I think the loop will create a new action every 2 second when the XCS_Pik_man is within 2.5m and the car is locked...
No?

Title: Re:lock picks
Post by: XCess on 21 Mar 2005, 21:17:11
So it would Blanco.. forgot to add a check for that, as iI said it was untested.. I'll edit the code to solve the bug in the post above. Thanks for spotting it ;D

Done.. I think, minds a bit groggy today after a not so nice wake up call.
Title: Re:lock picks
Post by: marcus3 on 22 Mar 2005, 00:26:32
i am trying right now
Title: Re:lock picks
Post by: marcus3 on 22 Mar 2005, 00:33:58
the code dont work but thats ok man dont worry about it
:)
Title: Re:lock picks
Post by: XCess on 22 Mar 2005, 02:39:52
Still no idea why most of my posts are ignored  ::)
I think I'll put together a working version of the script at some point, I've written that code without even opening the game so it was bound to be a bit buggy.
Title: Re:lock picks
Post by: marcus3 on 22 Mar 2005, 18:29:01
well mmm good luck