Portaling to the center of the map What do you mean by that?
Portaling through objects like bricks?
Portals in portals Are you planning on creating the gun from scratch? I'm fairly certain I could find something in the old pgun that prevented this.
and Floating portals oh stuff.
Did you use a function that makes sure the receiving object is:
NOT a player/bot
NOT a vehicle
By the way, the code that you might use/reference is here:
(I'm tired right now, so I ripped it from the old pgun)for portals being placed on areas that aren't bricks or the map itself:
%class = %col.getClassName();
if(%class !$= "InteriorInstance" && %class !$= "StaticShape" && %class !$= "TSStatic" && %col.getClassName() !$= "fxDTSBrick" && %class !$= "TerrainBlock")
{
portalError(%pos,%obj.originPoint);
return;
}
That's from the projectile's ::OnCollision feature.
It pretty much checks if what the projectile collided with was anything other than:
-The map itself
-A brick
and then the portals in portals thing:
for(%i=0;%i<PortalGunCtrl.getCount();%i++)
{
%portal = PortalGunCtrl.getObject(%i);
if(vectorDist(%portal.position,%pos) < 5 && %portal != %obj.sourceObject.portalOrange)
{
portalError(%pos,%obj.originPoint);
return;
}
}
This is from the orange portal projectile's ::OnCollision code.
It checks if a portal has hit less than 5 units in radius(most players call them studs, i guess. unit = 1x1 brick) away from another portal, and if so, checks if it is NOT an orange portal. If it is a blue portal (basically, a portal that isn't orange), it spawns a portalError at the position of the projectile's collision point. Otherwise, it moves the portal, as seen here:
if(isObject(%obj.sourceObject.portalOrange)){%obj.sourceObject.portalOrange.delete();}
%rot = -(getWord(%normal,1)) SPC -(getWord(%normal,0)) SPC getWord(%normal,2) SPC "90";
%p = new ParticleEmitterNode()
{
datablock = genericEmitterNode;
emitter = PGunOrangePortalEmitter;
scale = "0.1 0.1 0.1";
rotation = %rot;
velocity = "1";
client = %obj.client;
position = vectorAdd(%pos,vectorScale(%normal,0.4));
normal = %normal;
sourceObject = %obj.sourceObject;
colObject = %col;
portalType = "Orange";
};
%obj.sourceObject.portalOrange = %p;
This checks if there's already an orange portal open, and if so, deletes it so another can be created. then it creates an emitter node at the projectile's collision location, and needless to say, a portal.
I mostly explained this in case anybody else couldn't read it. Besides, you learn more from reading if you say it "out loud"(or in this case, type it in English), and that helps me to learn how BL-Torque works a bit more.Probably, you'll need to look at the script more in order to find out what everything equals. This should make a good reference, though.
Hopefully that helps.