OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Bebbe on 31 May 2007, 00:32:30
-
I am making an Prison Break Mission where you will be able to buy weapons from people. but ofc i want the script to be like when i draw my gun the guard will shot me. but if my gun is holstered they wont.
sorry for my bad english :p and thanks for the help.
-
what u cud do is add action... seting ur player captive wen he have no weapon
heres quick idea... didnt had tim 2 develop it yet... but if no1 gives beter reply ill look into it more deeply
1st if ur unit is civie u have 2 edit da mission.sqm nd make him on 1 of da sides (depends wich side is da police... police west, player east)
now u put in da players init (put da type of weapon instead of weap... everytime player gets new weapon use weap = "nameOfWeapon" in da script or nywere
this addaction ["Draw weapon","draw.sqs"]; this setcaptive true; weap = "nameOfWeapon"
heres da script
draw.sqs
_man = _this select 0
_act = _this select 2
_man setcaptive false
_man removeaction _act
_man addaction ["Holster weapon","hols.sqs"]
_man addweapon weap
exit
now another script
hols.sqs
_man = _this select 0
_act = _this select 2
_man setcaptive true
_man removeaction _act
_man addaction ["Draw weapon","draw.sqs"]
_man removeWeapon weap
exit
LCD OUT
-
AFAIK, there is no way to detect whether a unit has a weapon in hand, or what weapon they are holding, so LCD's solution might be the only way.
-
I like the script but there is one problem tho... when i holster the weapon again and then draw it will refill with ammo again... is there possible to make the script remember how much ammo there was when i holstered?
hope i made myself clear :)
-
Another thing too.... i am trying to mmake my Civi to change side to East.
class Item2
{
side="EAST";
class Vehicles
{
items=1;
class Item0
{
position[]={9810.956055,26.730000,4008.541992};
azimut=180.000000;
id=63;
side="EAST";
vehicle="Civilian";
player="PLAYER COMMANDER";
leader=1;
skill=0.600000;
text="Man";
But still West wont kill me anything wrong?
-
I like the script but there is one problem tho... when i holster the weapon again and then draw it will refill with ammo again... is there possible to make the script remember how much ammo there was when i holstered?
Should be solvable. There are commands to return the magazines and weapons. All you have to do is store and update this array of magazines in a ( global) variable and use it again when you add the weapons and ammo in the draw script. That's the theory... Things are getting harder when you want to make such a script generic. What happens when the player decides to take another weapon from a crate, enemy or fallen teammate?
Anyway, I don't know I can write it, but I'm sure the big boys can :)
I'm thinking about these commands:
Magazines (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=m#magazines)
Ammo (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=a#ammo)
Weapons (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=t#weapons)
PrimaryWeapon (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=p#primaryWeapon)
SecondaryWeapon (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=s#secondaryWeapon)
PS :There was a good OFPscript back in the ol' days, but I can't find it back.
-
i cant add a mag w/ less dan full ammo... but if player empties clip i can remove it...
i updated da scripts in ma post above
LCD OUT
-
To make your civi east, group him with an east unit of higher rank, and in the init for that unit put:
deleteVehicle this
Good for SP only.
-
updated script again :D now itll keep da amount of ammo.... check out ma 1st post :D
LCD OUT
-
Bebbe, please try avoid thread titles like "Need help with script". It's much better to use titles that describe the problem. This helps people who might be able to answer your question; helps people in the future who are searching for answers to similar questions; and makes the forum easier to use and understand.
Please use titles like "How to detect when gun is holstered?" ;)
Many thanks.
-
Yes you are probably right i will make the thread titles informative from now on
updated script again :D now itll keep da amount of ammo.... check out ma 1st post :D
LCD OUT
. Okay thanks i would have to test the script tommorow since i have a hell of alot to do right now. if i get any problems i let you guys know thanks alot for help :)
-
Another pointer Bebbe; you don't have to quote the entire previous post you're replying to (infact we don't like it at all), so I've removed the quote which included the whole of macguba's post..
I'm pretty sure everyone understands to whom you were replying to even without the quote :)