| Blockland Forums > Modification Help |
| onPlant and onRemove errors? |
| (1/3) > >> |
| Greek2me:
I took a piece from Space Guy's TDM code that makes triggers on bricks. Whenever I plant or remove a brick, I get one of these errors: --- Code: ---Add-Ons/Server_VW_Extension/capturepoints.cs (114): Unknown command onPlant. Add-Ons/Server_VW_Extension/capturepoints.cs (129): Unknown command onRemove. --- End code --- I have no idea what's wrong since everything works, the only problem is that it gives an error. Here are the functions it refers to: --- Code: ---function fxDTSBrick::onPlant(%this) { Parent::onPlant(%this); if(%this.dataBlock.isVWCapturePoint) { %this.createTriggerZone(VWcontrolTriggerData); } } function fxDTSBrick::onRemove(%this) { if(%this.dataBlock.isVWCapturePoint) { if(isObject(%this.triggerZone)) { %this.triggerZone.delete(); } } Parent::onRemove(%this); } --- End code --- No, I have not packaged these because whenever I package them, it returns a random syntax error. |
| Kalphiter:
--- Quote from: Greek2me on September 22, 2010, 10:35:02 PM ---No, I have not packaged these because whenever I package them, it returns a random syntax error. --- End quote --- did you did this: packge asdf { }; |
| Greek2me:
Yes, exactly like that. |
| Kalphiter:
Show us the whole package code. |
| Greek2me:
--- Code: ---function fxDTSBrick::onPlant(%this) { Parent::onPlant(%this); if(%this.dataBlock.isVWCapturePoint) { %this.createTriggerZone(VWcontrolTriggerData); } } function fxDTSBrick::onRemove(%this) { if(%this.dataBlock.isVWCapturePoint) { if(isObject(%this.triggerZone)) { %this.triggerZone.delete(); } } Parent::onRemove(%this); } function fxDTSBrick::createTriggerZone(%brick,%triggerData) { if(!isObject(%triggerData)) { error("ERROR: Trigger data \"" @ %triggerData @ "\" does not exist for " @ %this.dataBlock.getName() @ " brick!"); return; } if(%triggerData.getClassName() !$= "TriggerData") { error("ERROR: \"" @ %triggerData @ "\" is not a TriggerData datablock!"); return; } %t = new Trigger() { dataBlock = %triggerData; polyhedron = "0 0 0 1 0 0 0 -1 0 0 0 1"; }; if(!isObject(%t)) { error("ERROR: Could not create trigger for " @ %this.dataBlock.getName() @ " brick!"); return; } missionCleanup.add(%t); //The trigger is made slightly larger than the brick and offset %boxMin = getWords(%brick.getWorldBox(), 0, 2); %boxMax = getWords(%brick.getWorldBox(), 3, 5); %boxDiff = vectorSub(%boxMax, %boxMin); %boxDiff = vectorAdd(%boxDiff, "0 0 0.2"); %t.setScale(%boxDiff); %posA = %brick.getWorldBoxCenter(); %posB = %t.getWorldBoxCenter(); %posDiff = vectorSub(%posA, %posB); %posDiff = vectorAdd(%posDiff, "0 0 0.1"); %t.setTransform(%posDiff); %this.triggerZone = %t; %t.spawnBrick = %brick; } --- End code --- |
| Navigation |
| Message Index |
| Next page |