dim3 Forum

Full Version: constants
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Ok, I am aware I was away for a while.
Anyways now Im back with a few scriptin questions:
*what is the constant to make an object delete?
*snap to a position
*move to a position
*do an animation
*make a new object at a position
*make a new varable + set it +the if event for one

Thank you in advance. Wink
1) No idea what you're talking about.
2) No idea again.
3) Depends on where you want it to move. Look it up in the documentation. http://erikkemmer.er.funpic.de/dim3/docs...bject.html (the motionVector part).
4) Check the documentation. http://erikkemmer.er.funpic.de/dim3/docs...bject.html (the animation part).
5) That's what script spots + scripts are for.
6) Look at a javascript tutorial somewhere. Even if it's one for JavaScript on websites, it will help you understand the syntax better.
1) Ok, you have an object around. Boom. Script activates.
The object is not there.

2) The object instantly goes to a position.

3) The reson Im asking is because i cant FIND it in the doument

4) Sweet, thanks.

5) Huh?

6) Ok. Do you know any good ones?
sorry to duel-post, but ive got the tutoreal on jawa--
err javascript tutoreal.

[EDIT]:
I did no want to triple-post so, yea.
Anyways, is there a constant that makes it so the script
waits for a bit and then continues on.
One more question, on 6 in my example.
Example:
1 Guy goes forward a bit (its a bot or somthing)
2 stops
3 WAITS one second (the first part im talking about)
4 turns back
5 waits one sec again
6 repetats prosess (the second part)
1) To make an object disappear, you will want to stop everything it does and hide the model.
2) I'm not quite sure, but it could be
Code:
obj.position.place(x,z,y,ang);
I never did that, so I don't know.
3) I even told you where to look and posted a link. What more do you need? It's right there.
5) To make a new object, spawn a script from a script spot. Not that hard to understand, is it?

Regarding your question about the bot AI:
Do something like this:
Code:
function startWalking(obj) {
obj.motionVector.go(); //The bot walks forward
/* Add other stuff here, like animations or sounds*/
obj.event.chain(20,stopAndTurn); //Wait 20, then go to the stopAndTurn function (not sure if this is the correct syntax. You might have to specify the function name in a different way.)
}

function stopAndTurn(obj) {
obj.motionVector.stop(); //Stop the bot
obj.motionAngle.turnToAngle(obj.angle.y+180,0); //Turn 180°
obj.event.chain(20,startWalking); //Wait 20, then start walking again
}

This is probably the fastest and easiest way to do it. If there is anything you don't understand, ask here, or come to the Dim3 IRC. Smile
pause then do something: [code]obj.event.chain(put wait time here,'name of function here');
Thank for all that!
One small question, though:
on function startWalking(obj) at the obj,
do I keep as it is or put the name of the object?
And a little bit of a bigger one:
Is it possable to tint the screen to a certant color?
PS: i think i got 3 and 4 mixed up
The functions can be called whatever you want Wink. As long as you have a function event, the first one called by the game Wink.
And yes, for tinting screen I forget the API, but search the player script for tint, you should find it Smile.
Code:
obj.status.tintView(r,g,b,alpha,fadeInMilliSec,lifeMilliSec,fadeOutMilliSec);
Wink
Thank you so much, bink.
With this help I think I got an idea for scripting for
now.
Pages: 1 2 3 4
Reference URL's