Home   Help Search Login Register  

Author Topic: Rifle Holster Script (HELPP PLEASE)  (Read 2530 times)

0 Members and 1 Guest are viewing this topic.

Offline ModestNovice

  • Members
  • *
Rifle Holster Script (HELPP PLEASE)
« on: 26 Jun 2008, 04:25:28 »
K I have this script. It works, only, its will remove your gun even if its not rifle AND when I holster it, then try to unholster, it says I have no weapon.

SOO:

How do i make it only remove if its a rifle.

AND

How do make it save your weapon, then add it back later?

Code: [Select]
_weps = weapons player;
_mags = magazines player;
_howmuch = count _weps;
_weapon = [vehicle player] call mando_my_weapon;
_sWeap = secondaryWeapon player;

if (holstered) then
{
{player addWeapon _x} foreach _weps;
{player addmagazine _x} foreach _mags;
ctrlSetText [33, "Unholstered"];
Sleep 1;
ctrlSetText [33, ""];
holstered = false;
} else {
if (_weapon == "") then
{
ctrlSetText [33, "You don't have a rifle!"];
_holstered = false;
Sleep 1;
ctrlSetText [33, ""];
} else {
if (_howmuch > 1) then
{
ctrlSetText [33, "You can only holster one rifle!"];
Sleep 1;
ctrlSetText [33, ""];
} else {
removeAllWeapons player;
_holstered = true;
ctrlSetText [33, "Holstered"];
Sleep 1;
ctrlSetText [33, ""];
};
};
};
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #1 on: 26 Jun 2008, 14:05:59 »
Take a look at Cheetah's holster pistol script here: http://www.ofpec.com/ed_depot/index.php?action=details&id=414&page=0&cat=xyz and Spooner's getWeaponType script here:http://www.ofpec.com/forum/index.php?topic=30473. Combining those should get you what you need.

edit: Reading down further in Spooner's thread I think he states that you need only check that the weapon is of type primary. Check the code snippet in his second post.
« Last Edit: 26 Jun 2008, 14:17:07 by Mr.Peanut »
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #2 on: 26 Jun 2008, 15:33:02 »
If you are looking at weapons in a soldier's inventory, you can work out the rifle, since it is also your primaryWeapon. Any launcher is your secondaryWeapon and your pistol is neither of these. You only need to know the type of a weapon if it isn't in someone's inventory and all you know is its class name (e.g. when it is in a SPON Money shop).

To save you some time, what you want has already been done by Colonel Sanders Light (Weapon switching).

This also isn't an advanced topic.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline ModestNovice

  • Members
  • *
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #3 on: 26 Jun 2008, 20:57:04 »
OKAY Will someone please help we with this ?? ??!?!?!

 :dunno: ??? :confused:
« Last Edit: 29 Jun 2008, 23:56:33 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline ModestNovice

  • Members
  • *
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #4 on: 06 Jul 2008, 00:42:49 »
Well no help for over a week now.

Thanks!  >:(
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #5 on: 06 Jul 2008, 11:35:51 »
DaChevs,

Both Mr Peanut and Spooner responded to you on the 26th June, which you seemingly decided to ignore, also on the 26th June.

This does not tend to encourage anyone else to offer some other solution when you have obviously ignored suggestions so far.


Planck
I know a little about a lot, and a lot about a little.

Offline ModestNovice

  • Members
  • *
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #6 on: 07 Jul 2008, 01:23:03 »
I DID NOT ignore them. I said I would look again, but as I stated clearly before, I looked in Cheetah's script and DID NOT understand it that much! That is why I asked again for the help. So again I will say it, I know they responded, and I did not ignore their posts, I have talked to ColonelSandersLite himself, but he hasn't been able to help yet. I know you guys have better things to do, but I would appreciate if someone would please help me get this sorted out?
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #7 on: 07 Jul 2008, 01:47:29 »
I'd suggest you go back and actually read the thread again and see if any of your statements are true. Is it possible that you edited out the comments you are talking about so we didn't actually see them?

You made an initial request. Both Peanut and I made reasonable suggestions within a very short time scale. Then you just repeatedly asked for help without acknowledging our replies, explaining why our solutions were not appropriate or giving any further details. What were we supposed to do?

When we make suggestions, we try to point you in the direction before we roll up our sleeves and do the work for you. If we don't help you to your satisfaction, then spitting out your dummy won't encourage us to help you next time. No more flaming on this thread, though. If you feel you have a genuine gripe with us, please continue this in PM or nowhere at all.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Cheetah

  • Former Staff
  • ****
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #8 on: 07 Jul 2008, 11:22:54 »
Please let's get it clear for me what you exactly want. The holster script works for you I guess? That's what you want, only then not for pistols but the holstering of the primary weapon (rifle, SAW etc). Correct?

Also, please reduce the size of your avatar to something like 85x85.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #9 on: 07 Jul 2008, 14:06:45 »
Well, there are two problems with that script:
Code: [Select]
removeAllWeapons player;The command you are using is removeAllWeapons, and you obviously don't want to remove all of them.

Your second problem is that you are saving the magazines and weapons in a local variable. Once the script exits those variables are erased from memory. You should either change them to global variables, or save them to the unit using the setVariable command.

What you should have done was read Cheetah's holster script, which is almost identical to what you want, and then asked us about anything that you did not understand. We are trying to help you to help yourself. You can learn a lot by understanding other people's scripts and modifying them.

As for the avatar. OFPEC has a strict policy. We want our forums to be clean and easy to read with as few distractions as possible. I am not a football fan, but even before your avatar grew I hated it. I hate the look on his face. Please reduce it before I vomit.


#Avatar removed - bedges
« Last Edit: 08 Jul 2008, 19:08:01 by Mr.Peanut »
urp!

Offline ModestNovice

  • Members
  • *
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #10 on: 08 Jul 2008, 03:46:07 »
I'm sorry about the avatar, an admin told me/changed my signature, but never said anything about my avatar. And, Football (SOCCER) is the greatest sport ever invented.  :yes:

And Juninho is awesome.

And yes, Cheetah, I am looking for exactly what you stated.

And yes, when you guys suggested Cheetah's script, I had already looked in there 3-4 times, and again when you stated to. but could not understand what was going on with all the save weapons and isPistol commands.
« Last Edit: 08 Jul 2008, 03:48:20 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #11 on: 08 Jul 2008, 19:18:11 »
In Cheetah's script, try changing:
Code: [Select]
_pistolConfig = configFile >> "CfgWeapons" >> "PistolCore";to
Code: [Select]
_pistolConfig = configFile >> "CfgWeapons" >> "RifleCore";
urp!

Offline ModestNovice

  • Members
  • *
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #12 on: 08 Jul 2008, 20:29:25 »
okay thanks Peanut  ;)

sry for my thick skull.  :D


Woooowww...I can now holster me rifle. Thanks Peanut, and I shall admit, I am one dumbshit. Excuse my language, but hey, you know you agree  ;).
« Last Edit: 08 Jul 2008, 20:39:14 by DaChevs »
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #13 on: 08 Jul 2008, 20:57:25 »
You are not a dumbshit, you are simply learning to script and Cheetah's script is hard to understand, especially for a beginner. I had to read it a few times myself to unravel it.
« Last Edit: 08 Jul 2008, 21:02:20 by Mr.Peanut »
urp!

Offline ModestNovice

  • Members
  • *
Re: Rifle Holster Script (HELPP PLEASE)
« Reply #14 on: 09 Jul 2008, 22:20:52 »
Heh. Thx Peanut  :)
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley