Home   Help Search Login Register  

Author Topic: Weapon in hand  (Read 2832 times)

0 Members and 2 Guests are viewing this topic.

sussmori

  • Guest
Weapon in hand
« on: 23 Aug 2002, 06:20:30 »
Hi,

Is there any way to tell what weapon the player is holding in his hand at any time? For example, if I have a 'knife' weapon, is there anyway to tell if the player has pulled it out, ie. in his hand?

Maybe even a way to modify the addon to make it have ammo when it's selected? Anything at *all* would be great!

Gameer_77

  • Guest
Re:Weapon in hand
« Reply #1 on: 23 Aug 2002, 22:20:46 »
Im afraid you cant tell if the person is holding the weapon but you can tell if he has it by using the hasweapon command.

player hasWeapon "knife"

 8)PEACE

mikeb

  • Guest
Re:Weapon in hand
« Reply #2 on: 24 Aug 2002, 00:03:32 »
Look at the "how can I check..." thread lower down in this section.  Various suggestions for the same sort of problems.  Not exactly a solution, more of an alternative.  But still good!

sussmori

  • Guest
Re:Weapon in hand
« Reply #3 on: 24 Aug 2002, 06:47:03 »
Look at the "how can I check..." thread lower down in this section.  Various suggestions for the same sort of problems.  Not exactly a solution, more of an alternative.  But still good!

Unfortunately, this script uses the nearestObject to find a LAW, bullet, etc in the air, but a knife addon does not "fire" anything, so this method will not work.

mikeb

  • Guest
Re:Weapon in hand
« Reply #4 on: 24 Aug 2002, 14:46:23 »
Sorry I gave you the wrong link!

There is a thread somewhere on the forum along thses lines but I can't find it.

One idea I just thought of is using the 'hasweapon' command.

This will detect if the person actually has the weapon though, not if it's only concealed.

A way around this is to (if it's the player who's concealing the knife) create new actions for the action menu called conceal and reveal which actually removes the weapon and gives it back to the player.

Hence, enemies will only attack if he actually has the weapon technically.

I'll right a couple of scipts for you and post them here.

mikeb

  • Guest
Re:Weapon in hand
« Reply #5 on: 24 Aug 2002, 15:12:39 »
I'm assuming your problem is that you want the enemy only to be aware of you as their enemy if they see you have a knife?  If not, then a variation on the following may still be useful.

As there is no real way to check in hand weapons you have to cheat the computer by actually removing and recovering the weapon.  So start with your player as setcaptive false and here goes....

;This is headed "reveal.sqs"
;Put player addaction ["Take out knife","reveal.sqs"] in players init field


player addweapon "knife"
;(or whatever it's called)
player removeaction "Take out knife"
player addaction ["conceal knife", "conceal.sqs"]

exit





;Then create the conceal.sqs

player removeweapon "knife"
player removeaction "conceal knife"
player addaction ["reveal knife", "reveal.sqs"]


Then you create a trigger that will activate if the enemy knows about the player and he has a knife and in the activation box you can switch the players captive status.


This may all require some fiddling but you get the idea.  If the person who was asking about a similar problem earlier on is out there, then this is yet another alternative to your problem!

I hope this helps

M

mikeb

  • Guest
Re:Weapon in hand
« Reply #6 on: 24 Aug 2002, 15:26:15 »
Sorry yet another mistake!


I'll reprint


;This is headed "reveal.sqs"
;put (knifeholding = player addaction ["Take out knife","reveal.sqs"]) in players init field


player addweapon "knife"
;(or whatever it's called)
player removeaction knifeholding
notholdingknife = player addaction ["conceal knife", "conceal.sqs"]

exit

;Then create the conceal.sqs

player removeweapon "knife"
player removeaction notholdingknife
player addaction ["reveal knife", "reveal.sqs"]


I think that's it!

mikeb

  • Guest
Re:Weapon in hand
« Reply #7 on: 24 Aug 2002, 19:08:36 »


[attachment deleted by admin]

mikeb

  • Guest
Re:Weapon in hand
« Reply #8 on: 24 Aug 2002, 19:18:46 »
...and if you need to give him ammo for this, do that in the init too.....

mikeb

  • Guest
Re:Weapon in hand
« Reply #9 on: 24 Aug 2002, 19:21:22 »
This only really works best for non-ammo weapons as getting rid of weapon also seems to get rid of ammo.  You could addmagazine every time but this does give you never-ending ammo.  If someone knows a way to alter this (and can be bothered), that would be nice!!!

mikeb

  • Guest
Re:Weapon in hand
« Reply #10 on: 24 Aug 2002, 19:25:39 »
Wow, I love repeat posting.  Actually it does work with ammo, just need to press space bar!!!!  It may look like it's replenished your mag of ammo but it's actually just reloaded the defecit rounds so the total round number is still the same!!

FINALLY!!!!

danbryant4

  • Guest
Re:Weapon in hand
« Reply #11 on: 26 Aug 2002, 16:24:31 »
7 posts in a row on the same topic. Way to go MikeB!!!!!!!  :P

Seriously though, I haven't tried the script yet, but it my prove to be very useful.

Daniel J Bryant

mikeb

  • Guest
Re:Weapon in hand
« Reply #12 on: 26 Aug 2002, 16:36:51 »
Yeah I know!!!

I was just trying to do what ended up as a simple script but stupidly decided to post in between attempts.  What a waste.  I've also talked about this and combinations with knowsabout and changing weapons in the mission idea section for assassinations.  Hopefully some good will come out of this mess.

Sorry to anyone who may have been a bit thrown by the whole process!!!!

M