How can I give parameters to a Datablock?
by Dani Segarra · in Technical Issues · 10/03/2007 (7:40 am) · 5 replies
Hello everybody:
I was doing a simple converse interface. For doing this, I create a Databock that is activated with a trigger when the player aproaches to another character.
In the converses, the character tell a sentence to the player and this have some answers.
For testing the interface I write the question and answers inside the datablock, but making of this form, the datablock can only have one "question/answers". I want to give the questions and the answers like parameters of the datablock and have diferent converses with diferent characters using the same datablock and diferent parameters.
I try to give the parameters like these
datablock TriggerData(datablockConversa, %question, %answer1, %answer2, %answer3){
tickPeriodMS=100;
};
but if I do this, the datablock doesen't apears in teh world edition.
Someone can tell me how to give parameters to a datablock? Or it isn't possible and I have to create a datablock for each question?
Thank you!!
I was doing a simple converse interface. For doing this, I create a Databock that is activated with a trigger when the player aproaches to another character.
In the converses, the character tell a sentence to the player and this have some answers.
For testing the interface I write the question and answers inside the datablock, but making of this form, the datablock can only have one "question/answers". I want to give the questions and the answers like parameters of the datablock and have diferent converses with diferent characters using the same datablock and diferent parameters.
I try to give the parameters like these
datablock TriggerData(datablockConversa, %question, %answer1, %answer2, %answer3){
tickPeriodMS=100;
};
but if I do this, the datablock doesen't apears in teh world edition.
Someone can tell me how to give parameters to a datablock? Or it isn't possible and I have to create a datablock for each question?
Thank you!!
#2
10/03/2007 (7:56 am)
Thank you Sean!
#3
I was looking for a form to be in the game editor and create a trigger and select the question and answers that I choose in this moment.
Is this possible?
10/03/2007 (8:37 am)
But, in the solution that Sean give. The datablockConversa ever will have the same question and answers.I was looking for a form to be in the game editor and create a trigger and select the question and answers that I choose in this moment.
Is this possible?
#4
By definition the values within a datablock are not intended to change during game play--you will probably start running into walls because of this is you keep using datablocks in that way.
Off the top of my head, I'd suggest looking at using ScriptObjects for prototyping, and probably in the long run going to some type of custom class that stores your various questions/answers as your design becomes more fleshed out.
10/03/2007 (8:55 am)
It's certainly possible, but datablocks are not the structure you want to use for dynamic/changing things during game execution.By definition the values within a datablock are not intended to change during game play--you will probably start running into walls because of this is you keep using datablocks in that way.
Off the top of my head, I'd suggest looking at using ScriptObjects for prototyping, and probably in the long run going to some type of custom class that stores your various questions/answers as your design becomes more fleshed out.
#5
10/03/2007 (9:36 am)
Thanks for the advice
Torque 3D Owner Sean H.
this should work:
function create_converse(%question,%answer1,%answer2,%answer3) { datablock TriggerData(datablockConversa) { question = %question; answer1 = %answer1; answer2 = %answer2; answer3 = %answer3; tickPeriodMS=100; }; }I dont know if this is the best way to do it, but it should work.