| Blockland Forums > Suggestions & Requests |
| [Request] Infinite items |
| (1/7) > >> |
| Demian:
I'm in need of a script for private use that allows you to use items infinite times. For example the HE grenade, pill, etc. So when you use the pill, it wont be removed from your inventory. If this something that can be changed/added to the item's script, I can do it myself if someone provides me with the script. I can't script for stuff. |
| lordician:
Firing code of the HE grenade: --- Code: ---function hegrenadeImage::onFire(%this, %obj, %slot) { %obj.playthread(2, spearThrow); Parent::OnFire(%this, %obj, %slot); %currSlot = %obj.lastHESlot; %obj.tool[%currSlot] = 0; %obj.weaponCount--; messageClient(%obj.client,'MsgItemPickup','',%currSlot,0); serverCmdUnUseTool(%obj.client); } --- End code --- With an external script you can overwrite that function: --- Code: ---package HEGrenadeOverwritePackage { function hegrenadeImage::onFire(%this, %obj, %slot) { %obj.playthread(2, spearThrow); Parent::OnFire(%this, %obj, %slot); } } activatePackage(HEGrenadePackage); --- End code --- As far as i know, that should do the trick. |
| Demian:
--- Code: ---Loading Add-On: Weapon_HEGrenadeInf Add-Ons/Weapon_HEGrenadeInf/Weapon_HEGrenadeInf.cs Line: 522 - Syntax error. >>> Some error context, with ## on sides of error halt: textureName = "Add-Ons/Weapon_HEGrenade/icon_hegrenade"; }; package heGrenadeOverwritePackage { ^function hegrenadeImage::onFire(%this, %obj, %slot) ^{ ^^%obj.playthread(2, spearThrow); ^^Parent::OnFire(%this, %obj, %slot); ^} } activatePackage(##h##eGrenadeOverwritePackage); >>> Error report complete. ADD-ON "Weapon_HEGrenadeInf" CONTAINS SYNTAX ERRORS --- End code --- |
| lordician:
Oh dear, i forgot to check it fully it seems. D: Add a ; at the last } So that will be: --- Code: ---package HEGrenadeOverwritePackage { function hegrenadeImage::onFire(%this, %obj, %slot) { %obj.playthread(2, spearThrow); Parent::OnFire(%this, %obj, %slot); } }; activatePackage(HEGrenadeOverwritePackage); --- End code --- Again my apologies for this. If you run into more trouble, just post. WAIT FOR IT, rechecking, i believe i posted it wrong. You fixed it allready in your first run. I checked it, but it seems i have overseen something in the script... Because i keep getting the HEgrenade after i throwed it. My inventory gets spammed all of sudden. I will look again, sorry. |
| Demian:
Well, the script executes and the item works. But I still can use it only once. I want infinite HE Grenades. =( |
| Navigation |
| Message Index |
| Next page |