Page 56 of 59
Re: Mod Question Repository... Questions come in, answers go out
Posted: 26 Sep 2010, 23:49
by bobthedinosaur
Here is KDR's toggle gadget. It works great.
http://sl.pastebin.com/faC7aVHL
Lookes like this in unit files:
Code: Select all
toggle1 = 3,
toggle1a = [[Option 1a]],
toggle1b = [[Option 1b]],
toggle1c = [[Option 1c]],
toggle1tooltip = [[1st Options]],
toggle2 = 2,
toggle2a = [[Option 2a]],
toggle2b = [[Option 2b]],
toggle2tooltip = [[2nd Option]],
toggle3 = 1,
toggle3a = [[Super D Gun]],
toggle3tooltip = [[Fires super Dgun]],
and this in the cob:
Code: Select all
(t,value)
{
if(t==1)
{
if(value==0)
{
opt1= 1; //can really do anything here this just means the toggle settings a,b,c where a =0, b=1, c=2. Value is set to 0 when unit is created
e }
if(value==1)
{
opt1= 2; //this is what well be slected the 1st time you hit the switch
}
if(value==2)
{
opt1= 3;
}
}
if(t==2)
{
if(value==0)
{
opt2 = 1;
}
if(value==1)
{
opt2 = 2;
}
}
if(t==3)
{
if(value==0 )
{
superdgun = true;
}
}
}
Now, back to bitching about units stopping to push instead of pushing and continuing to move. Are there any hacks around this?
Re: Mod Question Repository... Questions come in, answers go out
Posted: 05 Oct 2010, 16:57
by KingRaptor
Is it me or can you not use gadget callins within a Lua unit script?
Re: Mod Question Repository... Questions come in, answers go out
Posted: 10 Oct 2010, 19:59
by bobthedinosaur
if I wanted to make a weapon only fire past a minimum range could I use GET SET_WEAPON_GROUND_TARGET weaponID xzCoord yCoord userTarget to find the targets range?
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 01:45
by FireStorm_
bobthedinosaur wrote:if I wanted to make a weapon only fire past a minimum range could I use GET SET_WEAPON_GROUND_TARGET weaponID xzCoord yCoord userTarget to find the targets range?
I'm probably misunderstanding but how about you just moving the flare-point, by witch i mean the origin of the weapon projectile?
On a completely different note:
Of all the problems I've encountered trying making a spring game, i believe this is a new one.
the texture works fine on a different unit, and is 'properly flipped'
The texture is mostly team colour, but that can't be it, right? Works for Fibre if i recall correctly.
Anyone any ideas why my unit is black but transparent for trees?
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 02:51
by bobthedinosaur
probably bad model radius, check the hitsphere radius in upspring, if it is okay, then try adjusting the normals.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 03:52
by Pressure Line
id just use a fake weapon slaved to the weapon with the minimum range set to what you want the minimum range to be, and use CHANGE_TARGET and/or BlockShotX to get the desired result.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 04:26
by bobthedinosaur
since it was a ballistic i just limited the gun elevation. that seems to work.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 11:19
by FireStorm_
bobthedinosaur wrote:probably bad model radius, check the hitsphere radius in upspring, if it is okay, then try adjusting the normals.
I feel a bit silly. Guess I was to tired to check basic stuff. But in any case:

Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 14:19
by knorke
Planet Express!
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 18:19
by FireStorm_
Ha ha, yes, kinda... I didn't noticed yet. Although I did worry about things not looking to Simpsons-like.
I guess this will be my favourite team colour, though.

Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 19:21
by bobthedinosaur
Cute ship. It would be some work but maybe you could have units stroll down the ramp with an invisible attachment arm.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 19:40
by FireStorm_
Going a bit of topic but I promise i won't derail the Mod Question Repository any further after this post.
I didn't want to share my ideas already, because i don't have all the answers yet to questions that may arise in the community/on the forum, but the unit was already supposed to have a mechanical arm, with a resource reclamation device at the end.
Large Image
Re: Mod Question Repository... Questions come in, answers go out
Posted: 17 Oct 2010, 19:48
by FireStorm_
bobthedinosaur wrote:invisible
Oh, wait i misunderstood. But yes, that is worth considering, perhaps also possible using Lua MoveCtrl stuff.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 18 Oct 2010, 08:18
by bobthedinosaur
What is the easiest way to send a mod option variable to a specific unittype's cob?
Re: Mod Question Repository... Questions come in, answers go out
Posted: 20 Oct 2010, 02:11
by Wombat
question - is it possible to 'apply' unit limit to concrete type of unit ? like, lets say, u can have only 2 peewees alive at the same moment ? lua im right ?
Re: Mod Question Repository... Questions come in, answers go out
Posted: 20 Oct 2010, 06:38
by SanadaUjiosan
If you're asking what I think you're asking, it's a tag in the unit def:
If you're asking something else, I'm not sure.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 21 Oct 2010, 12:31
by FireStorm_
I really just need to be sure, and feel it would take a lot of time if I had to accomplish that myself. So hopefully a question will solve it:
(To specify, this is about a Lua Unit script.)
About Signals and Signalmasks, callouts to mark and kill a running tread.
Spring.UnitScript.SetSignalMask ( number mask ) -> nil
Spring.UnitScript.Signal ( number signal ) -> nil
When i look at example scripts, I see the same typical names in all of them, for instance, "SIG_BUILD".
Is there is reason for this consistency? Or would the following work as well? :
Code: Select all
local function my_script()
SetSignalMask( a_custom_signal_to_kill_the_myscript_tread )
Signal( a_custom_signal_to_kill_the_myscript_tread )
Spring.Echo('Executing my script')
end
(hope I encounter some noob-friendliness

)
Re: Mod Question Repository... Questions come in, answers go out
Posted: 21 Oct 2010, 13:38
by Argh
What is the easiest way to send a mod option variable to a specific unittype's cob?
Read the mod option, then call a script in the Unit, sending it the data it needs as a parameter:
Code: Select all
Spring.CallCOBScript(u, "ComScript", 0,X)
Where X is whatever you need to communicate.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 21 Oct 2010, 13:51
by zwzsg
The name of the signal doesn't matter at all. However it's very important that each signal is a power of 2 distinct from other signals (Do you speak binary? Ever worked with bitfields?)
Code: Select all
local function my_script()
SetSignalMask( a_custom_signal_to_kill_the_myscript_tread )
Signal( a_custom_signal_to_kill_the_myscript_tread )
Spring.Echo('Executing my script')
end
You inverted Signal and SetSignalMask. You want to kill previous instance of my_script, not yourself! And don't forget to assign some 2^n number to a_custom_signal_to_kill_the_myscript_tread.
Then what I'm saying is from Cob, I assume it's the same for Lua unit scripts but I never tried.
Re: Mod Question Repository... Questions come in, answers go out
Posted: 21 Oct 2010, 14:07
by FireStorm_
tanks zwzsg.
I now (think I) understand.
(and can carry on more confidently

)