Hi! I'm sure i'm breaking the rules of this section as i'm asking for a code. Sorry.... I've attached an image and i want to know or get sample code on how do i do that? Any help would be appreciated! Thank you very much!
Can i have a link to the particles or sample code? I don't have any on my mind and i tried to refer Walking Particles but the plugin doesnt even exist on GitHub.
Link to walking particles: (or UltimateParticles as it got called later) https://github.com/hoyinm14mc/UltimateParticles Link to the particle: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/level/particle/DustParticle.php As you can see in the constructor you need a red, blue and green value for dust particles. That is what you're after.
Try this, I am unsure that it will work since I wrote it on my phone. =P PHP: $colours = [[255, 255, 255],[255, 255, 255]];$colourCount = count($colours);$height = 1;//height in blocks$length = 3;//length in blocks$step = 0;$hpc = ($height / count($colours));//height per colourfor($yy = 0; yy <= $height; $yy += $hpc){ for($zz = 0; $zz <= $length; ++$zz){ $pos = clone $somePlayer->getPosition (); $pos->y += $yy; $pos->z += $zz; if($step > $colourCount){ $step = 0; } $somePlayer->level->addParticle(new \pocketmine\level\particle\DustParticle($pos, $colours[$step][0], $colours[$step][1], $colours[$step][2]));}}
Colour codes from this website. Format: new DustParticle(Vector3, r, g, b) Probably the worst way, but ye.. PHP: /** @var Level $level *//** @var Vector3 $pos */$red = new DustParticle($pos->add(0, 2.5), 252, 17, 17);$orange = new DustParticle($pos->add(0, 2.1), 252, 135, 17);$yellow = new DustParticle($pos->add(0, 1.7), 252, 252, 17);$green = new DustParticle($pos->add(0, 1.3), 17, 252, 17);$lblue = new DustParticle($pos->add(0, 0.9), 94, 94, 252);$dblue = new DustParticle($pos->add(0, 0.5), 17, 17, 252);foreach ([$red, $orange, $yellow, $green, $lblue, $dblue] as $particle) { $level->addParticle($particle);}
i think you need to add them using a repeated task note there a difference between asking for code OR asking for a direction to be pointed toward
@Muqsit How do i make the particles go higher and become more visible? PHP: <?php/* * Copyright (C) 2017 RTG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */namespace RTG\SP;/* Essentials */use pocketmine\plugin\PluginBase;use pocketmine\math\Vector3;use pocketmine\level\Level;use pocketmine\level\particle\DustParticle;use pocketmine\level\particle\FlameParticle;use pocketmine\Player;use pocketmine\Server;use pocketmine\event\Listener;class Loader extends PluginBase implements Listener { public $list; public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->list = array(); $this->getServer()->getScheduler()->scheduleRepeatingTask(new SPTask($this), 5); } public function onParticles(Player $p) { if(isset($this->list[strtolower($p->getName())])) { $x = $p->getX(); $y = $p->getY(); $z = $p->getZ(); $red = new DustParticle(new Vector3($x, $y, $z), 252, 17, 17); $green = new DustParticle(new Vector3($x, $y, $z), 102, 153, 102); $flame = new FlameParticle(new Vector3($x, $y, $z)); $level = $p->getLevel(); foreach([$red, $green, $flame] as $particle) { $level->addParticle($particle); } } } public function onCommand(\pocketmine\command\CommandSender $sender, \pocketmine\command\Command $command, $label, array $args) { switch(strtolower($command->getName())) { case "sp": if($sender->hasPermission("sp.spawn")) { if(isset($args[0])) { switch(strtolower($args[0])) { case "enable": if(isset($this->list[strtolower($sender->getName())])) { unset($this->list[strtolower($sender->getName())]); $sender->sendMessage("SP Disabled!"); } else { $this->list[strtolower($sender->getName())] = strtolower($sender->getName()); $sender->sendMessage("SP Enabled!"); } } } } } } public function onDisable() { } }
PHP: $pos = $player->getPosition();$red = new DustParticle($pos->add(0, 2.5), 252, 17, 17);$orange = new DustParticle($pos->add(0, 2.1), 252, 135, 17);$yellow = new DustParticle($pos->add(0, 1.7), 252, 252, 17);$green = new DustParticle($pos->add(0, 1.3), 17, 252, 17);$lblue = new DustParticle($pos->add(0, 0.9), 94, 94, 252);$dblue = new DustParticle($pos->add(0, 0.5), 17, 17, 252);foreach ([$red, $orange, $yellow, $green, $lblue, $dblue] as $particle) { $pos->getLevel()->addParticle($particle);}
It doesn't work [Server] [11:35:55] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '.5' (T_DNUMBER), expecting ',' or ')'" (EXCEPTION) in "/Core (1)/src/StuckDexter/Core" at line 3405 [Server] [11:35:55] [Server thread/EMERGENCY]: An unrecoverable error has occurred and the server has crashed. Creating a crash dump [Server] [11:35:55] [Server thread/EMERGENCY]: Please upload the "/storage/emulated/0/PocketMine/crashdumps/Sat_Apr_22-11.35.55-UTC_2017.log" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.