Author Topic: Control Script more problems Observer::onTrigger  (Read 933 times)

When a player becomes controlled these things occur to the controlled player

Code: [Select]
%Target.Camera.setMode("Corpse",%Target.player);
%Target.Controlled = 1;

I need to disable the ability to click while in observer when controlled so I do this

Code: [Select]
package SwollowMain
{
        function Observer::onTrigger(%this,%obj,%trigger,%state)
{
if(%this.Controlled)
{
return;
}
                else
                {
       Parent::onTrigger(%this,%obj,%trigger,%state);
                }
}
};
ActivatePackage("SwollowMain");
but you can still click while in camera mode while controlled
« Last Edit: January 14, 2012, 02:05:57 PM by swollow »

you have to set the control object to their player

you have to set the control object to their player
/facepalm
thanks a lot didn't notice that but that doesn't fix the camera problem?

You set the "Controlled" variable on %target (I assume a client object) then test for it on the Observer datablock.

%Target.Camera.Controlled = 1;
if(%obj.Controlled)

While working on a script, I actually happened to accidentally make an exact match of the observer::ontrigger command.
Code: [Select]
function Observer::onTrigger(%data,%this,%trigger,%val)
{
%this.client = %this.getControllingClient();
if(%trigger == 0 && %val && %this.isOrbitMode())
{
if(isObject(%this.client.player) && %this.client.player.getDamagePercent() < 1.0)
%this.client.setcontrolobject(%this.client.player);
else if(!isObject(%this.client.minigame) || (getSimTime()/1000 > (%this.client.deathTime+%this.client.minigame.respawnTime)/1000))
%this.client.spawnPlayer();
}
}
Pretty sure this is what the default code is. Do whatever you want with it.

The only thing I forgot is that normal players are supposed to have a 1 second respawn time when not in a minigame.

Thanks for all the help I'm glad you guys take time out of your life to help me