Blockland Forums > Suggestions & Requests
Items_Potion
Mr.Noßody:
--- Quote from: jes00 on July 19, 2012, 08:10:32 AM ---
--- Code: ---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 ---
--- End quote ---
Oh god, thank you.
Ive been wanting to do this for years.
Cool Boi:
--- Quote from: Mr.Noßody on July 19, 2012, 12:51:09 PM ---Oh god, thank you.
Ive been wanting to do this for years.
--- End quote ---
If you are making this, can I request that you use this model if it isn't any trouble?
http://forum.blockland.us/index.php?topic=155962.0
jes00:
--- Quote from: Mr.Noßody on July 19, 2012, 12:51:09 PM ---Oh god, thank you.
Ive been wanting to do this for years.
--- End quote ---
Umm why didn't you just ask how to do it in Coding Help?
Mr.Noßody:
--- Quote from: jes00 on July 19, 2012, 09:36:59 PM ---Umm why didn't you just ask how to do it in Coding Help?
--- End quote ---
I did. I made a topic and nobody gave me any help.
--- Code: ---Loading Add-On: Item_Potion_Green (CRC:-894162420)
Add-Ons/Item_Potion_Green/Item_Green_Potion.cs Line: 76 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^maxForwardCrouchSpeed = "4";
^maxSideCrouchSpeed = "3";
^maxUnderwaterBackwardSpeed = "8.8";
^maxUnderwaterForwardSpeed = "9.4";
^maxUnderwaterSideSpeed = "8.8";
^maxJumpSpeed = "35";
^uiName = "";
};
//When they drink it
%oldDatablock = %player.datablock.##g##etName();
%player.setDatablock("PlayerPotionFasterArmor");
%player.schedule(5000, 0, setDatablock, %oldDatablock);
};
activatePackage(Green_PotionPackage);
>>> Error report complete.
ADD-ON "Item_Potion_Green" CONTAINS SYNTAX ERRORS
--- End code ---
I'm having this problem. I don't know much about scripting, so how would I use this code?
Treynolds416:
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