| Blockland Forums > Suggestions & Requests |
| Items_Potion |
| << < (3/3) |
| Chrono:
--- Quote from: Treynolds416 on July 19, 2012, 11:44:10 PM ---You're having that problem because you're defining a local variable outside the scope of a function. In layman's terms, you're trying to create something that shouldn't exist at a time where it shouldn't exist in a place where it can't exist. You have to include the last three lines of jes' code in the function where the drink is drunk --- End quote --- That's not the problem. When executing a script, all local variables will exist until the end of the script. The actual problem is that when you do obj.dataBlock instead of obj.getDataBlock(), you NEED to make the B capital in dataBlock |
| Mr.Noßody:
New problem (Thanks Chrono for fixing the previous problem): --- Code: ---Loading Add-On: Item_Potion_Green (CRC:-219870240) Executing Add-Ons/Item_Potion_Green/server.cs. Executing Add-Ons/Item_Potion_Green/Item_Green_Potion.cs. Add-Ons/Item_Potion_Green/Item_Green_Potion.cs (0): Unable to find object: '' attempting to call function 'getName' BackTrace: ->SM_StartMission->createServer->onServerCreated->loadAddOns Add-Ons/Item_Potion_Green/Item_Green_Potion.cs (0): Unable to find object: '' attempting to call function 'setDataBlock' BackTrace: ->SM_StartMission->createServer->onServerCreated->loadAddOns Add-Ons/Item_Potion_Green/Item_Green_Potion.cs (0): Unable to find object: '' attempting to call function 'schedule' BackTrace: ->SM_StartMission->createServer->onServerCreated->loadAddOns 3 datablocks added. --- End code --- --- Code: ---Set::add: Object "0" doesn't exist base/server/scripts/allGameScripts.cs (9243): Unable to instantiate non-conobject class . base/server/scripts/allGameScripts.cs (9244): Unable to find object: '0' attempting to call function 'setScale' BackTrace: ->WeaponImage::onFire --- End code --- Top is on loading the add-on, second is on use. I'll attach the script I have here: --- Code: ---datablock ItemData(Green_PotionItem) { category = "Weapon"; // Mission editor category className = "Weapon"; // For inventory system // Basic Item Properties shapeFile = "./Green_Potion.dts"; rotate = false; mass = 1; density = 0.2; elasticity = 0.2; friction = 0.6; emap = true; //gui stuff uiName = "Potion Green (Small)"; iconName = "./GPIcon"; doColorShift = false; // Dynamic properties defined by the scripts image = Green_PotionImage; canDrop = true; }; datablock ShapeBaseImageData(Green_PotionImage) { // Basic Item properties shapeFile = "./Green_Potion.dts"; emap = true; // Specify mount point & offset for 3rd person, and eye offset // for first person rendering. mountPoint = 0; offset = "0 0 0"; eyeOffset = 0; //"0.7 1.2 -0.5"; rotation = eulerToMatrix( "0 0 0" ); className = "WeaponImage"; item = Green_PotionItem; //raise your arm up or not armReady = true; // Initial start up state stateName[0] = "Ready"; stateTransitionOnTriggerDown[0] = "Fire"; stateAllowImageChange[0] = true; stateName[1] = "Fire"; stateTransitionOnTimeout[1] = "Ready"; stateAllowImageChange[1] = true; stateScript[1] = "onFire"; stateTimeoutValue[1] = 1; }; datablock PlayerData(PlayerPotionFasterArmor : PlayerStandardArmor) { maxBackwardSpeed = "5"; maxForwardSpeed = "8"; maxSideSpeed = "7"; maxBackwardCrouchSpeed = "3"; maxForwardCrouchSpeed = "4"; maxSideCrouchSpeed = "3"; maxUnderwaterBackwardSpeed = "8.8"; maxUnderwaterForwardSpeed = "9.4"; maxUnderwaterSideSpeed = "8.8"; maxJumpSpeed = "35"; uiName = ""; }; //When they drink it %oldDataBlock = %player.DataBlock.getName(); %player.setDataBlock("PlayerPotionFasterArmor"); %player.schedule(5000, 0, setDataBlock, %oldDataBlock); --- End code --- |
| Navigation |
| Message Index |
| Previous page |