change groundcover via script

There are no stupid questions, just stupid answers.
• 1
• 4
• 5
• 6
• 7
• 8

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

Hi there,

here an working example of my solution:

tutorial will follow

greetz
robert

PS: Can someone Tell me how i make editor commands in play mode? thx!

Re: change groundcover via script

JeffR
Steering Committee
Posts: 932
Joined: Tue Feb 03, 2015 9:49 pm

Haha, yes! Lawnmower Simulator 2017 here we come

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

yes this should do it

but it only works in the terraineditor :/

maybe someone could help me ... would be very nice 8)

greetings
Robert

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

Hi Guys,

to make the thing simple - i need to make fullscreen mode in terraineditor.
it would be great if you can answer

greetings
Robert

Re: change groundcover via script

Duion
Posts: 1362
Joined: Sun Feb 08, 2015 1:51 am

In the latest version you can launch the editor in fullscreen, no idea when it was added, but in my game it works.

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

hi,

thanks for your answer but i need the editor without any window ...
please tell me how you do it

thanks!

greetz
Robert

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

Hi there,

i just want to say that i will take a while till my tut is ready because i have Problems to reproduce it with several versions of t3d ...

but im working on the problem

greetings and nice sunday!
Robert

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

Hi Guys,

sorry for the amount of posts here but i have a problem with my solution - now i try it directly with the grid functions of t3d

please be patient - it takes a little bit ^^

have a nice day!
Robert

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

Okay now,

i get it

So for change the groundcover (here the terrain Material which can layered by Groundcover) from torquescript do the following (without c++):

go to the file "EditorGui.ed.gui" in the folder "tools/worldEditor/gui" and change the line:
processUsesBrush = "0";
into
processUsesBrush = "1";
then go to "scripts/server/" and create a File - name it "grass.cs" with the following content:
function grass(%this) {

//Make the size of the brush
ETerrainEditor.setBrushSize(2, 2);

//Set the Shape of the brush
ETerrainEditor.setBrushType("box");

//Change "grass1" to the material you like
%matIndex = ETerrainEditor.getMaterialIndex( "grass1" );

//Change "test" to a terrain id you like
ETerrainEditor.setPaintMaterial(%matIndex, "test");

//%curPos = LocalClientConnection.Player.getPosition();

//%x = getword(%curPos, 0);
//%y = getword(%curPos, 1);
//%pZ = getword(%trans, 2);

//ETerrainEditor.processAction(%pX, %pY, %pZ, "paintMaterial");

//ETerrainEditor.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y);

//Run the thing
ETerrainEditor.processAction("paintMaterial");
//\$eventID = schedule(230,0,grass);

}
please recognize that the Comments are important for make the brush pos to the player ...

Then add a entry in "scriptExec.cs" with the folder "scripts/server/" somewhere in the file:
...
exec("./grass.cs");
...
Okay now you can add a material texture with run the command "grass();"
in the console (can be opened with "^" in game).

There is a thing to get the Ground of the Player to be changed ->

From C++ it works with some arguments...

But it should do it also with the TorqueScript -> therefore is a function:
%curPos = LocalClientConnection.Player.getPosition();

%x = getword(%curPos, 0);
%y = getword(%curPos, 1);
//%pZ = getword(%trans, 2);

ETerrainEditor.setBrushPos(getWord(%curPos, 0) + %x, getWord(%curPos, 1) + %y);
But its not working in my case :/

I get the following error:
scripts/server/grass.cs (19): ETerrainEditor::setBrushPos - wrong number of arguments (got 4, expected min 3 and max 3).
maybe someone could help me here

but thats the way how to do it without C++

Greetings
Robert

PS: As soon as it works perfect ill make a bigger tutorial - but i think im not getting it without c++

Re: change groundcover via script

subabrain
Posts: 194
Joined: Sat Aug 20, 2016 4:58 pm

Good Morning Guys,

EDIT: i will do it with the processAction method (like shown before)

there will follow a tutorial soon

greetings and nice day!
Robert
• 1
• 4
• 5
• 6
• 7
• 8

Who is online

Users browsing this forum: Google [Bot] and 5 guests