Jump to content
Sign in to follow this  
void_false

How to transfer variable

Recommended Posts

Before you put all gestapo, kgb, 007 and whatever on my tail, i made a search for this blues.gif

I have squad in a mission(named mygroup). at the end of a mission i save how many people survived:

troops = count units mygroop. then i try to use this var in outro, but it looses it's value somewhere on the road form mission itself to outro. What am i doing wrong?

thx in advance  smile_o.gif

Share this post


Link to post
Share on other sites

Geez, I'm not sure if there is a way to retain such a value. As far as I know the outro basically starts a new mission context. You can not export variables to HDD from OFP, so hmm.

Share this post


Link to post
Share on other sites

i use script to save variable. But anyway i understood your point.

Is there any other way that i can transfer value from mission to outro?

Share this post


Link to post
Share on other sites

There was a script, actually two, I vaguely remember. I think it had something to do with the drop command. Anyway, I believe that it saved the value from one of them, and brought it into the other script, so maybe it is possible? I'll search around my HD and see if I can turn it up.

Share this post


Link to post
Share on other sites

Here it is, an old napalm script.  It uses names defined in the .sqs and carries over to other scripts.  It's been a while since I did some scripting...

Perhaps doing something like:

Whatever your script does to get the living amount, and saving the variable to something like:

_unitsalive = _variableornumberofaliveunits

then

[_unitsalive] exec "...filepath/outtroscriptname.sqs"

And in the outtro's script

_unitsalive = _this select 1

Then would it carry over?

(Sorry if this is a bad/non-working idea, it's been a while since I've really done some scripting, just an idea from what I can remember)

Share this post


Link to post
Share on other sites

Check this post discussing the SaveVar command. This sounds like it might be usable for what you are attempting to do.

Share this post


Link to post
Share on other sites
Quote[/b] ]Is there any other way that i can transfer value from mission to outro?

No, I only asked. English is not my native language. but as far as i remember u put IS in the beggining of a question.  smile_o.gif

Harnu,I didnt get 2 things:

1) [_unitsalive] exec "...filepath/outtroscriptname.sqs" - what  ...filepath/ is ?

2) when should i exec this? in the mission? so u mean i transfer value from mission into outro script, and then when outro starts i recieve that value?

hm... I'm not sure if i get it, but gonna try. THX  smile_o.gif

noundo, i was thinking about this command and even tried it - no success. It will work in campaign but not in single mission.  sad_o.gif THX anyway.

Share this post


Link to post
Share on other sites

Nope didnt work.

I have an idea though.

Why use the outro part? You can just make an outro mid-mission and save the variable.. Unless you have preset things I guess.

Share this post


Link to post
Share on other sites
Quote[/b] ]Is there any other way that i can transfer value from mission to outro?

No, I only asked. English is not my native language. but as far as i remember u put IS in the beggining of a question.  smile_o.gif

Harnu,I didnt get 2 things:

1) [_unitsalive] exec "...filepath/outtroscriptname.sqs" - what  ...filepath/ is ?

2) when should i exec this? in the mission? so u mean i transfer value from mission into outro script, and then when outro starts i recieve that value?

hm... I'm not sure if i get it, but gonna try. THX  smile_o.gif

noundo, i was thinking about this command and even tried it - no success. It will work in campaign but not in single mission.  sad_o.gif THX anyway.

the filepath thing is like C:/.../operation flashpoint/users/missions/mission's folder name/outtro's script.sqs

I've seen this used a couple of times, so I'm not sure if I've got it right myself.

The script should exec at the end of the mission as you read how many are alive, and then that would activate the next script during the outtro I think.

Share this post


Link to post
Share on other sites

did you declare your variables in the init.sqs?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...

troops = 0

...

maybe this helps to share global variables between intro/mission/outro.

Share this post


Link to post
Share on other sites

MrZig, that is the first thing i was thinking about. Here pops up another problem. I have mission during evening and outro during morning. It wont be nice to have 10 hours mission time in debriefing screen.

Anyway, thank you evrybody here. I will use MrZig's solution.  smile_o.gif

(damn, i should post something about it in OFP2 sugestions topic)

Share this post


Link to post
Share on other sites
I have mission during evening and outro during morning. It wont be nice to have 10 hours mission time in debriefing screen.

You can save mission time before in-mission-outro and after that, right before debriefing, switch time back to saved value.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×