Page 1 of 1

Area triggers help.

Posted: 2009.06.04 (10:04)
by Kablamo
I really need help on this subject.

I have a map that i would like a part of it to turn into water, the dimensions being 670,430 to the bottom right of the map

Problem is if try to do it I fail.

MISERABLY

and even though i look at other peoples and the mod website, i still have no idea how to do it.

PLEASE HELP ME!!!!!

Re: Area triggers help.

Posted: 2009.06.04 (17:21)
by kkstrong
Okay this might be a little tough to explain...but we'll try anyways!

Area Triggers:
You have to start off knowing your area where you want to be, for example, I have marked off the area here with a box of gold. The first number you want is the top left hand side of the box. That number was given to me: 672.444 (which just a half step from 670,430 and a lot simpler to use for our purposes).



Now that you have your area defined, you want the top left number and the bottom right number (to form the area rectangle). I assume you just wanted to use a drone that starts only when you have entered the circle. The regular Drone data is this: 6^540,468,3,0,0,2 . The Drone is the object you want triggered, so that is where you place this at the end of the drone data: ^^waitForTrigger ID (0 or 1),startTriggersID,stopTriggersID,startSpecialTriggersID,stopSpecialTriggersID . Now then, I now I want thedrone to be stationary initially, so that makes the waitForTrigger 1. 0 is false, and 1 is true. So right now I would put ^^1 at the end of the drone data. The start trigger should be any number between 1 and 99, for this example, I will choose 9. You want the drone to wait for the trigger, but start when the trigger is activated (i.e. when the ninja goes in the correct area). That means that I want to add to the end of the drone code ^^1,9 as explained above. You can omit the startSpecialTriggersID and the stopSpecialTriggersID since we are not using them this time. Your final drone data code looks like this: !6^540,468,3,0,0,2^^1,9 .

Now we need to code the actual area trigger. The code for that is ||||||objectnumber^x0.y0:x1.y1^startTriggersID,stopTriggersID,specialOnTriggersID,specialOffTriggersID. Okay, the object number here is the object number of the thing that will set off the trigger. In this case, it will be the ninja, since it is the ninja that will be going into the selected area, making the trigger set off. The Object number for the ninja is 5 (you can find that here). So far what we have is ||||||5^ the next thing we need to know is top left coordinate and the bottom right coordinate. The top right coordinate is 670.430 and the bottom right coordinate is 768.576 , so that makes our code so far ||||||5^670.430:768.576 We are getting close now! The only thing that you need now is the StartTriggersID. Remember earlier, we defined that as 9? Well its the same here, and now out code is ||||||!5^670.430:768.576^9 . Again you can omit the other variables since we didn't define them earlier. That is your final code for the area trigger.

When you put it all together, you get !6^540,468,3,0,0,2^^1,9||||||!5^670.430:768.576^9 , which should work. Here is the final map with the gold border



And the final map with the gold border removed:



The thing about NReality mods is that when you get something little wrong, the whole mod doesn't work. It can get frustrating to "debug" the first couple times you need to do a mod, however it does get a bit easier. Often times it takes a fresh pair of eyes to figure out what you have done wrong. I find that a lot of the time for me it is placing a comma instead of a period, or getting the wrong number. Most of the time is is stupid errors like that... but be persistent, and you will get better at modding!

Re: Area triggers help.

Posted: 2009.06.05 (03:18)
by bufar
By water, I assume you mean that you want gravity to be lessened. Well, I happen to have made few maps like this and probably know why it isn't working.

Let's say that this is your map:

I have sectioned off the water with doors. Note that the ninja is outside the water. If you want him inside, this particular method won't work. Just post again and I'll explain that scenario as well. For the area trigger part, explained above by kkstrong, add "||||||!5^670.430:768.576^1" to the end of the map. Note that for this area the startTriggerID is 1. Now all we need is something to trigger. Here is probably where you are having problems.

Most explanations only show how to start or stop an item, not change gravity. This is probably because changing gravity is relatively trickier than a normal area trigger. To do this, you need to know a little about AI Pathing Objects.

To give an object AI, add "^^^customPath,PathID,Direction,speed" to the end of that object's code. customPath is where you want the object to move. (U = Up, L = Left, ect.) It is left blank except when using an nReality Custom Path. PathID is how the item will move (surfacefollow CW, dumb CCW, etc.) Direction and speed are self-explanatory.

For this we will be using an nReality Custom Path (PathID 6). Since we are lessening gravity, we want the ninja to be moving upward. This means that the customPath will be set to U. Leave Direction blank. Since we still want gravity to be in effect, speed must be less than the speed of gravity (0.15). For this example I will make it 0.1. Our ninja's code is now "5^396,564^^^U,6,,0.1"

Oops! We forgot to set it to start when the area trigger is activated. Also explained by kkstrong, the ninja's code is now "5^396,564^^1,1^U,6,,0.1" and the map data is:

Oh no! It seems as if he is underwater all the time! Don't worry, we can work around this, but it gets slightly more complicated.

Since we want the ninja to stop automatically moving up once he leaves the water, we need to use an area trigger to turn his AI off. Actually, since area triggers are rectangular, we need two overlapping rectangles to cover the rest of the map.

The first one will be the rectangle above the water, which goes from 0,0 to 768,430. The area trigger is "!5^0.0:768.430^,2" Note that instead of setting a startTrigger, we set a stopTrigger. Now the other area trigger is "!5^0.0:670.576^,2" This makes the whole code "||||||!5^670.430:768.576^1;!5^0.0:768.430^,2;!5^0.0:670.576^,2"

But we're still not done. We didn't code the ninja to turn off yet! The ninja's code is now "5^396,564^^1,1,2^U,6,,0.1" and the map data is now:

Now we're done. That was a little (okay, very) complicated so if you have any questions, please ask.

Re: Area triggers help.

Posted: 2009.06.05 (21:52)
by Kablamo
Bufar and KKstrong you are both awesome. Thank you soo much ^_^