I had coming this idea for bot names. I wrote this script.
File name: Server.cs
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Bot Names","Tags on","BotNamesOn","bool","BotNames",1,0,1);
}
else
{
$BotNamesOn = 1;
}
datablock StaticShapeData(BotnamesShape)
{
shapeFile = "base/data/shapes/empty.dts";
};
function botnames(%obj,%tag)
{
if($BotNamesOn)
{
if(isObject(%obj))
{
if(!isObject(%tag))
{
error("BOTNAMES: no tag supplied");
}
else
{
%playerpos = %obj.getEyeTransform();
%tag.settransform(%playerpos);
%tag.setShapeName();
schedule(1,0,botnames,%obj,%tag);
}
}
else
{
%tag.delete();
}
}
else
{
%tag.delete();
}
}
function BotnamesHoleBot::onAdd(%this,%obj)
{
armor::onAdd(%this,%obj);
%obj.hIsInfected = 1;
if($BotNamesOn)
{
%tag = new StaticShape()
{
datablock = BotnamesShape;
rotation = "1 0 0 90";
scale = "0.6 5 0.6";
position = %obj.getPosition();
};
}
else
%tag = "";
botnames(%obj,%tag);
}
function fxDtsBrick::onBotSpawn(%obj)
{
%client = %obj.getGroup().client;
$InputTarget_["Bot"] = %obj.hBot;
// $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
%obj.processInputEvent("onBotSpawn", %client);
}
function fxDtsBrick::onBotNames(%brick,%name)
{
if(isObject(%brick.bot))
%brick.bot.SetShapeName(%name);
}
function fxDtsBrick::setBotNameColor(%brick,%r,%g,%b)
{
if(isObject(%brick.bot))
%brick.bot.SetShapeNameColor(%r/255 SPC %g/255 SPC %b/255);
}
registerOutputEvent("fxDTSBrick","setBotName","string 30 100");
registerOutputEvent("fxDTSBrick","setBotNameColor","int 0 255" TAB "int 0 255" TAB "int 0 255");
registerInputEvent("fxDTSBrick", "onBotSpawn", "Self fxDTSBrick" TAB "Bot Bot");// TAB "MiniGame MiniGame"
ERROR from Console Logs:
Loading Add-On: Event_BotNames (CRC:287513776)
Executing Add-Ons/Event_BotNames/server.cs.
Executing Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs.
WARNING: RTBR_ServerControl_Hook.cs has moved. Please alter to use hooks/serverControl.cs -what the forget??? it just moved to other a folder?
1 datablocks added.
Other problem Issues:
1. ShapeName does not showed up, I did tested few time, no luck so far. Maybe I did something missed fix script lines, errors or not work (DUNNO!!!)
2. ShapeName with color does not appear on event onBotSpawn>Bot> (Blank)
Any help would be much appreciated.
EDIT:
I talked to Swollow said: this put shapename mount on Bot's head will less loop and laggy.
%obj.mountObj(%otherObj,1);
%obj.mountObj(%otherObj,3);
I am an idiots about this stuffs. I not know which put line in at?
Something like %obj.mount(BotNameObj,1); ?