Two scripting questions
-
I have two questions about the next version.
First of all, will it be possible for an object to figure out which other object of a certain class is closest to it? That would be helpful in things like, turrets.
2nd, will you be able to modify the ontouching event so that the event only applies when the object is touching one particular thing? As in, a cube being set to emit stuff when it is touched by the sphere "blah" but NOT by the cone "Dorg"
-
2nd: yes.
-
1st is already possible. Oh, and you'll be able to tell the name of the object that's touching, so, yes.
For the first, you'd also be able to only start firing when the object is 'within range'. Oh, and you probably already know you can change lookAt... in the next version, you'll also be able to turn it off once started.
-
Yes, in next version you can find the name of the object that touched and respond accordingly.
-
@wacov said:
1st is already possible. Oh, and you'll be able to tell the name of the object that's touching, so, yes.
For the first, you'd also be able to only start firing when the object is 'within range'. Oh, and you probably already know you can change lookAt... in the next version, you'll also be able to turn it off once started.
Could you tell me where I can find out the scripting nessicary for the "smart turret?" For example, HOW do you define object classes? HOW do you get the square root of something (square root is nessicary for the Pathagoream Therom and therefore the distance formula.)
Also, I asuming that what you mean by "you can change lookAt" refers to their use along with "if statements". If not, I don't know what you mean.
Please forgive my ignorance. I find it really hard to keep up with all the developments.
-
Not really classes, but names are almost as good. Every body has a name. So you can (in next version) say:
if toucher.name=="smallTurret" #within range of 100? if (position-toucher.position).length<100 #do something. end end
-
Thats right.
-
I haven't even gotten to looking at scripting yet, but it looks like the 'name' field is a string, so with a bit of extra code you could look at the prefix of the name as a class identifier, right?
so fire at all objects named: "enemy<something>"
or act on all objects named: "box<number>", but ignore anything else
-
If you need square root, this is my suggestion:
x**0.5
Advertisement