help about a gate

help about a gate

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

help about a gate

Post by daryl »

hello all,
i have a small problem about this gate : in unitdef yard map="oo oo cc cc cc cc cc cc oo oo" so you can see in the picture tha passing is open but units can't pass trought the gate.
Where i wrong?
Attachments
gate.jpg
(51.35 KiB) Not downloaded yet
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: help about a gate

Post by PicassoCT »

Did you set the unit yardstance, when turning it on and off?
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: help about a gate

Post by daryl »

in .cob script you mean?
i have this code:

Code: Select all

OpenYard()
{
	set YARD_OPEN to 1;
	while( !get YARD_OPEN )
	{
		sleep 1500;
		set YARD_OPEN to 1;
	}

}

CloseYard()
{
	set YARD_OPEN to 0;
	while( get YARD_OPEN )
	{

		sleep 1500;
		set YARD_OPEN to 0;
	}

}
DmitryProfessional
Posts: 20
Joined: 03 Jun 2019, 21:06

Re: help about a gate

Post by DmitryProfessional »

What's the size of a unit?
If the yard is "oo oo cc cc cc cc cc cc oo oo", it's either 1x20 or, most likely:
oooo
cccc
cccc
cccc
oooo
Which orientation doesn't make much sense. If it's a North gate, it should open/close to north, correct?
Use [[ ]] for things like yard instead of "", e.g.
[[o c c c o
o c c c o
o c c c o
o c c c o
o c c c o]]
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: help about a gate

Post by Forboding Angel »

If the yard is "oo oo cc cc cc cc cc cc oo oo", it's either 1x20
No. Top to bottom left to right punctuated by spaces.

"oo oo cc cc cc cc cc cc oo oo", is:
2 block, 2 block, 2 open, 2 open, 2 open, 2 open, 2 open, 2 open, 2 block, 2 block
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: help about a gate

Post by PicassoCT »

creed wrote:With yards wide open under the sunlight
Welcome to this place I'll show you everything
With yards wide open now everything has changed
I'll show you love, I'll show you everything

With yards wide open
Wide open
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: help about a gate

Post by daryl »

Forboding Angel wrote: 28 Oct 2019, 11:33
If the yard is "oo oo cc cc cc cc cc cc oo oo", it's either 1x20
No. Top to bottom left to right punctuated by spaces.

"oo oo cc cc cc cc cc cc oo oo", is:
2 block, 2 block, 2 open, 2 open, 2 open, 2 open, 2 open, 2 open, 2 block, 2 block
and yardmap of gate is correct:
footprintx = 2,
footprintz = 10,
YardMap= "oo oo cc cc cc cc cc cc oo oo",
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: help about a gate

Post by Forboding Angel »

That's what I just said. Your example was incorrect, depicting a 4xX footprint, instead of the intended 2xX footprint.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: help about a gate

Post by FLOZi »

Is the intended orientation north/south opening or east/west?
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: help about a gate

Post by daryl »

FLOZi wrote: 29 Oct 2019, 17:14 Is the intended orientation north/south opening or east/west?
east/west
DmitryProfessional
Posts: 20
Joined: 03 Jun 2019, 21:06

Re: help about a gate

Post by DmitryProfessional »

How do u call Open/CloseYard? Should be from Activate/Deactivate callin.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: help about a gate

Post by Forboding Angel »

So, from what I see in that screenshot, it appears that the yardmap is correct. The gateway is non-blocking it looks like. Perhaps without new orders the pathfinder isn't realizing that it can go through (Clutching at straws)?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: help about a gate

Post by FLOZi »

Derp, I totally missed the screenshot. Yeah yardmap is fine, and is open/closing ok too.

If I were you I'd use a lua unit script instead of cob and call Spring.SetUnitBlocking... MCL used to have gates and they worked that way;

https://github.com/SpringMCLegacy/Sprin ... s/Gate.lua
Post Reply

Return to “Lua Scripts”