Page 5 of 7

Re: Mood is a thing for

Posted: 22 Feb 2012, 00:54
by PicassoCT
yep, 29 years long... surely, if you give me another year, i can get all grown up and serious buisnessmeni


ZogOP, would you be okay, if i ported your sandworm afterwards to Behes Melange? The Spice must flow, no matter if there are worms in it..

Re: Mood is a thing for

Posted: 22 Feb 2012, 02:54
by zoggop
PicassoCT wrote:ZogOP, would you be okay, if i ported your sandworm afterwards to Behes Melange? The Spice must flow, no matter if there are worms in it..
I'm all for the flow. How can I call your swallow function with my gadget? (so continues moment of slippage) But really though, should I just put swallow in a TransportPickup callin, or is it possible to explicitly call script functions from within a gadget?

edit: i'm an idiot, i need to fix the unitdef

Re: Mood is a thing for

Posted: 22 Feb 2012, 20:27
by PicassoCT
Are we there, dad?

No, wait, that doesent fit the situation.
IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!
........................................................................................................................IS IT DONE YET, ZOGGOP?!IS IT
........................................................................................................................DONE YET, ZOGGOP?!IS IT DONE YET,
........................................................................................................................ZOGGOP?!IS IT DONE YET,
........................................................................................................................ZOGGOP?!IS IT DONE YET,
........................................................................................................................ZOGGOP?!IS IT DONE YET,
........................................................................................................................ ZOGGOP?!IS IT DONE YET,
........................................................................................................................ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!
IS IT DONE YET, ZOGGOP?!IS IT DONE
YET, ZOGGOP?!IS IT DONE YET,
ZOGGOP?!IS IT DONE YET, ZOGGOP?!
IS IT DONE YET, ZOGGOP?!IS IT DONE
YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!
IS IT DONE YET, ZOGGOP?!IS IT DONE
YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!
IS IT DONE YET, ZOGGOP?!IS IT DONE
YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?! IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!IS IT DONE YET, ZOGGOP?!


....................................................................... IS IT DONE YET, ZOGGOP?!
.......................................................................IS IT DONE YET, ZOGGOP?!
....................................................................... IS IT DONE YET, ZOGGOP?!

Re: Mood is a thing for

Posted: 22 Feb 2012, 23:45
by zoggop
No. Waiting is good for you. It builds character.

The unit script doesn't seem to be getting used (and I should hope it likes to get used).

Code: Select all

[f=0000000] Loading gadget: Lua unit script framework  <unit_script.lua>
[f=0000000]   Loading unit script: scripts/emergesworm.lua
^ this happens, yet every time I create a unit:

Code: Select all

[f=0003600] Warning: Could not load COB script for unit "emergesworm" from: scripts/emergesworm.cob
Why is Spring looking for the COB script at all, if it found the lua script?

(emergesworm is your unit renamed, which I did for a reason, but I forgot)

Re: Mood is a thing for

Posted: 22 Feb 2012, 23:59
by PicassoCT
did you tell it in the unitdef to look for the script?
something like

script= NameItlikeyouwant.lua,

Re: Mood is a thing for

Posted: 23 Feb 2012, 00:22
by smoth
you have to specify .lua for lua unit scripts..

so script = wagarble.lua

Re: Mood is a thing for

Posted: 23 Feb 2012, 06:16
by zoggop
IS IT DONE YET, ZOGGOP?!
Not really, but it like, does something now, and stuff. It has a 50% chance (plus 1% for every unit on the sand) to randomly eat a unit on the sand, and does so. Since you're practically jumping up and down, here's what I have so far, which is kind of lame, and causes segfaults with some AIs. I'm guessing I'll have something cooler with wormsign etc in about a week, following my omg-new-thing/who-gives-a-fuck/sucked-back-in cycle.

Re: Mood is a thing for

Posted: 26 Feb 2012, 21:15
by zoggop
The worm movement lua all works, and I made a worm sign lightning effect. I'd show screenshots, but, it's lightning, so I can't really time a screenshot right. What still doesn't work is AttachUnit. I've tried putting this immediately after creating Picasso's swallowing worm unit:

Code: Select all

Spring.UnitScript.CallAsUnit(attackerID, Spring.UnitScript.AttachUnit, 10, targetID)
(worm is attackerID)
I've also tried putting the AttachUnit call in the unit script:

Code: Select all

Spring.UnitScript.AttachUnit(foodmagnet, idUnitToBeSwallowed)
at the top of the swallow function, which is called by:

Code: Select all

function script.Create()

--move the worm into the position underground
Move(center,y_axis,-230,0) --Moves the worm underground Instantanously
Spin(center,y_axis,0.02,1) -- worm rotates slowly

local x,y,z = Spring.GetUnitPosition (unitID)

if (x and y and z) then
	local nearunits=Spring.GetUnitsInSphere  (x,y,z, 32) or "nothing"
	if (nearunits~="nothing") then		
		for _, nearunitid in ipairs (nearunits) do
			if (nearunitid~=unitID) then
				swallow(nearunitid)
				break
			end
		end
	end
end

end
(interestingly, simply calling AttachUnit rather than Spring.UnitScript.AttachUnit in the script results in an attempt to call a nil global error)

Both methods don't attach anything. The unit being swallowed runs away, and then disappears when swallow() destroys it.

Any suggestions?

Re: Mood is a thing for

