Help--How to use setHidden by triggers
by Todd J. Dinius · in Torque Developer Network · 11/07/2009 (2:25 pm) · 1 replies
If any one could help I would be very thankful.
What I'm trying to do is when you stand on the box.dts object and leave the trigger area the box disapears.
It does not nessisarly have to be a setHidden command but I figured that was the easiest way to do it.
Another possibility would be a way for just the box it self to dissapear when your not contacting it through its own .cs file and not a trigger
The problem is when I call the setHidden command I'm not entirly sure how to type it to call on the box. It is based off of a code for making the door open and close. I typed some things and next to them is what error they produce
datablock StaticShapeData(platformTest){
shapeFile = "starter.fps/data/shapes/Platforms/box.dts";
};
datablock TriggerData(platformTestTrigger) {
tickPeriodMS = 10;
};
function addPlatform(){
%platformObj = new StaticShape(){
position = "437.606 303.687 220.637";
scale = "1 1 1";
rotation = "0 0 1 -90";
datablock = platformTest;
};
%obj = new Trigger(){
position = "437.606 303.687 220.637";
scale = "1 1 1";
rotation = "0 0 0 0";
dataBlock = platformTestTrigger;
polyhedron = "0.0000000 0.0000000 0.0000000 2.0000000 0.0000000 0.0000000 0.0000000 -2.0000000 0.0000000 0.0000000 0.0000000 2.0000000";
platformID = %platformObj;
};
}
function platformTestTrigger::onEnterTrigger(%trigger, %this, %obj){
echo ("Did it work? well, the onEnter did!");
}
function platformTestTrigger::onLeaveTrigger(%trigger, %this, %obj){
echo( "Before code of the onleave trigger");
//------------------------------------Ways I Have tried to make setHidden work------------------------------------------------
//setHidden(%this.platformID); //unable to find funtion setHidden
//%id.setHidden(true); //cannot find object attempting to call function setHidden
//best so far i think i just need a better way to tell it what object
//setHidden = true; //parse error
//setHidden(true); //unable to find function setHidden
//%id.schedule(, "setHidden", true); //same parse error
//%obj.setHidden(true); //crashes game(bad code!!!! you do no no)
//%obj.schedule(0, "setHidden", true); //crashes game
//%platformObj.schedule(0, "setHidden", true); //cannot find object attempting to call function setHidden
//%platformObj.setHidden(true); //cannot find object attempting to call function
setHidden
//platformID.setHidden(true); //more errors, parse i think
echo( "After code of the on leave trigger");
}
What I'm trying to do is when you stand on the box.dts object and leave the trigger area the box disapears.
It does not nessisarly have to be a setHidden command but I figured that was the easiest way to do it.
Another possibility would be a way for just the box it self to dissapear when your not contacting it through its own .cs file and not a trigger
The problem is when I call the setHidden command I'm not entirly sure how to type it to call on the box. It is based off of a code for making the door open and close. I typed some things and next to them is what error they produce
datablock StaticShapeData(platformTest){
shapeFile = "starter.fps/data/shapes/Platforms/box.dts";
};
datablock TriggerData(platformTestTrigger) {
tickPeriodMS = 10;
};
function addPlatform(){
%platformObj = new StaticShape(){
position = "437.606 303.687 220.637";
scale = "1 1 1";
rotation = "0 0 1 -90";
datablock = platformTest;
};
%obj = new Trigger(){
position = "437.606 303.687 220.637";
scale = "1 1 1";
rotation = "0 0 0 0";
dataBlock = platformTestTrigger;
polyhedron = "0.0000000 0.0000000 0.0000000 2.0000000 0.0000000 0.0000000 0.0000000 -2.0000000 0.0000000 0.0000000 0.0000000 2.0000000";
platformID = %platformObj;
};
}
function platformTestTrigger::onEnterTrigger(%trigger, %this, %obj){
echo ("Did it work? well, the onEnter did!");
}
function platformTestTrigger::onLeaveTrigger(%trigger, %this, %obj){
echo( "Before code of the onleave trigger");
//------------------------------------Ways I Have tried to make setHidden work------------------------------------------------
//setHidden(%this.platformID); //unable to find funtion setHidden
//%id.setHidden(true); //cannot find object attempting to call function setHidden
//best so far i think i just need a better way to tell it what object
//setHidden = true; //parse error
//setHidden(true); //unable to find function setHidden
//%id.schedule(, "setHidden", true); //same parse error
//%obj.setHidden(true); //crashes game(bad code!!!! you do no no)
//%obj.schedule(0, "setHidden", true); //crashes game
//%platformObj.schedule(0, "setHidden", true); //cannot find object attempting to call function setHidden
//%platformObj.setHidden(true); //cannot find object attempting to call function
setHidden
//platformID.setHidden(true); //more errors, parse i think
echo( "After code of the on leave trigger");
}
Associate Steve Acaster
[YorkshireRifles.com]