Forum Archive. A read-only snapshot of the Warfare Incorporated forums (2003–2020), preserved for historical purposes.  ·  warfareincorporated.com
Warfare Incorporated Forum

Persistent Variables - When do they go away?
Author Message
Verdagon
Veteran Member
Joined: 05 Oct 2003
Posts: 1047
Location: San Luis Obispo, CA
 Post Posted: Fri Jun 11, 2004 7:43 pm  Post subject: Persistent Variables - When do they go away?

If you create a persistent variable, how long will it last? Is it deleted at the end of the current campaign/mission, or maybe on soft reset, or never?

The reason I want to know is that I want to be able to tell if someone has beaten my other levels, to unlock a final one. That could be accomplished if the persistent variables never disappeared, or something like that...
UGMC
Mega-Poster
Joined: 03 Jun 2004
Posts: 348
Location: my own little world
 Post Posted: Sat Jun 12, 2004 4:14 am  

Hmmm... that would be cool. Unlocking missions... I like it. Well, I don't know if it can be done, though. I even even considered for myself "multiple paths" for a campaign, where if you lose one, you can still advance, but to a different mission that planned without any promotions.
Verdagon
Veteran Member
Joined: 05 Oct 2003
Posts: 1047
Location: San Luis Obispo, CA
 Post Posted: Sat Jun 12, 2004 10:52 am  

Multiple paths campaign are really cool. My VC2 campaign has that, where you crash land and either walk to the left or right, which determines the next mission.

*crosses fingers, hoping that unlicking missions is possible*
UGMC
Mega-Poster
Joined: 03 Jun 2004
Posts: 348
Location: my own little world
 Post Posted: Mon Jun 14, 2004 3:44 pm  

I just had a thought... there has to be some kind of variable like this in the main story missions from the original Warfare Incorporated people with the promotions that last througout the whole game. Try asking about this.
crakerz
Mega-Poster


Joined: 17 Sep 2003
Posts: 353
Location: California Bay Area
 Post Posted: Mon Jun 14, 2004 6:06 pm  

Check out this thread:

http://www.handmark.com/warfare/forum/viewtopic.php?t=918

Basically, pvars can be saved, and they persist (hence the name) as long as the game or level is running. For example, if you exit the game from within a level, the pvars are preserved when you return to it. If you exit a level and start another, the pvars are not automatically reset. If you save a level, the pvars are saved with it.
dws90
Very Active User


Joined: 03 Mar 2004
Posts: 118
 Post Posted: Tue Jun 15, 2004 8:33 pm  

*crosses fingers, hoping that unlicking missions is possible*

Hehe, funny typo.
UGMC
Mega-Poster
Joined: 03 Jun 2004
Posts: 348
Location: my own little world
 Post Posted: Thu Jun 17, 2004 4:19 am  

So you can have a persistant variable triggers even a few levels after it is set? Like say you leave a level with 5,6000 galaxite. If you have the triggers set up right, can you enter it with that much too?
Verdagon
Veteran Member
Joined: 05 Oct 2003
Posts: 1047
Location: San Luis Obispo, CA
 Post Posted: Thu Jun 17, 2004 1:01 pm  

dws90 wrote:
*crosses fingers, hoping that unlicking missions is possible*

Hehe, funny typo.


Hehe, whoops.

UGMC, yes that is possible. it'd take a few triggers though.

Condition: Side1 has at least 20000 galaxite
Action: Subtract 20000 galaxite from Side1
Action: Add 20000 to pvar1
Action: Preserve trigger

Condition: Side1 has at least 5000 galaxite
Action: Subtract 5000 galaxite from Side1
Action: Add 5000 to pvar1
Action: Preserve trigger

Condition: Side1 has at least 1000 galaxite
Action: Subtract 1000 galaxite from side1
Action: Add 1000 to pvar1
Action: Preserve trigger

Condition: Side1 has at least 200 galaxite
Action: Subtract 200 galaxite from side1
Action: Add 200 to pvar1
Action: Preserve trigger

Condition: Side1 has at least 50 galaxite
Action: Subtract 50 galaxite from side1
Action: Add 50 to pvar1
Action: Preserve trigger

And so on... hey I should try this in one of my missions.
UGMC
Mega-Poster
Joined: 03 Jun 2004
Posts: 348
Location: my own little world
 Post Posted: Thu Jun 17, 2004 3:06 pm  

Durrr... still confused. Why are there subtract galaxite actions in there? And, are any of those triggers to make the person get the galaxite at the start of the next level? And, when you add numbers to a persistant variable, how does that convert to galaxite later?
Verdagon
Veteran Member
Joined: 05 Oct 2003
Posts: 1047
Location: San Luis Obispo, CA
 Post Posted: Thu Jun 17, 2004 9:24 pm  

Whoops, forgot to add the second section.

Just do the same thing in the next level, but subtract from the pvar and add the galaxite. Example:

Condition: pvar1 is at least 20000
Action: subtract 20000 from pvar1
Action: Add 20000 credits for Side1
Action: Preserve trigger


Condition: pvar1 is at least 5000
Action: subtract 5000 from pvar1
Action: Add 5000 credits for Side1
Action: Preserve trigger


...and so on.

PS. In the first section, the subtract galaxite things are in there because if they weren't, the pvar would keep adding. When does it know to stop? Let's say side1 has 26000 credits. The first trigger...
Condition: Side1 has at least 20000 galaxite
Action: Subtract 20000 galaxite from Side1
Action: Add 20000 to pvar1
Action: Preserve trigger
...would keep adding 20000 to pvar1 and never stop. If it is subtracted from the player's credits, however, they'll have less galaxite and the trigger won't fire again. It's kind of hard to explain.
ajcross
Very Active User


Joined: 23 Dec 2003
Posts: 113
Location: Kansas City
 Post Posted: Thu Jun 17, 2004 10:30 pm  

Verdagon wrote:
Condition: pvar1 is at least 20000
Action: subtract 20000 from pvar1
Action: Add 20000 credits for Side1
Action: Preserve trigger


You will want another condition if you want to use this for multiple missions.

Say this after a Mission Loaded trigger sets it:
Condition: Persistent variable 'missionstate' is 1

Set it again to enable the post game processing to subtract the credits:
Condition: Persistent variable 'missionstate' is 2

Then set it yet again to do the actual End Mission action.