Forum Jump :

Author Message


Posts: 78
Rank:


Country: us
Location: California
Occupation:
Age:
In-game name: TAW_Lucky

 
#1 Posted at 2009-08-08 23:53        
     
I'm confused. All I want to do is have a trigger set a variable so I can use it as a flag for victory conditions (that is, to determine if the missions objectives have been completed). Meanwhile, another trigger will be checking for a few variables (like objective1, objective2, etc.) to all reach 1 or true, meaning the objectives are all complete. Then it should end the mission.
Thanks in advance for reading this.

I'm stumbling around with simple code like "objective1 = true" or "objective1 = 1" and not getting them to work. And I've tried "object setVariable [objective1, 1] and such too. I guess setVariable is more complicated than I need, but I'm not sure.

(In case you want more detail on what I'm trying to do, here's a super simple example:

Objective 1 is for BlueFor to reach a certain spot on the map.
Objective 2 is for BlueFor to kill an OpFor called "badguy1".
When both objectives are complete, a titleText message can tell players 'good work, you're done' and then 5 seconds later the mission ends.

I know this is really basic, but I'm having problems getting the variables set and so on. I've looked all over for an example like this and can't find one.

Any suggestions?


Author Message


Posts: 1527
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2009-08-09 01:42        
     
This is how I do things it may or may not help.

I usually set my variables in an init box first either game logic or unit, set them false or true to give them a default.

testvar=false

in a triggers condition box place the testvar and set some text up so you know when it works.


create a second trigger set it 9,9,9 for the delay and type true in the condition box. In the on act box type testvar=true.

Nothing will happen until the second trigger reaches 9 seconds and it will set the testvar to true which will set off the second trigger.

You can have combinations of condition !(testvar) would check for a false variable and this and testvar would check the anyone present part of the trigger and the testvar would have to be true.


this a trigger I used yesterday and in may work for you


Place a trigger at the destination point and set it to anyone present,repeating and then in the condition box put

this && (player in thisList and !(alive badguy1))

it will activate it the player reaches this point and the badguy1 is dead.

This post was edited by F2kSel (2009-08-09 10:43, ago)


Advertisement


Author Message


Posts: 78
Rank:


Country: us
Location: California
Occupation:
Age:
In-game name: TAW_Lucky

 
#3 Posted at 2009-08-09 05:52        
     
Thanks so much for the info, F2kSel.

I completely get the first part, about the testvar and the two triggers, and I get the ! as a negator.

The sample code you put in uses syntax that confuses me, though.

1) What does "&&" mean there? How does it relate to the "or" in the parentheses?

2) is "player in thisList" short for a variable? and if so, how would I get a list of player names? An array? Not sure how to set that up.


My big question is still how to have a trigger check for two (or more) variables being set to certain values. I tried something like this, but it doesn't seem to work:

I've got a variable called f1 and a unit named badguy1. I want a trigger to fire when f1=true and badguy1 is dead...when both are true. I have a trigger with this in the condition: "f1 = true AND !alive badguy1"

And really, I know how to do the badguy1 part. But the other variable is the problem. I have got a trigger setting f1 to true, but then the condition/check is not working at all, it seems. Do I need to use a "check" command somehow?

EDIT: I solved the problem. I changed two things from the above line (by that I mean the "f1 = true" part) in the condition box of the trigger: first I now used == instead of just =, which, I'd forgotten, is universal for "is it equal to?", while just = means "set equal to". Second, I put the word true into quotes, like this: "true" and I did that BOTH in the condition box of the one trigger and the activation box of the one that sets it equal to true. Then it works fine.

This post was edited by Lucky44 (2009-08-09 15:09, ago)


Author Message


Posts: 1527
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2009-08-09 10:42        
     
1. "&&" is the same as "and" so "This and" whatever checks the condition settings of the trigger above, present, not present, ect. Without using "This" the condition only checks the arguments in the condition. The only exception to this is the timer boxes. I think in your case you need a couple of triggers one as above and the other the same but replace "or" with "and". so that you can end if you reach the point and badguy is dead and fail if still alive. I forgot to change it to "and" myself and have updated the line. It was late.

2. player is a you, if you name your unit bill for example you can check for either bill or player as it would be the same.
Thislist looks in the trigger area and creates a list of all units. so player in thislist simply checks to see if player is within the trigger.

to create an array of objects within this list it's varname = thislist and to retrieve that variable later you would need something like newvarname = (varname select 0); for the first variable in the list.


Author Message


Posts: 78
Rank:


Country: us
Location: California
Occupation:
Age:
In-game name: TAW_Lucky

 
#5 Posted at 2009-08-09 15:08        
     
OK, that's clearer now. Thanks for taking the time to reply!