Home   Help Search Login Register  

Author Topic: disable drop weapon  (Read 2460 times)

0 Members and 1 Guest are viewing this topic.

juxie

  • Guest
disable drop weapon
« on: 19 Jan 2006, 04:36:16 »
How can I disable the drop weapon action?

I have a weapon which I would not want players to drop it.
Please advice.

Thanks

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:disable drop weapon
« Reply #1 on: 19 Jan 2006, 10:52:53 »
The drop weapon action is hardcoded into the game. It cannot be removed or disabled. If you explain why you want to disable this feature, people might be able to help you with a scripted workaround
OFPEC | Intel Depot
RETARDED Ooops... Retired!

juxie

  • Guest
Re:disable drop weapon
« Reply #2 on: 19 Jan 2006, 11:53:53 »
Basically I have a static object on the ground which I can pick up and store it in an inventory.
From here, player will have option to equip the object if it's in inventory and drop it from inventory.
Once equipped player, the object will become a weapon that can be used to kill others.
However, once it becomes weapon, the drop weapon & magazine options will appear.

From config I have a weapon that I created with canDrop=false.

This remove the drop weapon options.
However, I could not find a way to remove the drop magazine options.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:disable drop weapon
« Reply #3 on: 19 Jan 2006, 14:26:05 »
I didn't realise you are making an addon. Then it must (I assume) be possible to remove the drop magazine command, as you did with the weapon. However I'm no addon maker. I know nothing about configs, so you'll have to wait until one of the config guru's arrives  ;)

Only advice I can give you is to look inside FDF-mod's deployable weapons. They have heavy machineguns that can be carried as equipment. The ammo bearer does not recieve the "magazine" options until the weapons are deployed on the ground.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

juxie

  • Guest
Re:disable drop weapon
« Reply #4 on: 20 Jan 2006, 05:53:14 »
I can think of a way which is when player activates the drop option, I will replace the weapon dropped with the static object.

Is there a way that checks if player selects the drop weapon option?

Offline XCess

  • Former Staff
  • ****
Re:disable drop weapon
« Reply #5 on: 20 Jan 2006, 06:36:09 »
You could always run a check to see whther the weapon is changed,
this short script will check whether the player has the same weapon he
did when the script was executed and display text when or if he drops
the weapon.

;===================================

_startWeap = weapons soldierName

#loop
?(weapons soldierName) != _startWeap : goto "end"

~0.1
goto"loop"

#end
titleText ["weapon change!","plain down"]
;===================================



*EDIT*
on second thought it may need to be changed to something like:

;===================================

_currentWeap = weapons soldierName
?(_currentWeap select 0) != (_startWeap select 0) : goto "end"
;==================================

switch the original goto line with the
se two if the player or AI is likely to have
a second weapon.

NOTE: this script has not been tested.


Further, if you wish to make sure the player (or AI) has not picked up
another weapon you could add checks like:

;=====================================

?(_currentWeap select 0) != null : hasWeapon = true
;=====================================

You may have to switch null with a double speech mark "" I'm not sure.

Also, if you want to check for secondary weapon rather than primary,
simply switch the 0 after each 'select' to a 1. Pistols, would be 2, but
that's a major guess.

Hope atleast some of this helps.


« Last Edit: 20 Jan 2006, 06:51:52 by XCess »

juxie

  • Guest
Re:disable drop weapon
« Reply #6 on: 21 Jan 2006, 03:26:17 »
Thanks XCess, it helps.

Now I am left with the problem if the ammo is dropped.
Any suggestions?

Offline XCess

  • Former Staff
  • ****
Re:disable drop weapon
« Reply #7 on: 21 Jan 2006, 03:44:26 »
;=============================================
_mags = count (magazines soldierName)

#loop
? mags > (count (magazines soldierName)) : goto "end"

~0.1
goto"loop"

#end
exit
;=============================================

That should do. I hope :)

juxie

  • Guest
Re:disable drop weapon
« Reply #8 on: 21 Jan 2006, 13:40:06 »
Thanks XCess for the quick reply.

I tried to do it your way, however, when I drop ammo, the ammo will appear on the ground.
That is the weaponHolder created with the ammo for the my weapon.
I want to remove this.
One way is to find out if the magazineCargo in the weaponHolder is the ammo for my weapon.
But I could not get the what magazine is in the weaponHolder.

I tried:

magazines _weaponHolderObject

but it returns nothing.

Any suggestions?

Offline XCess

  • Former Staff
  • ****
Re:disable drop weapon
« Reply #9 on: 21 Jan 2006, 14:53:10 »
I'm not sure what you mean, are the magazines actually used by the object or are they stored as they would be with a crate?

If you want to delete the ammo when you drop it so it does not appear on the ground, you could use

;=====================================

_ammoT  = nearestObject [player, "className
deleteVehicle _ammoT
;=====================================

you can ofcourse add the ammo back to the player if you want him to keep it to stop him from droppng it.

Sorry if this is totally irrelevant, but I've lost count of the total time it's been since I've last slept. Off to bed I think ::)
« Last Edit: 21 Jan 2006, 14:53:26 by XCess »

juxie

  • Guest
Re:disable drop weapon
« Reply #10 on: 22 Jan 2006, 03:48:41 »
Unfortunately when I tried to  do:

_ammo = nearestObject[player, "AmmoCLassName"]

it returns a null object.

However if I do:

_ammo = nearestObject[player, "WeaponHolder"]

it returns me the weapon holder but I just can't check what is in the WeaponHolder.
Any idea how to get what's inside a weapon holder?

Thanks for you help.

Offline XCess

  • Former Staff
  • ****
Re:disable drop weapon
« Reply #11 on: 22 Jan 2006, 11:49:16 »
Does the weapon hold ammo as a crate or as a normal weapon would?

I do not believe there is a check for ammocargo but 'magazines', 'weapons' and 'ammo' are all checks on weapons themselves.

remember: always make sure there isn't a letter missing!! Don't know how many times I've been confused for hours as to why a script isn't working and it turned out to be a typo  ::)
« Last Edit: 22 Jan 2006, 11:50:17 by XCess »

juxie

  • Guest
Re:disable drop weapon
« Reply #12 on: 23 Jan 2006, 01:56:34 »
I tried checking for magazines, weapon, ammo all returns empty.