Home   Help Search Login Register  

Author Topic: mission.sqf  (Read 5233 times)

0 Members and 1 Guest are viewing this topic.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
mission.sqf
« on: 16 Feb 2009, 09:16:27 »
Does anyone know what the mission.sqf (not .sqm) is good for?

I found a PDF that states:
Quote
[It] is a script file that is executed once units and groups have been created. This script will create
vehicles and move in units, create waypoints and set up all other editor objects.

This script is not loaded when you Preview a mission from the editor. But if the mission is running and you press ESC and select Restart it is loaded (according to ProcMon). However, it looks like no units got initialized this time.

Note: my mission.sqf was empty. Adding "finishMissionInit;" did not change the observed behaviour.


Any hints?
try { return true; } finally { return false; }

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: mission.sqf
« Reply #1 on: 16 Feb 2009, 09:22:47 »
 :blink: :blink:

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mission.sqf
« Reply #2 on: 16 Feb 2009, 09:28:14 »
...to boldly go where no man has gone before!  :cool2:
try { return true; } finally { return false; }

Offline Rommel92

  • Members
  • *
Re: mission.sqf
« Reply #3 on: 16 Feb 2009, 10:19:55 »
Try adding:

Code: [Select]
sleep 1; hint "WHOA";
And without it becoming executed from any scripts, if that comes up. . . Whoa.  :blink:

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mission.sqf
« Reply #4 on: 16 Feb 2009, 12:17:17 »
Sleeping results in a "Generic error in expression" and hint isn't working either. But you can write to the arma.RPT via createVehicle.

When the mission.sqf is run it looks like nothing gets initialized at all: there are no visible units and even the camera is still at the same position where it was before you "Retry"d. This is probably a very early stage of the initialization process (init.sqf has not been executed at this point).

I also wonder why the following commands exist. They seem to be of no real use:
- activateAddons
- finishMissionInit
- initAmbientLife
- missionConfigFile
- runInitScript


Edit: Units spawned from mission.sqf with createVehicle show up but do not move (except blinking).

« Last Edit: 16 Feb 2009, 12:29:28 by Worldeater »
try { return true; } finally { return false; }

Offline norrin

  • Tutorial Writer
  • **
Re: mission.sqf
« Reply #5 on: 16 Feb 2009, 12:52:56 »
All I know is that the mission.sqf is created in VBS2 missions so my guess is that it may be related to the VBS real time editor or the 3d editor which maybe coming to ArmA2.  Here's a snippet of the sort of into it contains;
Code: [Select]
if (!isNil "_map") then
{
  call compile preProcessFile "\vbs2\editor\Data\Scripts\init_global.sqf";
  initAmbientLife;
};

_func_COC_Create_Unit = compile preprocessFile "\vbs2\editor\data\scripts\unit\create_Unit.sqf";
_func_COC_Update_Unit = compile preprocessFile "\vbs2\editor\data\scripts\unit\update_Unit.sqf";
_func_COC_Delete_Unit = compile preprocessFile "\vbs2\editor\data\scripts\unit\delete_Unit.sqf";
_func_COC_Import_Unit = compile preprocessFile "\vbs2\editor\data\scripts\unit\import_Unit.sqf";
« Last Edit: 16 Feb 2009, 12:54:28 by norrin »

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: mission.sqf
« Reply #6 on: 16 Feb 2009, 17:36:48 »
hmm,
 sounds like an early ambient life process, something similar to what i use in my islands ,where they are populated via .sqf files initialzeded from the island config itself,i wonder if the activation process someway similar to the ,intro missions and scripts that run when you exit an island but these run in parallel to the mission.sqm in realtime  ,I.E the units and objects you see in the background in the UI are actually created whilst the user mission.sqm is live, interesting find i will take a look at these if  get a chance.
« Last Edit: 16 Feb 2009, 17:39:18 by DeanosBeano »
I love ofp

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mission.sqf
« Reply #7 on: 16 Feb 2009, 22:49:09 »
I.E the units and objects you see in the background in the UI are actually created whilst the user mission.sqm is live
Uhm, if you're refering to the "animated background" of the main menu: these are the intros(!) of standard missions ("intro.Sara", "Intro.intro"). Both are contained in the IntroAnims.pbo.


According to norris' post it should theoretically be possible to write custom "mission bootstrapping". Maybe someone with access to a generated mission.sqf can provide a big picture of what has to be done in order to initialize a mission.
try { return true; } finally { return false; }

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
Re: mission.sqf
« Reply #8 on: 16 Feb 2009, 23:02:26 »
 yup, fully aware of those mate,
 what my thoughts are is that this .SQF is tied to it and we can actually have those working from island init real time, in order we can have civs etc populating the island and not interfering with mission.sqm.
 of course my fascination is clouding my judgement ;) but thats because it took me along time to get a tree/house/wall  to init a sqf via visitor and thats how my islands are populated with people before a missionmaker even places a unit in the editor , maybe its wishful thinking but it would be nice if we could have  an ambient mission.sqf for ambient life and a mission.sqm for our soldiers ,tanks game logics etc.

 i await your findings , i know you wont give up till ya get to the bottom of it all.

 DB
« Last Edit: 16 Feb 2009, 23:04:02 by DeanosBeano »
I love ofp

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: mission.sqf
« Reply #9 on: 17 Feb 2009, 08:20:01 »
Quote
Units spawned from mission.sqf with createVehicle show up but do not move (except blinking).
Just thought I'd point out that happens no matter where you createVehicle a soldier and it has been so since OFP; createvehicle creates an empty vehicle so you're creating a soulless and brainless shell.
Hence why there's the command createUnit..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mission.sqf
« Reply #10 on: 17 Feb 2009, 15:58:24 »
Ahh, the sweet pain of knowledge. Thanks for hitting me with a clue stick, h-! :D


Some new(?) insights:
- All sides are friends by default. It takes setFriend (or politicians) to make them hate each other.
- selectPlayer does not change the name of the unit. So you won't see your nick when using the *chat commands but the original name of the unit (e.g. "Matthew Wright").
- It looks like there's no need to use createCenter for any side.
- You won't be able to use your gun without a finishMissionInit in your mission.sqf. [1]
- initAmbientLife creates all those insects and seagulls.
- runInitScript does exactly what one would expect (note: init.sqf is run before init.sqs).
- There's no need to have a mission.sqm, having a mission.sqf is enough. In fact, the mission.sqm won't be touched if a mission.sqf exists.


[1] This changes once you've entered and left a vehicle or dropped and picked up you gun.
try { return true; } finally { return false; }

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: mission.sqf
« Reply #11 on: 19 Feb 2009, 20:05:51 »

- There's no need to have a mission.sqm, having a mission.sqf is enough. In fact, the mission.sqm won't be touched if a mission.sqf exists.

Waitwait, what?  :o What does this mean, exactly? That all the data the mission.sqm contains can ALSO be put into the mission.sqf, or does it just mean that if you have a mission.sqf the data in the .sqm won't be loaded at all? (e.g. to even be able to play a mission with a mission.sqf you'd have to createUnit a unit and then selectPlayer that unit to "spawn")? I am a little confused.

But anyway, if what you say is correct, then all kinds of 3D editors and the like could benefit quite a bit from that piece of knowledge (e.g., automatic updating of mission.sqf with each item you place and such).

Do elaborate!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mission.sqf
« Reply #12 on: 19 Feb 2009, 21:56:02 »
Voila!

Edit: the old pbo still contained a sqm file.
« Last Edit: 19 Feb 2009, 22:25:58 by Worldeater »
try { return true; } finally { return false; }

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: mission.sqf
« Reply #13 on: 20 Feb 2009, 01:55:10 »
Holy crap!  :D

Only "problem" is of course that without a mission.sqm, the mission won't open in the editor. However, this -could- be used by e.g. 3D editors to create whole missions which could then be put into a pbo and played that way, or somesuch. Of course, pure scripting does not quite have ALL the options the editor does...(for instance there's no way of unsynchronizing a unit/waypoint/etc. after once having done it with scripts >_<). But anyway, an interesting discovery this, although I ultimately can't find -that- much use for it :) It is awesomely cool though!

 :good:

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline schuler

  • Contributing Member
  • **
Re: mission.sqf
« Reply #14 on: 20 Feb 2009, 02:23:02 »
maybe it was used for testing in the beginning or of no real use at all!?!?!?!?
« Last Edit: 20 Feb 2009, 02:27:40 by schuler »
Semper Fi

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: mission.sqf
« Reply #15 on: 22 Feb 2009, 19:28:57 »
seems to be part of the VBS 3d editor i guess.
probably was left over code from pre arma or forgot to remove in a patch.

