| Blockland Forums > Modification Help |
| Control Script more problems Observer::onTrigger |
| (1/2) > >> |
| Swollow:
When a player becomes controlled these things occur to the controlled player --- Code: ---%Target.Camera.setMode("Corpse",%Target.player); %Target.Controlled = 1; --- End code --- I need to disable the ability to click while in observer when controlled so I do this --- Code: ---package SwollowMain { function Observer::onTrigger(%this,%obj,%trigger,%state) { if(%this.Controlled) { return; } else { Parent::onTrigger(%this,%obj,%trigger,%state); } } }; ActivatePackage("SwollowMain"); --- End code --- but you can still click while in camera mode while controlled |
| otto-san:
you have to set the control object to their player |
| Swollow:
--- Quote from: otto-san on January 13, 2012, 11:01:36 PM ---you have to set the control object to their player --- End quote --- /facepalm thanks a lot didn't notice that but that doesn't fix the camera problem? |
| Space Guy:
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) |
| Chrono:
While working on a script, I actually happened to accidentally make an exact match of the observer::ontrigger command. --- Code: --- 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(); } } --- End code --- 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. |
| Navigation |
| Message Index |
| Next page |