Page 4 of 7

Re: Some Questions

Posted: March 30th, 2010, 4:56 am
by Firelight
Hey guys, thanks for the examples. :D

I'm sorry but I don't really get those examples as I really don't get the hang of the syntax =x

What if I want something to happen when I go near a model? Something like:

Code: Select all

Model A:
if $x = 0;
do something, set $x = 1;

Model B:
if $x = 0;
say something.
if $x = 1;
do something, set $x = 2;




And, I assume (read the comments :D):

Code: Select all

key1 = 0

level_trigger_1 = [
   if (> $key1 0) [ // if $key1 is larger than 0?
      trigger 1 1 //I don't get this part.
      echo "You unlock the door with the key."
   ] [
      trigger 1 0 //Not this too.
      echo "The door is locked."
   ]
]
level_trigger_2 = [
   key1 = (+ $key1 1) //Is this set $key1, $key1 + 1?
   echo "You picked up a key."
]



Sorry, but I can't seem to make it work.

I loaded the existing village map and saved it as a new map, and added 2 new mapmodel with tag trigger_level_1 and trigger_level_2. Then I created a new .cfg file and pasted the script inside. I also changed both of them to trigger type 11 and 12 respectively. When I walked near one of them, it disappeared without any messages/texts and the other one just remains there.

Anything I done wrongly?

Again, thanks for all the help!

Re: Some Questions

Posted: March 30th, 2010, 8:32 am
by arcones
We're basically trying to explain that (read the notes) ;) :

Code: Select all

    key1 = 0

    level_trigger_1 = [
       if (> $key1 0) [ // This is what the key1 = 0 is/equals.
          trigger 1 1 //It shows the trigger values. If you have that value, then it unlocks the door.
          echo "You unlock the door with the key."
       ] [
          trigger 1 0 //If you have this trigger value, then the door is locked.
          echo "The door is locked."
       ]
    ]
    level_trigger_2 = [
       key1 = (+ $key1 1) //This is the trigger value of the key to unlock the door. (Remember the trigger value up above?)
       echo "You picked up a key." (Now you can unlock the door)
    ]

Hope that helps you Firelight!

Arc :geek:

Re: Some Questions

Posted: March 30th, 2010, 2:26 pm
by Venima
Just to be clear incase you didn't get that.

Code: Select all

    key1 = 0

    level_trigger_1 = [
       if (> $key1 0) [ // If $key1 is more than 0
          trigger 1 1 //A mapmodel with trigger tag 1 gets their value set to 1 (in this case it means the door opens)
          echo "You unlock the door with the key."
       ] [
          trigger 1 0 //A mapmodel with trigger tag 1 gets their value set to 0 (in this case it means the door closes)
          echo "The door is locked."
       ]
    ]
    level_trigger_2 = [
       key1 = (+ $key1 1) //This adds 1 to $key1. Yes I know the syntax is weird but just go with it ;p. (it sets $key1 to <$key1 + 1>) only you don't have the $ in front of the first bit
       echo "You picked up a key." (Now you can unlock the door)
    ]

Re: Some Questions

Posted: March 30th, 2010, 2:28 pm
by arcones
Was I close??

Re: Some Questions

Posted: March 30th, 2010, 2:30 pm
by Venima
Yeah, only I thought it might be clearer if I involve the mapmodels in the explanation.

Re: Some Questions

Posted: March 30th, 2010, 2:31 pm
by arcones
Okay... :) 8-)

Re: Some Questions

Posted: March 31st, 2010, 8:40 am
by Firelight
Ok, thanks to all your help, I got it to work! Thanks alot! :D

I have another question now. As I mentioned previously, how do you script a model to start following you around when triggered?

Again, thanks for those awesome solutions! Really really appreciated the help!

Re: Some Questions

Posted: March 31st, 2010, 8:46 am
by arcones
I wouldn't know if you script mapmodels to follow you...

However, go into fps mode. Pick any map, and enter edit mode. Hit esc and click Editing Gui. Click on "Ents". Click on, "Spawn Creature" (It'll say something like that ;) ) Then you'll have a box on the ground. Click on it. Change the number by the "Butterfly"... That will change the creature. They will follow you through open gates, around trees, etc.

NOTE: They aren't that smart. They try to get to you the fastest way possible!! They don't know about lava!! If they fall into the lava they die and you'll have to respawn them by going into edit mode then back again.

Hope that helps! :D

Arc :geek:

Re: Some Questions

Posted: March 31st, 2010, 9:28 am
by Firelight
Thanks for the reply!

I don't have to do anything else and it will automatically follow me around after spawning it?

Is there anyway to make it stay where it is until I go near it, and only then it will start following me?

And, how do I add my own creatures?

Again, I really appreciate that you spend your time explaining these to me. Thank you! :)

Re: Some Questions

Posted: March 31st, 2010, 10:08 am
by arcones
No Problem!

Anyway, you have to set the level trigger to make it follow you. (And yes, it will only follow you once you get near enough to trigger it ;) otherwise it'll just stand still)

As for adding your own creatures... that's tough. :| I don't know how to do that. I believe it's a matter of actually being able to code the new creature in the actual engine...

Hope that helps!

Arc :mrgreen: