Author Topic: Need help with some scripting  (Read 1882 times)

I need some assistance with scripting...

I am trying to modify the following code created by the Brick Generator:

datablock fxDTSBrickData (brick3x3x3Data)
{
   BrickFile = "Add-Ons/Bricks/Bricks3x3x3.blb";
   Category = "Bricks";
   SubCategory = "1x";
   UiName = "3x3x1";
   IconName = "";
};

** I want to create a brick that is automatically decollisioned without having to touch/hit the brick with an inventory item. It should be decollisioned once the brick has been placed.



If its that particular brick you want to decollision on placement you just need this code:

Code: [Select]
function brick3x3x3Data::onPlant(%this,%obj)
{
   %obj.setColliding(0);
}

I think.

If its that particular brick you want to decollision on placement you just need this code:

Code: [Select]
function brick3x3x3Data::onPlant(%this,%obj)
{
   %obj.setColliding(0);
}

I think.

Don't you need to check if the brick has been planted?

datablock fxDTSBrickData (brick3x3x3Data)
{
BrickFile = "Add-Ons/Bricks/Bricks3x3x3.blb";
Category = "Bricks";
SubCategory = "1x";
UiName = "3x3x1";
IconName = "";

};

function brick3x3x3Data::onPlant(%this, %obj)
{
   %obj.setColliding(0);
}

I tried the above code but nothing happens. I still collide against the brick once the brick has been planted.



datablock fxDTSBrickData (brick3x3x3Data)
{
BrickFile = "Add-Ons/Bricks/Bricks3x3x3.blb";
Category = "Bricks";
SubCategory = "1x";
UiName = "3x3x1";
IconName = "";

};

function brick3x3x3Data::onPlant(%this, %obj)
{
   %obj.setColliding(0);
}

I tried the above code but nothing happens. I still collide against the brick once the brick has been planted.




You don't have to tell us twice, try this:

Code: [Select]
function brick3x3x3Data::onPlant(%this, %obj){
schedule(100,0,decollideBrick,%obj);
}

function decollideBrick(%obj){
if(isObject(%obj)){
   %obj.setColliding(0);
   }
}

Thank you for the help, Mr Pickle. You were right on the money.

YOU ARE THE MAN!


I wish I could give Kudos to you. You earned it!





datablock fxDTSBrickData (brick3x3x3Data)
{
BrickFile = "Add-Ons/Bricks/Bricks3x3x3.blb";
Category = "Bricks";
SubCategory = "Custom Bricks";
UiName = "3x3x1_Decollide_Brick";
IconName = "";
 
};

function brick3x3x3Data::onPlant(%this, %obj)
{
   schedule(100,0,decollideBrick,%obj);
}

function decollideBrick(%obj)
{
   if(isObject(%obj))
   {
      %obj.setColliding(0);
   }
}


Credit for the above code goes to Mr Pickle and to the person who created the Brick Generator without server restart. THANK YOU!

How do you check to see if the player is standing on a brick?

I am trying to modify the Building Platform.



How do you check to see if the player is standing on a brick?

I am trying to modify the Building Platform.




You cloud do a ray cast down from the player and see if there's a brick.

To Mr. Pickle

What? Ray cast down from player? How do u do that?


« Last Edit: December 01, 2007, 12:07:17 PM by blackrogue24 »

Quote from: dumpConsoleFunctions();
   /*! Cast a ray from start to end, checking for collision against items matching mask.

If exempt is specified, then it is temporarily excluded from collision checks (For instance, you might want to exclude the player if said player was firing a weapon.)
@returns A string containing either null, if nothing was struck, or these fields:
            - The ID of the object that was struck.
            - The x, y, z position that it was struck.
            - The x, y, z of the normal of the face that was struck. */
   virtual string containerRayCast( Point3F start, Point3F end, bitset mask, SceneObject exempt=NULL ) {}
   /// @}

useful typemasks (for more than one separate with a |)
$TypeMasks::PlayerObjectType
$TypeMasks::FXBrickObjectType
$TypeMasks::VehicleObjectType

How do i use the getPosition function to get the position of the building platorm? It returns a three-element vector containing x, y, and z.

Or can I do something like this?

%x.BuildingPlatform.getTransform();
%y.BuildingPlatform.getTransform();
%z.BuildingPlatform.getTransform();



« Last Edit: December 01, 2007, 12:35:53 PM by blackrogue24 »

firstWord(containerRayCast(BuildingPlatform.getPosition(),vectorSub(BuildingPlatform.getPosition,"0 0 1", $TypeMasks::Fxbrickobjecttype));

... returns the id of a brick (if found) about 1.6* brick heights below the player or nothing.

*(1/0.6)

Is it possible to script the hook shot add-on so that when the user is using the hook shoot fall damage is turned off...then fall damage is turned back on when he/she is finished with the hookshot. If so, show me how to script this...please.