Posted: 26 Feb 2012, 22:18
by FLOZi
AttachUnit will only work if the unit calling it has the transportCapacity tag
simply calling AttachUnit rather than Spring.UnitScript.AttachUnit in the script results in an attempt to call a nil global error
This is because AttachUnit is not localised in the default unit script header ( https://github.com/spring/spring/blob/m ... header.lua ), due to it not being used in most scripts and there being a limited number of locals in a lua script, iirc.

Re: Mood is a thing for

Posted: 26 Feb 2012, 23:07
by zoggop
FLOZi wrote:AttachUnit will only work if the unit calling it has the transportCapacity tag
from the worm's unitdefs:

Code: Select all

isTransport = true,
loadingRadius = 512,
transportCapacity = 10,
transportMass = 50000,
transportSize = 10000,

Re: Mood is a thing for

Posted: 27 Feb 2012, 00:42
by PicassoCT
Well.. the runaway is easily fixxed.. by setting the units acceleration to zero.

http://code.google.com/p/zero-k/source/ ... arch+Trunk

unit that loads another unit..

Re: Mood is a thing for

Posted: 27 Feb 2012, 07:39
by zoggop
have been fiddling with the unitdef per zK's armtboat. still can't get it to attach to anything. is there some kind of uberverbose engine mode that would tell me something helpful like "AttachUnit() not allowed because ____"? or is that pie in the sky?

Re: Mood is a thing for

Posted: 27 Feb 2012, 11:07
by PicassoCT
lets handle this systematic, like a doctor cutting of slices of patient until the guy can be delcared healthy.

Obviously the unitdef. Some of those keywords trigger magic chainreactions, leading to other keywords beeing ignored. If you say its a boat, maxfleightheight will be ignored. So coment everything in there out, that isnt absolutly needed.

Next post infolog.

Re: Mood is a thing for

Posted: 27 Feb 2012, 21:37
by zoggop
good idea
let the culling begin

Re: Mood is a thing for

Posted: 27 Feb 2012, 22:19
by zoggop
whole damned unitdef:

Code: Select all

return {
	sworm = {
		blocking = false,
		canmove = true,
		description = "Giant hungry beast.",
		footprintx = 6,
		footprintz = 6,
--		holdSteady = true,
		isFirePlatform = true,
--		isTransport = true,
		levelGround = false,
--		loadingRadius = 256,
		maxdamage = 9999,
		name = "Sand Worm",
		objectname = "sWorm.s3o",
		script = [[sWorm.lua]],
--		transmaxunits = [[10]],
		transportCapacity = 100,
  		transportMass = 50000,
-- 		transportSize = 10000,
		customParams = {
 			ignoreplacementrestriction = true,
		},
	},
}
will not attach. waiting for the other doctor to come take the paddles out of my hands and tell me that his pulse stopped ten minutes ago.

edit: here is infolog, but it's not terribly helpful, and mostly full of debug info from the sand worm gadget.

Re: Mood is a thing for

Posted: 27 Feb 2012, 23:22
by FLOZi
This is for a map right? What game are you testing? There are some limits to prevent loading enemy units, though I would have thought directly AttachUnit'ing the id should work.

Re: Mood is a thing for

Posted: 28 Feb 2012, 00:32
by zoggop
Right, the prevention of loading enemy units is why I'm not making the worm actually a transport and giving it load unit commands. I thought the AttachUnit thing would work because it worked for knorke's magnetic BA, which is what I used to tell me what unitdef parameters to use (magnetic BA has a thing that posts to the unitdefs before the game somehow), and how to attach units. The game I'm testing is BA 7.63.

edit: wait, the magnetic thing was only done on friendly units. maybe the no enemy unit loading test is done at an AttachUnit level? But I guess I thought in BA most units are nappable anyway. Well, to continue thinking out loud, I'll make the worms spawn on the same team as the unit they're eating, see what happens.

Re: Mood is a thing for

Posted: 28 Feb 2012, 00:46
by Beherith
Ill gladly add an exception to no load enemy units to gaia units if you need me to.

Re: Mood is a thing for

Posted: 28 Feb 2012, 00:56
by PicassoCT
zoggop wrote:Right, the prevention of loading enemy units is why I'm not making the worm actually a transport and giving it load unit commands. I thought the AttachUnit thing would work because it worked for knorke's magnetic BA, which is what I used to tell me what unitdef parameters to use (magnetic BA has a thing that posts to the unitdefs before the game somehow), and how to attach units. The game I'm testing is BA 7.63.

edit: wait, the magnetic thing was only done on friendly units. maybe the no enemy unit loading test is done at an AttachUnit level? But I guess I thought in BA most units are nappable anyway. Well, to continue thinking out loud, I'll make the worms spawn on the same team as the unit they're eating, see what happens.
knorkes magnetic mod loaded enemys and friendlys.. resulting in funny towerdefense infights.. and a full wormstomage is a full wormstomage.. shall god sort out his own..


Spring.UnitScript.AttachUnit ( piece, passengerID )
should work with transport.

Re: Mood is a thing for

Posted: 28 Feb 2012, 08:13
by zoggop
Beherith wrote:Ill gladly add an exception to no load enemy units to gaia units if you need me to.
Thanks, but it seems that the unit's team wasn't the problem.
Spring.UnitScript.AttachUnit ( piece, passengerID )
should work with transport.
I agree, but um...