Author Topic: Event Bot Names [Unsloved]  (Read 1194 times)

I had coming this idea for bot names. I wrote this script.

File name: Server.cs
Code: [Select]
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.
Code: [Select]
%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); ?

« Last Edit: September 03, 2013, 10:19:54 PM by Furling² »

Replace exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs"); with exec("Add-Ons/System_ReturnToBlockland/hooks/serverControl.cs");

Replace exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs"); with exec("Add-Ons/System_ReturnToBlockland/hooks/serverControl.cs");
Thank you!

You registered the event as an fxDTSBrick event in both the registerOutputEvent and the function name... replace it with AIPlayer instead. AIPlayer is the class that bot holes use, not fxDTSBrick.

I think the onBotSpawn event already exists but I'm not sure.

You registered the event as an fxDTSBrick event in both the registerOutputEvent and the function name... replace it with AIPlayer instead. AIPlayer is the class that bot holes use, not fxDTSBrick.

I think the onBotSpawn event already exists but I'm not sure.

It had to be on brick, When use the wrench tool hit the brick to event and make name for bot. Not on AI player.

It had to be on brick, When use the wrench tool hit the brick to event and make name for bot. Not on AI player.

If you're trying to do an event like

onBotSpawn > Bot > setShapeName

then you need to make the function an AIPlayer:: class function and use registerOutputEvent(Bot, blahblahblah

If you're trying to do an event like

onBotSpawn > Bot > setShapeName

then you need to make the function an AIPlayer:: class function and use registerOutputEvent(Bot, blahblahblah
Why not you can use my script and test it.

Why are you overwriting the onBotSpawn event?

Why are you overwriting the onBotSpawn event?
Which it is?