Home   Help Search Login Register  

Author Topic: Ending with a script  (Read 799 times)

0 Members and 1 Guest are viewing this topic.

Corben Dallas

  • Guest
Ending with a script
« on: 16 Jun 2005, 17:07:03 »
Getting the hang of things a bit more now, and I've just set up a script to fire off different endings (or continue if mission not complete).

Question is, how do I use one trigger around a rescue team to fire when I walk into it, but not have them fire it?  If I set the trigger to WEST it fires right away, but there doesn't seem to be any option for just the player.

Is there a simple test for when the player has walked into it, but expluding other West units?

Edit:

Hmmm... Also, how do I set the player's score?  Can't find a command except Score and SetScore for multi-player.  I want to enable Objectives and set the score in the various end script sections, depending on what the player did.

Thanks in advance for help.   8)
« Last Edit: 16 Jun 2005, 17:20:13 by Corben Dallas »

Offline 456820

  • Contributing Member
  • **
Re:Ending with a script
« Reply #1 on: 16 Jun 2005, 17:22:22 »
emmmm im not to sure about the score but if you know about how to get objectives to tich i think score is set around that but put this in the description.ext file if you havent got one make one there so usefull

Code: [Select]
minScore = 2500
avgScore = 7000
maxScore = 12000

set scores there obdviosly you dont have to use that but that was in one of my missions anyway about the trigger press f2 key wich should be group then click on the trigger and group the trigger with the player if done correctly a faint blue line shall conect the player to the trigger.
also another way to check press f3 for the trigger double click the trigger and it should say something like vechile present thats okay for the player it works in the same way also there are more new ways on the trigger now have alook

hope this helps

qqqqqq

  • Guest
Re:Ending with a script
« Reply #2 on: 16 Jun 2005, 17:27:09 »
addrating

When you group the trigger to the player you get new options.

Corben Dallas

  • Guest
Re:Ending with a script
« Reply #3 on: 16 Jun 2005, 17:35:04 »
Great guys - cheers for that!
« Last Edit: 16 Jun 2005, 17:56:17 by Corben Dallas »

Corben Dallas

  • Guest
Re:Ending with a script
« Reply #4 on: 16 Jun 2005, 17:56:28 »
Still got problems, but with my script.  It's like this:

? alive Enemy1 && not alive Enemy2 : goto "end1"

? not alive Enemy1 && not alive Enemy2 : goto "end2"

hint "You haven't completed your mission Captain."
exit

  #end1
  "1" objStatus "FAILED"
  "2" objStatus "FAILED"
  End#1
  exit

  #end2
  "1" objStatus "DONE"
  "2" objStatus "DONE"
  addRating 4000
  End#2
  exit

This ought to work..?  (Well, obviously not or I wouldn't be asking).

Offline 456820

  • Contributing Member
  • **
Re:Ending with a script
« Reply #5 on: 16 Jun 2005, 17:59:55 »
well whats wrong with it any error messages what doesnt work about it ??

Code: [Select]
? alive Enemy1 or not (alive Enemy2) : goto "end1"

? not alive Enemy1 or not (alive Enemy2) : goto "end2"

hint "You haven't completed your mission Captain."
exit

  #end1
  "1" objStatus "FAILED"
  "2" objStatus "FAILED"
  End#1
  exit

  #end2
  "1" objStatus "DONE"
  "2" objStatus "DONE"
  addRating 4000
  End#2
  exit

that might be it i thought && was right but its better to use or

Corben Dallas

  • Guest
Re:Ending with a script
« Reply #6 on: 16 Jun 2005, 18:04:14 »
The code should be ok as far as I can tell, but it just doesn't work.  It drops through to the hint, even if I've killed one of the enemies checked for.

I tried using curly brackets too, like this:

  ? alive Enemy2 && not alive Enemy2 {
    "1" objStatus "FAILED"
    "2" objStatus "FAILED"
    End#1
  }

but it doesn't work.  I also tried brackets on the checks like this:

  ?( alive Enemy2) && (not alive Enemy2) : goto "end1"

No go though.

Edit:

I could kick myself - I'd renamed one of the enemy players and forgot!  The test now works, but this give an error:

  End#1

Anyone know how to force a specific ending?
« Last Edit: 16 Jun 2005, 18:09:34 by Corben Dallas »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Ending with a script
« Reply #7 on: 16 Jun 2005, 18:07:33 »
what's the end#1 for?

Offline 456820

  • Contributing Member
  • **
Re:Ending with a script
« Reply #8 on: 16 Jun 2005, 18:07:57 »
like i said above use 'or' instead of '&&'
like this

Code: [Select]
? (alive Enemy2) or not (alive Enemy2)
"1" objStatus "FAILED"
"2" objStatus "FAILED"
End#1

thats should do it but about end#1 that wont end the game or will it ? unless you mean inside a triggers condition field if so you dont need the '?' the condition field is a big ?
try that it might work if not im not sure

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Ending with a script
« Reply #9 on: 16 Jun 2005, 18:10:56 »
'or' is not what he needs if the logic is supposed to be 'and'...

i think 456820 is onto something with the ending triggers though. if you replace 'end#1' with a variable declaration, for example

Code: [Select]
end_1 = true
and in your ending trigger condition field check for end_1, that will activate the end trigger. tricky to explain ;)
« Last Edit: 16 Jun 2005, 18:12:17 by bedges »

Offline 456820

  • Contributing Member
  • **
Re:Ending with a script
« Reply #10 on: 16 Jun 2005, 18:12:22 »
Quote
'or' is not what he needs if the logic is supposed to be 'and'...
oh yeah sorry ive been using 'or' too much in my script sorry

Corben Dallas

  • Guest
Re:Ending with a script
« Reply #11 on: 16 Jun 2005, 18:13:33 »
The test code now works fine, and I do need && (AND) not OR.

Anyway, I thought End#1 might force it to do just that - end the game using the first ending in my briefing.   Then End#2 to force the second ending, etc.

I want to use one trigger to call the ending script, and then see what the player accomplished and do the right ending, rather than have a bunch of overlapping triggers in the editor to make the game end.

Edit:

Yeah, well I'm feeling more like:

if (noob >= even_has_a_clue) : goto well_done_matey
hint "Haven't hundreds of hours in the manuals got you there yet..?"

 ;D
« Last Edit: 16 Jun 2005, 18:19:56 by Corben Dallas »

Corben Dallas

  • Guest
Re:Ending with a script
« Reply #12 on: 16 Jun 2005, 18:18:09 »
Quote
and in your ending trigger condition field check for end_1, that will activate the end trigger

But that will only fire the trigger itself?  Or do you mean have other triggers sitting there waiting to end in different ways, and this idea then fires one of them after my script has run..?

If that's what you mean, I guess it might work, and I only have to link one trigger to the player which will fire the others.  Hmmm...

Edit:

Yay!  That works fine.  Only one trigger to link to the player now, and the endings fire depending upon the variable:

  the_ending = 1

or

  the_ending = 2

etc.

Do you know, I've got 10 days off work, and I've spent SIX of them glued to my PC and OFP?  Gawd; insane.  Having fun though!

 :D
« Last Edit: 16 Jun 2005, 18:24:34 by Corben Dallas »