Author Topic: Making an anti-portal script.  (Read 1925 times)

The original script was made by Wheatley, but i edited it so every color except for a select few are not portalable

Code: [Select]
package PortalColorMod
{
function fxDtsBrick::OnPlant(%This,%brick)
{
if(%brick.colorID == 16)
{
%brick.antiportal = 0;
}
if(%brick.colorID == 6)
{
%brick.antiportal = 0;
}
if(%brick.colorID == 5)
{
%brick.antiportal = 0;
}
else
{
%brick.antiportal = 1;
}
parent::OnPlant(%This,%brick);
}

function FxDtsBrick::onColorChange(%this,%brick)
{
%newcolor = %brick.colorID;

if(%newcolor == 16)
{
%brick.antiportal = 0;
}
if(%newcolor == 6)
{
%brick.antiportal = 0;
}
if(%newcolor == 5)
{
%brick.antiportal = 0;
}
else
{
%brick.antiportal = 1;
}
Parent::onColorChange(%this,%brick);
}
};
Activatepackage(PortalColorMod);

However, everything is still portalable. What am I doing wrong?
I'm sorry if it's obvious, i have never done anything like this before. I'm new to this coding thing.

::onPlant(%brick) { }
::setColor(%brick, %id) { }

Still does not seem to be working...

Code: [Select]
package PortalColorMod
{
function fxDtsBrick::onPlant(%brick)
{
if(%brick.colorID == 16)
{
%brick.antiportal = 0;
}
if(%brick.colorID == 6)
{
%brick.antiportal = 0;
}
if(%brick.colorID == 5)
{
%brick.antiportal = 0;
}
else
{
%brick.antiportal = 1;
}
parent::onPlant(%brick)
}

function FxDtsBrick::setColor(%brick, %id)
{
%newcolor = %brick.colorID;

if(%newcolor == 16)
{
%brick.antiportal = 0;
}
if(%newcolor == 6)
{
%brick.antiportal = 0;
}
if(%newcolor == 5)
{
%brick.antiportal = 0;
}
else
{
%brick.antiportal = 1;
}
Parent::setColor(%brick, %id)
}
};
Activatepackage(PortalColorMod);

Get rid of your first line in ::setColor and Ctrl+H "%newColor" with "%id". Use %brick.getColorID() in ::onPlant.

I'm sorry if I'm frustrating you but i tried to interpret your post as best i can and the script is still not working.
Code: [Select]
package PortalColorMod
{
function fxDtsBrick::onPlant(%brick)
{
if(%brick.getColorID == 16)
{
%brick.antiportal = 0;
}
if(%brick.getColorID == 6)
{
%brick.antiportal = 0;
}
if(%brick.getColorID == 5)
{
%brick.antiportal = 0;
}
else
{
%brick.antiportal = 1;
}
parent::onPlant(%brick)
}

function FxDtsBrick::setColor(%brick, %id)
{
%id = %brick.colorID;

if(%id == 16)
{
%brick.antiportal = 0;
}
if(%id == 6)
{
%brick.antiportal = 0;
}
if(%id == 5)
{
%brick.antiportal = 0;
}
else
{
%brick.antiportal = 1;
}
Parent::setColor(%brick, %id)
}
};
Activatepackage(PortalColorMod);

Code: [Select]
package PortalColorMod
{
function fxDtsBrick::onPlant(%brick)
{
if(%brick.getColorID() == 16)
%brick.antiportal = 0;
if(%brick.getColorID() == 6)
%brick.antiportal = 0;
if(%brick.getColorID() == 5)
%brick.antiportal = 0;
else
%brick.antiportal = 1;
Parent::onPlant(%brick);
}

function fxDtsBrick::setColor(%brick, %id)
{
if(%id == 16)
%brick.antiportal = 0;
if(%id == 6)
%brick.antiportal = 0;
if(%id == 5)
%brick.antiportal = 0;
else
%brick.antiportal = 1;
Parent::setColor(%brick, %id);
}
};
activatePackage(PortalColorMod);


Your code, among other things, had syntax errors. It might be helpful to, you know, include that when you post.

Your code, among other things, had syntax errors. It might be helpful to, you know, include that when you post.
I had no idea. I'm new to this, remember?