change groundcover via script

There are no stupid questions, just stupid answers.
  • 1
  • 4
  • 5
  • 6
  • 7
  • 8
74 posts Page 7 of 8
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Thu Sep 28, 2017 5:22 pm
Hi there,

here an working example of my solution:

https://www.youtube.com/watch?v=-SSio2tMuDA

tutorial will follow ;)


greetz
robert

PS: Can someone Tell me how i make editor commands in play mode? thx!
JeffR
Steering Committee
Steering Committee
Posts: 757
Joined: Tue Feb 03, 2015 9:49 pm
 
by JeffR » Fri Sep 29, 2017 4:31 pm
Haha, yes! Lawnmower Simulator 2017 here we come ;)
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Fri Sep 29, 2017 4:53 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
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Sat Sep 30, 2017 9:28 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
Duion
Posts: 833
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Sat Sep 30, 2017 10:19 pm
In the latest version you can launch the editor in fullscreen, no idea when it was added, but in my game it works.
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Sat Sep 30, 2017 11:33 pm
hi,

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

thanks!

greetz
Robert
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Sun Oct 01, 2017 11:00 am
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
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Mon Oct 02, 2017 8:37 am
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
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
  by subabrain » Mon Oct 02, 2017 2:31 pm
Okay now,

i get it 8-)


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 :roll:


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++ :roll:
subabrain
Posts: 133
Joined: Sat Aug 20, 2016 4:58 pm
 
by subabrain » Tue Oct 03, 2017 9:21 am
Good Morning Guys,

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

there will follow a tutorial soon 8-)

greetings and nice day!
Robert
  • 1
  • 4
  • 5
  • 6
  • 7
  • 8
74 posts Page 7 of 8

Who is online

Users browsing this forum: No registered users and 6 guests