Quantcast
Channel: Homeworld Mods and Modding - The Official Gearbox Software Forums
Viewing all 663 articles
Browse latest View live

[SOLVED][GUI] Dropdown lists

$
0
0

@Mikali wrote:

I added some dropdown lists to one of my screens. However, I can’t figure out how to retrieve the values. how do I figure out which list item is selected?

[edit]

Never mind. The function UI_GetDropdownListBoxSelectedCustomDataString does what I need.

[edit]

I can’t figure out how to make a listbox item “selected” by default other than item #1. I can use UI_SelectDropDownListboxItemIndex to set it after the screen is loaded, but can’t figure out how to do so in the screen’s source code.

Posts: 4

Participants: 2

Read full topic


[SCRIPTING] How to check if a ship is disabled or get emp shield value

$
0
0

@EvilleJedi wrote:

I want to be able to add a shader effect when a ship is disabled by EMP, but can’t figure out how to actually determine if a ship is disabled. thoughts?

Posts: 2

Participants: 2

Read full topic

[SOLVED] Custom "generic" Karen SJet lines?

$
0
0

@Dom2 wrote:

It has always bugged me slightly that when you create a new race, you still get Karen’s voice saying “group 1 reports enemy contact”, etc. Is there a way to associate new speech events to a new race?

Posts: 3

Participants: 2

Read full topic

[SOLVED][SCRIPTING] Selected ships group?

$
0
0

@Mikali wrote:

Right now I am iterating through Player_Ships0 to determine whether a ship is selected or not. Is there a simpler way to do this? On a hunch I messed around with MainUI_SelectedShips. It takes a sobgroup as its only parameter, but I wasn’t able to determine what the function actually does. Any ideas? Thanks.

[edit]

I must have made a mistake in my first test. On the second attempt I discovered that MainUI_SelectedShips fills the sobgroup with selected ships exactly like I want it to.

Posts: 4

Participants: 2

Read full topic

[SOLVED][GUI] How to pause the game

$
0
0

@Mikali wrote:

I have a screen that needs the game to pause when activated. I have tried Universe_Pause, but the Pause key on the keyboard always overrides it. Is there a way to disable the Pause key temporarily? Or is there a way to press the Pause key using a script? Thanks.

[edit]

Universe_EnableCmd(0, ePause) is the command I was looking for.

Posts: 3

Participants: 2

Read full topic

[SCRIPTING] Matrix3_GetVector3FromCol

$
0
0

@Mikali wrote:

I’m curious as to what the Matrix3_GetVector3FromCol function does. It takes a 9 item rotation matrix generated using SobGroup_GetCoordSys as input, followed by a number (integer?). It outputs a 3 item table. It’s only used once in Homeworld2.big, and the number (integer?) supplied in that instance is 2.

I’ve been comparing the output to a function I wrote myself called MatrixToEuler that I use to convert the 9 item rotation matrix to Euler rotation angles (degrees).

---------------- 0
test1 = {188.8147808906225, 270.371150272706, 171.1851246310184, }
test2 = {-0.006411552429199219, 4.878733307123184e-006, -0.9999794960021973, }
test1 = {173.1985523604548, 270.2960752906031, 186.8015422346737, }
test2 = {-0.005144715309143066, -3.241788363084197e-006, -0.9999868869781494, }
test1 = {179.427260373988, 78.31424545820225, 179.4832783557769, }
test2 = {-0.2025351524353027, -0.0007705204770900309, 0.9792746305465698, }
test1 = {188.8346554121517, 270.3722031845286, 171.1651943826657, }
test2 = {-0.006417155265808106, 5.88136026635766e-006, -0.9999793767929077, }
test1 = {180.4450021887515, 275.7783503179156, 179.497589778118, }
test2 = {-0.1006773710250855, 0.001041422481648624, -0.994918704032898, }
test1 = {180.4952922548052, 275.3133794663897, 179.4489174624701, }
test2 = {-0.09259819984436035, 0.001010864973068237, -0.9957029819488525, }
test1 = {186.9877122039639, 270.4805128025469, 173.1202109150914, }
test2 = {-0.008342266082763672, -0.00187945319339633, -0.9999635219573975, }
test1 = {180.2054416826993, 275.9009309577368, 179.7411342783645, }
test2 = {-0.102807879447937, 0.0009514261037111282, -0.9947007894515991, }


---------------- 1
test1 = {173.1994064271589, 270.2954136605744, 186.8006706415247, }
test2 = {-0.0006105884676799178, 0.9999998211860657, 1.958978828042746e-007, }
test1 = {180.4490215252623, 275.7783159966638, 179.4975898289904, }
test2 = {0.0008828198770061135, 0.9999992251396179, 0.0008872496546246111, }
test1 = {180.4952900245038, 275.3133794663897, 179.4489172424623, }
test2 = {0.0008906642906367779, 0.9999991655349731, 0.0009324386483058333, }
test1 = {186.4535774251502, 270.4788811305646, 173.5971174804992, }
test2 = {0.0009328959276899695, 0.9999991655349731, -0.0008885897696018219, }
test1 = {180.2054426081985, 275.900864438688, 179.7411281065259, }
test2 = {0.0004645047010853887, 0.999999463558197, 0.0009085778729058802, }
test1 = {184.9421435833924, 270.3679734482871, 175.057785022165, }
test2 = {0.0005532993236556649, 0.9999998211860657, -5.147885531187058e-007, }
test1 = {187.9226324563023, 270.3700943460584, 172.0772756880646, }
test2 = {0.0008922186680138111, 0.9999995827674866, -1.225474989041686e-006, }
test1 = {355.5374739138589, 88.68582201047637, 355.6028652603704, }
test2 = {-0.001758527127094567, 0.9999977946281433, 0.00116139161400497, }


---------------- 2
test1 = {184.9421002581398, 270.3679734482871, 175.0578275440619, }
test2 = {0.9999793767929077, -0.0005550594069063664, -0.006419062614440918, }
test1 = {180.449024801232, 275.7783159966638, 179.497588998159, }
test2 = {0.9949188828468323, -0.0007890170672908425, -0.1006768941879273, }
test1 = {180.4952900245038, 275.3133794663897, 179.4489172424623, }
test2 = {0.9957031011581421, -0.0008004941046237946, -0.09259986877441406, }
test1 = {186.4538292962583, 270.4792895688102, 173.5968603682616, }
test2 = {0.9999650120735169, -0.0009417437249794602, -0.00832521915435791, }
test1 = {180.2054423902984, 275.9008974859, 179.7411284071162, }
test2 = {0.9947012066841126, -0.0003686363925226033, -0.1028084754943848, }
test1 = {188.2200769231642, 270.371150272706, 171.7798245782523, }
test2 = {0.9999790191650391, -0.0009247140260413289, -0.006401181221008301, }
test1 = {173.1990579248786, 270.2954136605744, 186.8010324287363, }
test2 = {0.9999867081642151, 0.0006119778845459223, -0.00513148307800293, }
test1 = {178.4181829147256, 88.25773861595509, 178.4641951958206, }
test2 = {-0.9995377063751221, 0.000839274434838444, -0.03039205074310303, }

“test1” is the output of my own custom function. “test2” is the output of Matrix3_GetVector3FromCol. Each block corresponds to a different number supplied as the second parameter to Matrix3_GetVector3FromCol. I tried 0, 1 and 2.

I’ve been looking at the output and don’t see a correlation. I still can’t see what the function does.

[edit]

Maybe the numbers represent unit vectors pointing in the direction the ships are facing. But what is the integer for?

Posts: 1

Participants: 1

Read full topic

[SOLVED] Access violation caused by level file

$
0
0

@Dom2 wrote:

I have made some changes (quite a few) to the .lua file of a single player mission and I’m now getting an access violation with nothing in the log file (even with -luatrace). How can I start to debug this? Or will I have to revert and reapply the changes step by step to find it?

Posts: 3

Participants: 2

Read full topic

[GUI] Scroll bars

$
0
0

@Mikali wrote:

I have been messing around with “stylesheettestscreen.lua” in order to figure out how a text field with scroll bars works.

However, when I try to scroll, the text in the field is removed and replaced with a number that starts at 0 and increases to 100 as I scroll to the right.

Has anyone figured out how to configure the scroll bars? Also, are there vertical scroll bars too? Thanks!

[edit]

Interestingly, if I add

		onScroll = [[print("bar = " .. %spos)]],

to the scroll bar, it will print these numbers to the log file.

[edit]

A list box might be okay too if I can strip the formatting and sound effects, and make the text wrap.

Posts: 5

Participants: 2

Read full topic


[SOLVED][GUI] Disabling/hiding newtaskbar?

$
0
0

@Mikali wrote:

Is there a way to disable the newtaskbar GUI screen? I tried deleting most of its contents, but get an Access Violation when starting a mission. For my Mission Grid mod, between “missions” I want to design my own GUI and need to at the very least hide the newtaskbar so that it doesn’t interfere. Thanks.

[edit]

I also tried adding

visible = 0,
ignored = 1,

to the root element, but these parameters are ignored.

[edit]

Does the GUI have a Z-Index, so that I can make all screen elements be “below” my custom ones? Is there a way to ensure my GUI stays on “top”?

I could block all the default screens and prevent mouse clicks, but keyboard shortcuts still cause things like the Build menu to pop up on top.

Posts: 3

Participants: 2

Read full topic

[GUI] Visible path finding

$
0
0

@Mikali wrote:

I am trying to figure out how to do path-finding in my Test Mission Grid mod. I want the path to be visible and updated in real-time as you move the mouse around. There are plenty of path-finding routines on the Internet. That is not the problem.

The problem is, how do I show the path to the user in the GUI? Can I use the onUpdate field in the GUI screen? How do I determine the coordinates of the mouse on the screen?

Here is what the map grid looks like currently. There are only 16 cells.

Here is kind of what I want the visible path to look like.

Thanks!

Posts: 3

Participants: 2

Read full topic

[TOOL] Minimum Viable Prototype, framework for persistent campaign production

$
0
0

@EatThePath wrote:

This is a system to allow the rapid creation and testing of extremely simple(Minimum Viable Prototype) campaigns with persistence.

Due to limited time and energy it is presented in a very rough form, the exmaples built for Fulcrum’s context. If I had to clean everything up and put it in a more protable form, it probably owuldn’t ever get released.

An MVP mission consists of a .level file with a few defined spawn points and optionally some harvestable asteroid distributions, and a .lua file with a list of enemy, ally, and player forces to spawn on the map. It has a working semi-hw1 style press button to end mission mechanism once all enemys are dead. Enemies will charge into the player at mission start, and allies will charge into the enemies. There are also values for if you want the player to load a persistant fleet from the previous mission or not, and what to use as their mothership if so. Note that the mothership needs to have parade formation associated with it or the game will crash if you try to load persists.

Some examples have been provided. They’re rough and uncommented. See previous note about time and energy. If anyone ends up taking it upon themselves to make a fancier or cleaner version with examples using stock assets I’d gladly link it from here.

If/when I put this system through its paces myself I’ll probably end up expanding it. I’ll try to share any significant improvements with you folks.


The code within is mine, except Mikail’s map functions, which are included because I use them in the maps. Those are his.

Posts: 2

Participants: 2

Read full topic

Alpha Overlay Help

$
0
0

@880Zero wrote:

I know these exist in game, but how would I go about doing an Alpha overlay? (I.e. transparent background)

Thanks guys!

Posts: 22

Participants: 4

Read full topic

[GUI] Button state style?

$
0
0

@Mikali wrote:

I’m trying to create a version of the “FEButtonStyle1_Outlined_Chipped” menu button that stays lit after being pressed instead of fading back to the original state. Does anyone have any experience with this? I haven’t been able to figure it out.

Posts: 3

Participants: 2

Read full topic

[SCRIPTING] Minimum time interval?

$
0
0

@Mikali wrote:

Is there a minimum time value you can supply to Rule_AddInterval? I am trying to set it to 1/60 of a second, but seem to be getting wrong results. (Or something could be wrong with my script.) Thanks.

The time interval:

timerRuleRate = 1/60

The rule:

function Rule_IncrementTimerMajor()
	currentGameTime = currentGameTime + timerRuleRate
	-- display the current time here
end

Triggering the rule:

Rule_AddInterval("Rule_IncrementTimerMajor", timerRuleRate)

To my eyes it seems the minimum rate is about 1/10.

Posts: 3

Participants: 3

Read full topic

[SCRIPTING] Global time queue

$
0
0

@Mikali wrote:

For my mod, I need to have a queue of commands that are triggered when the game timer reaches certain values. For instance, I have a currentGameTime which keeps track of the current time, in seconds. I also have a queue such as the following:

globalTimeQueue =
{
	{54, "SquadHasArrived(1, 1)",},
	{75, "SquadHasArrived(1, 2)",},
	{128, "SquadHasArrived(1, 3)",},
}

The first number is the time in seconds. The command to execute is stored in a string. In this case one of the commands is SquadHasArrived(1, 3), where 1 is the player index and 3 is the fleet index. The problem is, I might need to go back and remove the command before it is executed and insert a replacement. Is there a good way to accomplish this? Is there a better structure to the global time queue? Thanks!

Posts: 8

Participants: 5

Read full topic


[SCRIPTING] Math help please!

$
0
0

@Mikali wrote:

I created this function by copying a script from here:

function MatrixToEuler(in_matrix)
	-- Adapted from https://www.geometrictools.com/Documentation/EulerAngles.pdf, section 2.1
	local r00 = in_matrix[1]
	local r01 = in_matrix[2]
	local r02 = in_matrix[3]
	local r10 = in_matrix[4]
	local r11 = in_matrix[5]
	local r12 = in_matrix[6]
	local r20 = in_matrix[7]
	local r21 = in_matrix[8]
	local r22 = in_matrix[9]
	local thetaX = 0
	local thetaY = 0
	local thetaZ = 0
	if (r02 < 1) then
		if (r02 > -1) then
			thetaX = atan2(-r12, r22)
			thetaY = asin(r02)
			thetaZ = atan2(-r01, r00)
		else -- r02 = -1
			-- Not a unique solution: thetaZ − thetaX = atan2(r10, r11)
			thetaX = -atan2(r10, r11)
			thetaY = -90
			thetaZ = 0
		end
	else -- r02 = 1
		-- Not a unique solution: thetaZ + thetaX = atan2(r10, r11)
		thetaX = atan2(r10, r11)
		thetaY = 90
		thetaZ = 0
	end
	thetaX = thetaX * -1
	thetaY = thetaY * -1
	thetaZ = thetaZ * -1
	thetaX = mod(thetaX, 360)
	thetaY = mod(thetaY, 360)
	thetaZ = mod(thetaZ, 360)
	if (thetaX < 0) then
		thetaX = thetaX + 360
	end
	if (thetaY < 0) then
		thetaY = thetaY + 360
	end
	if (thetaZ < 0) then
		thetaZ = thetaZ + 360
	end
	return {thetaX, thetaY, thetaZ}
end

I use it to convert the output of the SobGroup_GetCoordSys from a matrix to Euler rotation angles.

However, the PDF file doesn’t show how to do the inverse. E.g. convert Euler angles to a matrix.

I suck at math unfortunately. Could someone figure out how to do this? Thanks!

Posts: 1

Participants: 1

Read full topic

[SCRIPTING] Ship position and transform behavior

$
0
0

@Mikali wrote:

FYI

I used SobGroup_SpawnNewShipInSobGroup() to spawn a ship in a volume at the map origin. Then I tried to move and transform the ship using SobGroup_SetPosition() and SobGroup_SetTransform(). If the move distance was less ~900 units away from the center volume, the latter two functions had no effect. If I moved the ship more than ~900 units away, then everything worked okay.

Strange behavior!

The solution I chose was to put the spawn volume outside the map boundaries.

Posts: 1

Participants: 1

Read full topic

[SCRIPTING] Stop showing build menu for a ship

$
0
0

@Mikali wrote:

In my mod, ships are able to leave the map and travel to different places. However, when a ship leaves in the middle of a mission, it still shows up as a builder in the build menu as if I could build from that ship. Is there a way I could keep the ship from appearing in the build menu, other than destroying it? Thanks.

Posts: 3

Participants: 2

Read full topic

[SOLVED][SCRIPTING] Rules with parameters?

$
0
0

@Mikali wrote:

Currently, my mission scripts look sort of like this:

function OnInit()
	Rule_Add("Rule_Init")
end

function Rule_Init()
	SpawnAllSquads()
	InstadockAllSquads()
	DespawnAllSquads()
	Rule_AddInterval("Rule_WaitAndRespawnAllSquads", 0.1)
end

function Rule_WaitAndRespawnAllSquads()
	RespawnAllSquads()
	Rule_AddInterval("Rule_WaitAndLaunchAllSquads", 9)
	Rule_Remove("Rule_WaitAndRespawnAllSquads")
end

function Rule_WaitAndLaunchAllSquads()
	LaunchAllSquads()
	Rule_Remove("Rule_WaitAndLaunchAllSquads")
end

This works well when I use the script on all ships at the beginning of each mission, and never use it afterward. But what if I want to spawn just one squad of ships somewhere in the middle of a mission? How do I get the rules to handle only the one squad and not all the others? I can’t see a good way to pass an argument to multiple rules. Thanks.

Posts: 11

Participants: 3

Read full topic

[SOLVED][SCRIPTING] Execute code after loading a save game?

$
0
0

@Mikali wrote:

Does anyone know of a way to execute a piece of code after the player loads the game from a save file? I need a screen in my mod to be visible at all times, but the code to display the screen is currently run only at the beginning of a mission.

Posts: 5

Participants: 2

Read full topic

Viewing all 663 articles
Browse latest View live