OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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
-
You want to execute a script from a units init field, then use:
this exec "nameofyourscript.sqs"
or
nameofyourunit exec "nameofyourscript.sqs"
Planck
-
or if it has parameters that need to be passed into the script:
[parameter1,parameter2] exec "myscript.sqs"
-
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
-
say you have a script that looks like the following:
;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.
[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:
[sodding_idiot,"M16"] exec "myscript.sqs" where _unit = sodding_idiot and _wpn = "M16".
-
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.)
-
thanks tyger thats a lot clearer for me. thanks for the link aswell
cheers aswell plank
-
no problem, mate. Just here to help ;)