Page 2 of 7

Re: Some Questions

Posted: March 28th, 2010, 6:00 am
by Firelight
About @9,

I was talking about something like a pet. It will only follow me if I triggered it and then it will follow me forever.

What do you mean by dropping it from the inventory?

Again, thanks for the replies! :D

Re: Some Questions

Posted: March 28th, 2010, 6:29 am
by Leo_V117
what he means by "dropping" it from the inventory is. When you code an object into the inventory with: r_type $ENT_ITEM you get the function "drop" when you select that item. Thats what he means by "dropping", if you set a model to it eg. r_model "dan/rock" the dropped item can be picked up again.

Re: Some Questions

Posted: March 29th, 2010, 1:57 am
by Firelight
Hi, can anyone give me an example code of triggered event?

With the triggering part and event part.

Question:

Code: Select all

level_trigger_0 = [if (= $triggerstate -1) [echo "The door is locked"] [echo "You opened the door."]]


How do I trigger this? And how does it "triggers" it?

Thanks in advance :)

Re: Some Questions

Posted: March 29th, 2010, 6:30 am
by Venima
First I would say you should change that first bit to "level_trigger_1".

Create a door mapmodel with trigger type 11 and trigger tag 1.

Then create a key mapmodel with trigger type 12 and trigger tag 2. (yes one exists)

Finally below that code write:

Code: Select all

level_trigger_2 = [trigger 1 1]


try picking up the key and walking through the door.

I've never seen $triggerstate before but assuming I know what it is everything should work fine.

Re: Some Questions

Posted: March 29th, 2010, 1:21 pm
by Firelight
Hi, thanks for the reply.

How do I choose a certain trigger type? When I added a new model, it's tag is level_trigger_0.

Do I use level_trigger_1 for it instead of 0?

Re: Some Questions

Posted: March 29th, 2010, 1:26 pm
by Leo_V117

Code: Select all

level_trigger_12


Thats for Keys

Code: Select all

level_trigger_11


Thats for Doors

Re: Some Questions

Posted: March 29th, 2010, 1:36 pm
by Venima
nooo leo, nooo!!!

level_trigger_<whatev> is the tag, not the type.

Select the mapmodel and hit F3 to edit it.

Re: Some Questions

Posted: March 29th, 2010, 2:06 pm
by Leo_V117
Wait... What? I thought that

Code: Select all

trigger_tag_<numb>
was the tag. And

Code: Select all

trigger_type_<numb>
was the Type.

Re: Some Questions

Posted: March 29th, 2010, 2:33 pm
by arcones
No Leo. ;)
Technically you don't need to code trigger's at all!! (Although it does help) ;)

@Firelight, yes. If you're interested in making doors open only if you have the right key, look here: Opening locked doors This should help you understand Level triggers and Trigger Types! ;)

Arc

Re: Some Questions

Posted: March 29th, 2010, 2:37 pm
by Venima
on the mapmodel yes, in the cfg code, "level_trigger_<numb>" is the tag

arcones, in that code I think the key will open the door before you approach the door. However if you want it more realistic and have the door open when you approach it if you have the key, then:

Try the code below in the cfg (hit F6).
Then create a mapmodel of a door with trigger tag 1 and trigger type 11 and a mapmodel of a key with trigger tag 2 and trigger type 12. (You can change the tags later, make sure in the code the level_trigger_<num> is the same as the associated mapmodel's trigger tag)

Code: Select all

key1 = 0

level_trigger_1 = [
   if (> $key1 0) [
      trigger 1 1
      echo "You unlock the door with the key."
   ] [
      trigger 1 0
      echo "The door is locked."
   ]
]
level_trigger_2 = [
   key1 = (+ $key1 1)
   echo "You picked up a key."
]