Home   Help Search Login Register  

Author Topic: Weapon's Booth  (Read 2029 times)

0 Members and 1 Guest are viewing this topic.

Offline Evan Scown

  • Members
  • *
Weapon's Booth
« on: 18 Jun 2006, 22:13:30 »
Ok my idea is I have made alittle building (thanks to editor upgrade) and in it i have a desk and an officer. What I'm wanting to do is when a player approches the desk, he/she gets a nice happening set preset weapons. Is this doable? If so how?

Note the players are in a group called WGroup and are at the preasent not armed.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Weapon's Booth
« Reply #1 on: 19 Jun 2006, 19:02:24 »
are you talking about entering an armoury and selecting a weapon from the selection.

If so, for best results, this would require a dialog system

yes its doable
it would take a skilled scripter/dialog maker some effort to create a pleasant system

Its certainly not for the novice
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Weapon's Booth
« Reply #2 on: 19 Jun 2006, 19:21:29 »
hoping you have a single floor building, this way should work

set one trigger, size and shape as you need
anybody present (may be changed for your needs)
on activation: dude = thislist select 0; [dude] exec "addweapon.sqs"

script "addweapon.sqs"
Code: [Select]
_unit = _this select 0

_unit addmagazine "M16"
_unit addweapon "M16"
exit

Offline Evan Scown

  • Members
  • *
Re: Weapon's Booth
« Reply #3 on: 20 Jun 2006, 14:44:40 »
I've attached a screen shot with an idea cause I figured while a trigger would be handy for the for a talking part, I could do something like that in the script. But as you can see 8 guys, individually required to go in and kit up.

[attachment deleted by admin]

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Weapon's Booth
« Reply #4 on: 20 Jun 2006, 20:22:03 »
ok, wrote the following script for your purpose...hope it is what you need.
this script has to be started for every unit you like to get a weapon at table.

Code: [Select]
; ***********************************************************
; ** [this, table, 5, "G36A", "G36Amag", 3] exec "addweapon.sqs" **
; ***********************************************************
; ** Object might be a named object placed yourself, or a map object by using "object 12345" which might be pretty inaccurate
; ** A table or an invisible help object like a gamelogic might do the job

; getting variables
_unit = _this select 0
_object = _this select 1
_mindist = _this select 2
_weapon = _this select 3
_magazine = _this select 4
_magcount = _this select 5
_a = 0
; _unit = Unit which has to get weapon
; _object = Editor object which will "give" the weapon
; _mindist = distance unit to object ro receive Weapon
; _weapon = Weapon to give (duh)
; _magazine = no comment...guess it yourself ;-)
; _magcount = numbers of magazines to give

#loop
? (_unit distance _object) <= _mindist: goto "addweapon"
~1
goto "loop"

#addweapon
; removeallweapons _unit //uncomment this line if necessarly

#weaponloop
_a = _a + 1
_unit addmagazine _magazine
? _a != _magcount : goto "weaponloop"
_unit addweapon _weapon

#end
exit

greetings

[sT]-Myke[aO]

Offline Evan Scown

  • Members
  • *
Re: Weapon's Booth
« Reply #5 on: 20 Jun 2006, 20:31:44 »
Sweet, thanks mate. If I wanted to do multiple weapons and else, cause I'll prolly play around with howmany weapons I want, so like not define _weapon & _magazine till later in the script?

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re: Weapon's Booth
« Reply #6 on: 20 Jun 2006, 20:55:07 »
well, if you like to have multiple weapons (like a M16 with 4 mags, a LAW launcher with 3 missiles and a binoc and a NV google) you can just extend the script (you might fix insert a "addweapon "binocs" if you like to give everyone a binoc) for your needs.

Or you can call the script multiple times for each weapon. This way you could do something like "well soldier, you have now your rifle, go now to that table to get your LAW".

Myself, i like to keep things open in script and insert parameters while executing script. This way i can easily experiment around with different things without the need to alt+tab out of OFP and edit the script itself. Surplus you can use the same script for different needs without editing and saving it.
If i would have fix inserted the M16 in this script, and now you would like to have a sniper rifle for another unit, you would have a second script just for this guy.
And now imagine you would like to give every unit a different weapon....stupid idea i knw, but just think about...this would make 8 scripts.
With a "one-size-fits-all" script the mission file will be smaller. I know, .sqs files will not take a lot of space, but once you use a lot of scripting, it might be a difference between 100 scripts or 25 scripts. You get the idea.

But the most important thing: read my script carefully, i left a lot of comments in there for you. Check how the script works, what it does. Once you get the flow of a script you might be able to change it to your needs.