OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: benbramz on 22 May 2005, 23:32:09

Title: custom weapons
Post by: benbramz 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
Title: Re:custom weapons
Post by: Planck 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
Title: Re:custom weapons
Post by: Tyger 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"
Title: Re:custom weapons
Post by: benbramz 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
Title: Re:custom weapons
Post by: Tyger 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".
Title: Re:custom weapons
Post by: Tyger on 23 May 2005, 00:03:57
check this (http://www.ofpec.com/editors/browse.php?browsewhat=1&start=75) 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.)
Title: Re:custom weapons
Post by: benbramz on 23 May 2005, 00:09:53
thanks tyger thats a lot clearer for me. thanks for the link aswell

cheers aswell plank
Title: Re:custom weapons
Post by: Tyger on 23 May 2005, 00:35:24
no problem, mate. Just here to help ;)