Trigger object by adding to a variable

Lithtech Jupiter engine

Post Reply
User avatar
Spawn
Admin
Admin
Posts: 1310
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Trigger object by adding to a variable

Post by Spawn » Sat Mar 03, 2007 12:36 am

This was fun!

I've always been wondering how you could set several requirements for a object
to start.. And had a look into it today :)

Say that you need to activate 2 switches to open a door.. that can't be done with ordinary commands as far as I know.. the same goes if you have to complete several things to complete a objective..

What I figured out was.. VARIABLES was a good thing!

set this command in the gamestartpoint or something:

Int variable1 0
and When (Variable1 equals 5) Then (msg door on)

The complete line would look like this:

Int Variable1 0;When (Variable1 equals 5) Then (msg door on)

That means there has been created a variable named variable1 with a value of 0
This mean that it doesn't have the same value as the one in the base command which is 5, and will then only trigger when you reach equal values :)

Now on the first switch add this into the commandline:

Add variable1 1

And in the second switch

add variable1 4

Then it is a sum of 5 and the door will open :thumb:

Just thought I'd mention it..
Image

User avatar
Johnny LaRue
Advanced Member
Advanced Member
Posts: 33
Joined: Tue Jan 16, 2007 2:30 pm
Location: Oh Canada!
Contact:

Post by Johnny LaRue » Sat Mar 03, 2007 7:00 am

hmmm.... interesting ;)

I had never known of or used the variable commands in my levels. I relied heavily on triggers. I would usually have locked triggers that would be unlocked by a certain event , & than in turn it would send its commands.

I also used the "activation count" property in triggers to help set up some of my objectives

Right on Spawn! :thumb:


JLAR

User avatar
Spawn
Admin
Admin
Posts: 1310
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Post by Spawn » Sat Mar 03, 2007 3:04 pm

Yeah, that's what I've done too.. this was actually a lot easier :)
Image

Post Reply
jedwabna poszewka 50x60