Roads / RoadMain: how to join/link them?

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
SurferIX
Posts: 79
Joined: 10 May 2011, 16:14
Contact:

Roads / RoadMain: how to join/link them?

Post by SurferIX »

In the editor: select the "RoadMain" type (2 => 1 => 1) then go somewhere, click, drag the mouse on a long distance from East to West. Do the same for North to South. You'll get that:

Image

But if you try it by code:

Code: Select all

    RemoveAllBlocksAndTerrain();
    ComputeShadows();
    PlaceBlock(BlockModels["RoadMain"], <0, 17, 2>, ::CardinalDirections::East);
    PlaceBlock(BlockModels["RoadMain"], <1, 17, 2>, ::CardinalDirections::East);
    PlaceBlock(BlockModels["RoadMain"], <2, 17, 2>, ::CardinalDirections::East);
    PlaceBlock(BlockModels["RoadMain"], <3, 17, 2>, ::CardinalDirections::East);
    PlaceBlock(BlockModels["RoadMain"], <4, 17, 2>, ::CardinalDirections::East);

    PlaceBlock(BlockModels["RoadMain"], <2, 17, 0>, ::CardinalDirections::South);
    PlaceBlock(BlockModels["RoadMain"], <2, 17, 1>, ::CardinalDirections::South);
    PlaceBlock(BlockModels["RoadMain"], <2, 17, 2>, ::CardinalDirections::South);
    PlaceBlock(BlockModels["RoadMain"], <2, 17, 3>, ::CardinalDirections::South);
    PlaceBlock(BlockModels["RoadMain"], <2, 17, 4>, ::CardinalDirections::South);

You get that:


Image


Have you any idea/sample code how to join/link RoadMain?
http://olivierpons.fr
Mon dernier framework hautes performances : http://www.papdevis.fr
krial057
Posts: 57
Joined: 13 Nov 2010, 20:15

Re: Roads / RoadMain: how to join/link them?

Post by krial057 »

There is a function named:

Code: Select all

bool PlaceRoadBlocks(CGameCtnBlockInfo BlockModel, uint3 StartCoord, uint3 EndCoord) 
Use it instead of placebolock

Code: Select all

    PlaceRoadBlocks(BlockModels["RoadMain"], <0, 17, 2>,<4, 17, 2>);
    PlaceRoadBlocks(BlockModels["RoadMain"], <2, 17, 0>,<2, 17, 4>);
(Haven't tried it out :roll: )
User avatar
SurferIX
Posts: 79
Joined: 10 May 2011, 16:14
Contact:

Re: Roads / RoadMain: how to join/link them?

Post by SurferIX »

Try it oooooh pleaaaaaaase try it!
I've been asking for it for so long!

It makes TM² leave, it's buggy, and I'd really like to know if it's my own computer or if it comes from TM²!!
http://olivierpons.fr
Mon dernier framework hautes performances : http://www.papdevis.fr
krial057
Posts: 57
Joined: 13 Nov 2010, 20:15

Re: Roads / RoadMain: how to join/link them?

Post by krial057 »

For me, it crashes too :P
It's a really strange bug.
However, I found something out that you can probably use as workaround:
if you place a block by hand in the editor, the function will work and will use the last manually created Block for the road oO
It is really strange, you can even use this to somesort of rixmix blocks! :shock:
Image

Here is how to reproduce it to work:
For your example:
1: in the editor create a roadmain block where you want,
2: delete it again
3: create a new mansiascript with the wollowing lines:

Code: Select all

#RequireContext CGameCtnEditorPluginScriptHandler
PlaceRoadBlocks(BlockModels["RoadMain"], <0, 17, 2>,<4, 17, 2>);
PlaceRoadBlocks(BlockModels["RoadMain"], <2, 17, 0>,<2, 17, 4>);
4: start the script
5: you have your nice crossed road ;)

To create the rixmix example:
1: in the editor create a decoration block, that you can not normally place in the air where you want,
2: delete it again
3: create a new mansiascript with the wollowing lines:

Code: Select all

#RequireContext CGameCtnEditorPluginScriptHandler
PlaceRoadBlocks(BlockModels["RoadMain"], <16, 17, 16>,<16, 17, 16>);
4: start the script
5: you have a tree block with pillars and you can even place other blocks under it ;)

NOTICE: if you try to place the block you want as road with the maniascript function palceBlock, it won't owrk

Good luck with your maze script
Alain
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest