Home   Help Search Login Register  

Author Topic: accessing variables from intro  (Read 1124 times)

0 Members and 1 Guest are viewing this topic.

funkster

  • Guest
accessing variables from intro
« on: 01 Sep 2005, 04:23:06 »
Hi  all, OFP is back, YAY!!

I am working on a nice lil mission, and I have a few questions:

1) Is it possible to access variables declared in the intro in the actual mission itself, things pan out slightly differently in the intro each time, so I want the mission to start following on correctly, at the very end og the intro I have this:

Code: [Select]

Adam1 = getDamage WAone
Adam2 = getDamage WAtwo

Apos1 = getPos WAone
Apos2 = getPos WAtwo

These are tanks, sometimes they are killed, sometimes not so I want the same to occur in the mission. I  then set there damage and position at the start of the mission like so:

Code: [Select]

_apos1 = Apos1
WAone setPos [5000,0,00]
WAone setDamage Adam1
~ 0.5
WAone setPos _apos1

And the same for the second one. (obviously this script destroys them far away and brings them back a milisecond later) - they should be in exactly the same damage state and position as at the end of the intro.

Anyway, it doesnot work, clearly it seems to me that whatever variables are declared in the intro are lost at the end of it. Is there a way I can have them continue through to the mission?

2) Why does this not work? (I dont quite get the CreateUnit command):

Code: [Select]
'EStwo' createUnit [getMarkerPos 'marker1']
EStwo setDamage 0.99

There is an error displayed, something along the lines of it contains an invalid number or something, and OFP freezes up, boo hoo.

3) Im sure I had one more question, Ill post when I remember.

Thanks heaps in advance.....


Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:accessing variables from intro
« Reply #1 on: 01 Sep 2005, 04:52:27 »
1.) It would be possible with an external program (java or c++). I don't know if this is possible using the game engine (someone else might)

2.) CreateUnit takes more arguements than that.

3.) :)

funkster

  • Guest
Re:accessing variables from intro
« Reply #2 on: 01 Sep 2005, 04:59:19 »
Ok, thanks. So its not possible within the game huh? bummer.

As for 2)
This is not actually the problem,
I tried instead of creating the unit, starting it somewhere else on the map, and then using (setPos) command, still I get the same error, and OFP freezes!

ATM, the code looks like so:

Code: [Select]
EMtwo setPos getMarkerPos 'markerOne'
EMtwo setDamage 0.99
EMtwo setBehaviour "COMBAT"
EMtwo setCombatMode "BLUE"

But I get an 'invalid number in expression' error when it execs the setPos command.

I am stumped..!

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:accessing variables from intro
« Reply #3 on: 01 Sep 2005, 05:02:09 »
try double quotes around the marker name insted of single ones

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:accessing variables from intro
« Reply #4 on: 01 Sep 2005, 08:11:38 »
have a look at savevar.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re:accessing variables from intro
« Reply #5 on: 01 Sep 2005, 09:26:04 »
And since I suspect you want to transfer damage and weapon load out from the intro to the mission... why not have a look at saveStatus/loadStatus as well. The engine can handle your problem.
« Last Edit: 01 Sep 2005, 09:27:27 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:accessing variables from intro
« Reply #6 on: 01 Sep 2005, 10:39:23 »
Nothing is transferred from the Intro to the Mission except by way of these commands.   However, they were designed to be used in campaigns for transferring stuff from Mission to Mission.   When used between Intro/Outro/Mission they can be extremely buggy.    Stand by for lots of frustration and weird results.  

You cannot test things in the editor.   (Sometimes it kinda works but sometimes it doesn't)   You have to play the mission from the Single Missions menu.
Plenty of reviewed ArmA missions for you to play

funkster

  • Guest
Re:accessing variables from intro
« Reply #7 on: 01 Sep 2005, 10:39:48 »
Wow, great, all that stuff is not in the Comref I have, maybe Ill use the online version from now on!
SO, it looks like saveStatus is the better option than savevar right? By the looks of it saveStatus saves damage as well as loadout etc right?

Thanks guys...

----------------------------------------------------------------------------------------

EDIT: Only just noticed your comments Macguba. Oh well, better than nothing, but it sure is going to be annoying having to export>restart OFP everytime i want to test.... :(
« Last Edit: 01 Sep 2005, 10:41:34 by funkster »

funkster

  • Guest
Re:accessing variables from intro
« Reply #8 on: 03 Sep 2005, 05:43:40 »
Hi again,
I remebered my #3 question...:

I have a music track that is called in the intro, its around 4mb, and when it get called for the first time each session, there is around 0.3 secs lag while it loads, which has the potential to put events out of synch (based on time from start).

So, I had an idea, i will play the track at the start of the mission, but at a volume level of around 0.001, so you cant hear it, but it will b loaded into RAM, then when i need it again, I will just the track again at normal volume.

The comref has no setMusicVolume command, but in  reference to Musicvolume it says :

" Check current music volume (set by setmusicvolume) "

Which  assume means there is a setmusicvolume command. So I have tried setmusicvolume 0.01 and it does not work - any ideas what i should actually be writing???

Thanks.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:accessing variables from intro
« Reply #9 on: 03 Sep 2005, 05:48:35 »
I think the command you need is fadeMusic:
http://www.ofpec.com/editors/comref.php?letter=F#fadeMusic

To make it play in the intro you could start out with a black screen start the music, then 0.3 seconds later make the intro visible.  Just a thought.

4Megs!  That must be a long one.  You could perhaps use a lower quality ogg compression - music tends to have more tollerance to this that voices.

funkster

  • Guest
Re:accessing variables from intro
« Reply #10 on: 03 Sep 2005, 06:39:16 »
thanks Thobbo,

but fade music wont do unless i could perhaps set fademusic to happen over, say, o.oo1 seconds, so that the player never hears it. See, i wont the song to be "playing" (at an inaudible volume) at the start of the scene, only so its loaded into memory. However, to the player, I dont want it to be heard until around 15seconds into the scene. (is there no set music volume command??)

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:accessing variables from intro
« Reply #11 on: 03 Sep 2005, 09:36:23 »
if you use the fademusic command to make the volume 0, then play the music, it will be playing even though can't hear it. then 15 seconds into the intro you can fade the music back up. of course it will be 15 seconds into the music, but if you add that much silence to the beginning of the music file, it will start on cue.

to fade the sound to 0 instantly, use

Code: [Select]
0 fadesound 0
« Last Edit: 03 Sep 2005, 09:37:05 by bedges »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:accessing variables from intro
« Reply #12 on: 03 Sep 2005, 09:43:05 »
and to fade music instantly use:

0 fadeMusic 0


So you seem to need something like:

0 fadeMusic 0
playMusic "whatever"
~15
5 fadeMusic 0.5

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:accessing variables from intro
« Reply #13 on: 03 Sep 2005, 09:47:34 »
erm aye... i meant fademusic...  :-[

*bedges fetches more coffee*

funkster

  • Guest
Re:accessing variables from intro
« Reply #14 on: 04 Sep 2005, 06:49:41 »
o, ok thanks, ill do that.

Then when I want the song to play, i can use the playMusic command, and the song will start again ? Yes/no?

Im going to try this now...