Home   Help Search Login Register  

Author Topic: Trigger trouble  (Read 2024 times)

0 Members and 2 Guests are viewing this topic.

SET-Lövet

  • Guest
Trigger trouble
« on: 17 Sep 2004, 22:50:03 »
Im doin a mission where you start in your base and have to go kill a enemy outpost and the come back to the base and activate the end trigger. But i want it to be like you have to complete Objektive 1 and the be able to return to base and win. and i dont want the end trigger in the base to be activated in the start ( you begin there). help will be appreciated

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger trouble
« Reply #1 on: 17 Sep 2004, 23:43:29 »
If I understand correctly you need to do something like: set
OutpostDead = true  when the outpost is dead

and you need a trigger at the base that detects your presence AND OutpostDead

You should also set OutpostDead = false at the start of the mission.  This is not necessary but it is tidy
 
« Last Edit: 18 Sep 2004, 09:09:45 by THobson »

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Trigger trouble
« Reply #2 on: 18 Sep 2004, 02:15:29 »
actually, varibles automatically begin as false in the begining of the mission, you have to initialize them true if they need to be.

on 2 the question. if you have multiple objectives in your mission, then i have found it is easier to use an objComp varible. Then, say u hav 3 objectives, all u hav to do is put in the end trigger:
Code: [Select]
objComp == 3 and add 1 for each obj completed, instead of
Code: [Select]
obj1 == true && obj2 == true && obj3 == true
P.S. and oh, the varibles, once initialized have the value zero, so u dont hav 2 declare them
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger trouble
« Reply #3 on: 18 Sep 2004, 02:50:28 »
Actually that is not correct.  Variables are undefined until you give them a value.

To prove this, try creating a trigger that activates on:
A and not B

If you set A = true and leave B undefined it will not trigger.

It is good practice anyway to intialise all your variables.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger trouble
« Reply #4 on: 18 Sep 2004, 03:14:18 »
THobson is right.   From the comref (my emphasis):-

When any uninitialized variable is detected in any expression, the whole expression results nil (undefined value). When undefined value is encountered in field where boolean value is expected, it is converted to false.
Plenty of reviewed ArmA missions for you to play

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Trigger trouble
« Reply #5 on: 19 Sep 2004, 23:59:16 »
well, it works toward the same point. Your varible will not activate if u havn't defined it. I find that it wastes time and memory when declaring varibles that don't need to be declared, but its probably good editing form to do so...
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger trouble
« Reply #6 on: 20 Sep 2004, 08:05:36 »
The problem comes when you have a trigger somewhere in the game that doesn't fire and you tear your hair out wondering why.  Then you see you have a !B in the condition field and realise that B has not been initialised.

You are worried about the time taken to in initialise variables and the memory used?  With modern processors the time taken for the first will be micro seconds and as far as memory is concerned, well again with modern computers this is not an issue.  Anyway if you are going to use a variable it will use up some memory eventually, but we are talking about individual bytes here.

With modern computers the most expensive item is programmer time that is why so much effort is spent on program structure and design.  I keep init.sqs open and spend a few seconds initialising each variable I use as I develop the mission, as a result I have saved myself hours of debugging time.  Good programming practice pays for itself.  
« Last Edit: 20 Sep 2004, 08:08:51 by THobson »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Trigger trouble
« Reply #7 on: 20 Sep 2004, 09:34:46 »
* Sui hands THobson a 'good little programmer' award ;D

All joking aside, THobson's absolutely right.

It's not just good practice to initialize every variable you use (preferably in the same part of your init.sqs), it can save you AGES in debugging time.

I find it helps to keep a written list (or two) of exactly what each variable does. This way, if I have to shelve the mission for a month (or six :P) I can pick up the list and get my head around what I was trying to accomplish much faster and easier than bungling my way through it.

I have had many annoying and time consuming experiences with variables I didn't define... I'd definitely recommend being very anal when it comes to variable definition time ;)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger trouble
« Reply #8 on: 20 Sep 2004, 11:22:58 »
Writing as somebody who doesn't keep a list of what variables do (although I do - rather hopefully - give them descriptive names) I can state without hesitation that I bloody well wish I had done.

