Home   Help Search Login Register  

Author Topic: custom weapons  (Read 984 times)

0 Members and 1 Guest are viewing this topic.

benbramz

  • Guest
custom weapons
« on: 22 May 2005, 23:32:09 »
been flashpoint for somne time now but now the first toput my ideas into a game cant be held back anmore!  ;D

anyway i was setting up a custom weapons setup and i did use the addweapin but didnt like cit cos

a: the ammo needed reloading on start of the mission
b: a lot of writing lol!

so i downloaded david berkas equipment editor addon which compiles an sqs file for me. my question to the opec is what code do i need to execute this in the units init field.

cheers

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:custom weapons
« Reply #1 on: 22 May 2005, 23:42:29 »
You want to execute a script from a units init field, then use:

this exec "nameofyourscript.sqs"

or

nameofyourunit exec "nameofyourscript.sqs"


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

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:custom weapons
« Reply #2 on: 22 May 2005, 23:44:55 »
or if it has parameters that need to be passed into the script:
Code: [Select]
[parameter1,parameter2] exec "myscript.sqs"
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

benbramz

  • Guest
Re:custom weapons
« Reply #3 on: 22 May 2005, 23:47:38 »
parameters? just curious but what would be an example of that. im not too good with ofp scripting but i write bits of asp n stuff so i sorta understand the structuring of it.

im just using the weapons for start of game, so how wud parameter effect it?

cheers

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:custom weapons
« Reply #4 on: 22 May 2005, 23:59:57 »
say you have a script that looks like the following:
Code: [Select]
;Name of unit
_unit = _this select 0

;Name of weapon
_wpn = _this select 1

......
and you want to use that script on multiple units in your mission then you can use parameters in your init line.

Code: [Select]
[loon_one,"BAS_JM4ACOG"] exec "myscript.sqs" would, when used on the above script make _unit equal to the name loon_one and make _wpn equal "BAS_JM4ACOG".

another instance is:
Code: [Select]
[sodding_idiot,"M16"] exec "myscript.sqs" where _unit = sodding_idiot and _wpn = "M16".
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:custom weapons
« Reply #5 on: 23 May 2005, 00:03:57 »
check this page and find Johann G.'s scripting tute. It will help you learn about the parameters and such.

(i appologize if you've already read it.)
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

benbramz

  • Guest
Re:custom weapons
« Reply #6 on: 23 May 2005, 00:09:53 »
thanks tyger thats a lot clearer for me. thanks for the link aswell

cheers aswell plank

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:custom weapons
« Reply #7 on: 23 May 2005, 00:35:24 »
no problem, mate. Just here to help ;)
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08