Scripting Questions (3)
by Donny Wilbanks · in Torque Game Engine · 03/22/2004 (11:29 pm) · 12 replies
Howdy again, its me the Newby here are some scripting functions I am looking to do.
Question #1
Whats the function called for "Destroy Object",
"Destroy Object" not by via damage but by just poofing it out of the game.
Example:
Object moves to a certian point (trigger detects it) (I got the triggers down)) the trigger script then fires off, figures out it's X object. Trigger then fires off Destroy Object function.
Question #2
Also do objects have a personal ID or a TAG so to speak?
Such as Object X has the Tag ID "Bot_1";
Question #3
Can I spawn things via script(?) without having them be placed on the ediotr - this one is probley not to easiy so If icould be pointed to a tutorial that would be fine!
Question #1
Whats the function called for "Destroy Object",
"Destroy Object" not by via damage but by just poofing it out of the game.
Example:
Object moves to a certian point (trigger detects it) (I got the triggers down)) the trigger script then fires off, figures out it's X object. Trigger then fires off Destroy Object function.
Question #2
Also do objects have a personal ID or a TAG so to speak?
Such as Object X has the Tag ID "Bot_1";
Question #3
Can I spawn things via script(?) without having them be placed on the ediotr - this one is probley not to easiy so If icould be pointed to a tutorial that would be fine!
#2
All objects have an object id - its the number you see inside the world editor on each object.
Answer to #3:
Yes - look at your aiPlayer.cs (I think) to see how its done. Its something along the lines of
%object = new(Item) {
DataBlock = ThingToSpawn;
}
03/23/2004 (12:14 am)
Answer to #2:All objects have an object id - its the number you see inside the world editor on each object.
Answer to #3:
Yes - look at your aiPlayer.cs (I think) to see how its done. Its something along the lines of
%object = new(Item) {
DataBlock = ThingToSpawn;
}
#3
So If I wanted I could get the location of something via Tag, then have it spawn at the location.
Is there a list of varibles that are used in the game for standard Objects
such as
%obj.x = equals X location
&obj.z = equals z Location
I am sure there is, what's the reference page? / Link
(more, more, mroe I need more)... :)
I am kinda peiceing togheter the functions and varibles as I go through.
Eventaul I will get the hang of this :) Then I can stop bugging you folks for a while.
Anybody up for a Milkshape question?
03/23/2004 (12:39 am)
Thats very useful.So If I wanted I could get the location of something via Tag, then have it spawn at the location.
Is there a list of varibles that are used in the game for standard Objects
such as
%obj.x = equals X location
&obj.z = equals z Location
I am sure there is, what's the reference page? / Link
(more, more, mroe I need more)... :)
I am kinda peiceing togheter the functions and varibles as I go through.
Eventaul I will get the hang of this :) Then I can stop bugging you folks for a while.
Anybody up for a Milkshape question?
#4
eg "20.33 56.933 546.4567", you can use getWord to extract specific components out of that.
The docs can be found at www.garagegames.com/docs/torque.sdk/index.php#scripting
or newer/better formatted ones are at www.garagegames.com/docs/alpha/ch05.html#chapter.scripting.overview,but they are incomplete
03/23/2004 (12:54 am)
%obj.getPosition() returns a string formatted like "x y z" for most objects.eg "20.33 56.933 546.4567", you can use getWord to extract specific components out of that.
The docs can be found at www.garagegames.com/docs/torque.sdk/index.php#scripting
or newer/better formatted ones are at www.garagegames.com/docs/alpha/ch05.html#chapter.scripting.overview,but they are incomplete
#5
I am working on getting bits and parts down now. The parts I need to like get answers...
I think its better phrased to be "I need more answers to ask even bigger questions.".
I think it's still better than last week, when I chose a Gui to messaround with. I spent a couple of hours spining my wheels. I find the spot where I can test spawning code and such and See it happen by running over a trigger. Thus cause and effect. So I am trying to put tegether a Object that will fall from the sky and be destroyed at the bottem...
I almost have enough parts to do so...
03/23/2004 (1:10 am)
Yeah, I got the chapter 5 stuff down (as far as what they have listed.)I am working on getting bits and parts down now. The parts I need to like get answers...
I think its better phrased to be "I need more answers to ask even bigger questions.".
I think it's still better than last week, when I chose a Gui to messaround with. I spent a couple of hours spining my wheels. I find the spot where I can test spawning code and such and See it happen by running over a trigger. Thus cause and effect. So I am trying to put tegether a Object that will fall from the sky and be destroyed at the bottem...
I almost have enough parts to do so...
#6
What is the games main file.
On that is checked often and that events are driven off of (comet to think of it, some thing that access a timer....
lets see I think I am answering my own question).
let me dig up one of those "timer" GUIs that would work to stencel in some game events.
03/23/2004 (1:25 am)
Here's another QuestionsWhat is the games main file.
On that is checked often and that events are driven off of (comet to think of it, some thing that access a timer....
lets see I think I am answering my own question).
let me dig up one of those "timer" GUIs that would work to stencel in some game events.
#7
03/27/2004 (5:44 pm)
What about using schedule()?
#8
03/27/2004 (11:03 pm)
What's a Schedule()?
#9
Go check out some of the scripting tutorials. Basically, it lets you set up a script function to be called at some point in the future.
03/28/2004 (1:12 am)
:)Go check out some of the scripting tutorials. Basically, it lets you set up a script function to be called at some point in the future.
#10
03/28/2004 (1:23 am)
Also, there's a dump method you might want to use.
#11
Yes, schedule() is detailed in some of the tutorials linked to earlier.
I hope you'll continue to keep notes on your learning process. If they can be organized and written-up later, they could be a great resource for newbies. :D
03/28/2004 (1:30 am)
Woot! Go Donny :) Glad to see you learning so quickly.Yes, schedule() is detailed in some of the tutorials linked to earlier.
I hope you'll continue to keep notes on your learning process. If they can be organized and written-up later, they could be a great resource for newbies. :D
#12
Sofar so good. I am working on a journal so to speak at this moment. When I run a tut see what took me the longest to figure out.
I think the hardest part and the highest on the "frust-o-meter" is getting the programs installed "correctly" so that the tutorials can be done. I think I will create me a pic of the frust-o-meter. Well back to reinstalling parts.
03/28/2004 (9:00 pm)
Most defantly, taking a few days off from the thinking proccess. (plus my main computer just took a dump)seing how well it all works on my laptop now. Sofar so good. I am working on a journal so to speak at this moment. When I run a tut see what took me the longest to figure out.
I think the hardest part and the highest on the "frust-o-meter" is getting the programs installed "correctly" so that the tutorials can be done. I think I will create me a pic of the frust-o-meter. Well back to reinstalling parts.
Torque Owner Dylan Sale
2) yes, the actual variable is a tag, but its numerical... ie %object might equal 1234. That is the ID. You can use a name if you want.
3) yep, look for the "new" keyword. Also look in the game.cs file to find out how players etc are spawned.. Another good place to look is in crossbow.cs in onFire, see how the projectiles are created.
Also, the mission files themselves are just lists of "new" commands that creates the objects.