arma configs also contain the basic 3d editor interface

Offline Rommel92

  • Members
  • *
Re: mission.sqf
« Reply #16 on: 23 Feb 2009, 00:45:03 »
- You won't be able to use your gun without a finishMissionInit in your mission.sqf. [1]

Or if you push "F".  :P

- initAmbientLife creates all those insects and seagulls.

I can still hear the ambient noise however?

It'd be nice if BIS gave examples of all the capabilities of this game, and what exactly is run on Mission.sqm.

My findings:

Code: (MP) [Select]
setPlayable eunit1;
setPlayable eunit2;

setPlayable wunit1;

Allowed the player to use the units, otherwise he would have a blank screen.

Code: [Select]
activateAddons ["CaCharacters"]
Was needed to stop the error appearing.
« Last Edit: 23 Feb 2009, 01:20:01 by Rommel92 »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: mission.sqf
« Reply #17 on: 23 Feb 2009, 02:35:57 »
I can still hear the ambient noise however?
Yes, the background noise seems to be always there. The initAmbientLife command probably reads the configFile >> "CfgWorlds" >> worldName >> "Ambient" section.

Was needed to stop the error appearing.
Uhm, the error? Could you provide some more details? The mission runs flawless here, even if started directly (C:\...\arma.exe -init=playMission["","true_sqmless.intro"]).
try { return true; } finally { return false; }

Offline Rommel92

  • Members
  • *
Re: mission.sqf
« Reply #18 on: 23 Feb 2009, 02:45:17 »
Was needed to stop the error appearing.
Uhm, the error? Could you provide some more details? The mission runs flawless here, even if started directly (C:\...\arma.exe -init=playMission["","true_sqmless.intro"]).

It did appear in singleplayer, however when attempted multiplayer it would fail when loading the addons required. Hence I needed to activate them via the code above.

 ;)

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: mission.sqf
« Reply #19 on: 23 Feb 2009, 21:39:44 »
Here is my knowledge about activateAddons:
http://dev-heaven.net/boards/8/topics/show/73#message-74

Here is some code from my vehicle DM.
At least to my tests this stuff works:

Code: [Select]
...

// Preload/Initialize the ambient life.
initAmbientLife;

// Disable environmental effects (ambient life + sound).
enableEnvironment false;

// Finish world initialization before mission is launched.
finishMissionInit;

// Global variable to signal that all briefing processing has been completed.
ACEIP_InitDone = true;

_marker = createMarker ["ACEIP_InitDone",[0,100]];
_marker setMarkerShape "ICON";
_marker setMarkerType "DOT";
_marker setMarkerColor "ColorGreen";
_marker setMarkerText "Initialization done.";

// mission briefing initialization ends here
sleep 1;

// wait until variable is synced
waitUntil{!(isNil "ACE_ISLAND_STARTPOS")};

...

if (isServer) then
{
ACEIP_Flag = createVehicle ["FlagCarrierNorth",ACE_ISLAND_STARTPOS,[],0,"FLY"];
call ACEIP_VehicleSetSelection;

// sync variables with clients
publicVariable "ACEIP_ActivateAddons";
publicVariable "ACEIP_GroundTypes";
publicVariable "ACEIP_AirTypes";
publicVariable "ACEIP_Flag";
};

// wait until variable is synced
waitUntil{!(isNil "ACEIP_Flag")};

// preload active cfgPatches
activateAddons ACEIP_ActivateAddons;

// preload active models
if !(isNull player) then
{
//{ _foo = _x createVehicleLocal[-100000,-100000,0]; if (!isNull _foo) then { deleteVehicle _foo; }; } forEach ACEIP_GroundTypes;
//{ _foo = _x createVehicleLocal[-100000,-100000,0]; if (!isNull _foo) then { deleteVehicle _foo; }; } forEach ACEIP_AirTypes;
{ waitUntil {50 preloadObject "_x"}} forEach ACEIP_GroundTypes;
{ waitUntil {50 preloadObject "_x"}} forEach ACEIP_AirTypes;
};

// wait for preloading to finish
titlecut ["Building mission, please wait","PLAIN"];
sleep 5;

...