Initialisation only takes up time while the mission is loading anyway, so it doesn't really matter.   You're staring at a blank screen in any case.

Being just very slightly smarter than Sui I've had only one "annoying and time consuming experience" with a variable I didn't define.   ;D
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger trouble
« Reply #9 on: 20 Sep 2004, 20:16:42 »
Sui  I have to say I am honoured and deeply touched by the award.  In best Hollywood style I would like that all those that made this award possible.  I would like to thank BIS for making the game, Intel for designing my chips and Malaysia for making them.  I would also like to thank my wife for.... well never mind what I want to thank her for.

Anyway I am making some space in my display cabinet and I have a few questions.
- how big is the trophy?
- will I need to increase my insurance, or install any special security measures once I receive it?
- and finally (note that this is the most important point - but being a Brit I make it seem like an after thought)  is it like the Nobel Prize - coming with a big fat cheque? ;D

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Trigger trouble
« Reply #10 on: 20 Sep 2004, 21:44:28 »
actually, not all computers have the processing speed that ur talking about. Besides having it installed on my pentium IV Dell, i have it installed on my Win 98 pentium II for debugging purposes, and with that, memory and speed are a problem. :P ;D  ::)

But i will admit that i was only looking personally, and that most everyone now has a nice fast 2.5 Ghz processor and 4 Gb of RAM/ROM. Speedy.....
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger trouble
« Reply #11 on: 20 Sep 2004, 21:59:55 »
Look ere m8.

My first programs were written using 80 column punched cards, one card per line of code.  The programs ran on a 'mainframe' that had a massive 64 Kbt (yes Kbt) of memory (we called it 'core' then -  RAM you would know it by nowadays).  The computer occupied a whole air conditioned floor of an office block and took a team of staff working 24 hours a day just to keep it running, smoking was not allowed - the smoke particles would kill the machine!!  Minimising memory usage was then important.  Nowadays - forget it.  You have absolutely no problems with memory now.

Now a modern game on a PII - yes you have a problem.  But honestly suggesting that not initialising variables will help!  Pull the other one. ;)
« Last Edit: 20 Sep 2004, 22:01:52 by THobson »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Trigger trouble
« Reply #12 on: 20 Sep 2004, 22:12:35 »
You are scaring the llama away you n00bettes!

Lövet, f00k the above posts. They can't answer a simple thread without going all "is that rigth?" and "oh! is that so!" and "ah! a trophy" and "oh godness! Do you really mean New York was whiped out by an astreoid?"

What you gonna do is learn about booleans.

A boolean is simply a variable, a word, keyword if you'd like, that you can turn true or false. For instance, if I had this trigger:

cond: this
on act: llamachop = true

then I could use this in another trigger:

cond: llamachop
on act: hint "hooray!"

booleans are allways set to false when you define them, write them down.

So in your case, you have your non present trigger I suppose? The trigger should look something like this:

cond: this
on act: nowweend = True

and in another trigger at the base, you group the trigger with the player so it is only him activating it. And type:

cond: nowweend and this
on act: [Whatever you like]

Now, I've explained this very detailed so if you have any questions, I have to shoot you. ;D

:beat: *Gets Shot* :beat:

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:Trigger trouble
« Reply #13 on: 20 Sep 2004, 22:12:55 »
arsty, this is a guru war ;D :o

my mom used a mainframe, and infact hers had a 36K of memory (They didn't call it core though  ??? ). That was back when she was using Fortran and PO1.

Anyway, u have me here wavin a white flag like no other :) And anymore I don't have to use as many varibles. Its interesting to look at ur old n00b scripts and see how much they suk... ;D

okay, i better get off now. Some Mods gonna shoot me for ranting, not excluding armsty
« Last Edit: 20 Sep 2004, 22:16:15 by Tyger »
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger trouble
« Reply #14 on: 21 Sep 2004, 05:33:55 »
Quote
You are scaring the llama away you n00bettes!

Lövet, f00k the above posts. They can't answer a simple thread without going all "is that rigth?" and "oh! is that so!" and "ah! a trophy" and "oh godness! Do you really mean New York was whiped out by an astreoid?"

Lol - you are quite right.  :D

Just got a bit carried away there ;D


« Last Edit: 21 Sep 2004, 05:49:51 by THobson »