Mod Question Repository... Questions come in, answers go out
Moderator: Moderators
Re: Mod Question Repository... Questions come in, answers go out
Sorry but I don't get it. In the wiki (http://springrts.com/wiki/Lua_CMDs) there is this example:
Spring.GiveOrderToUnit(unitID,
CMD.INSERT,
{-1,CMD.ATTACK,CMD.OPT_SHIFT,unitID2},
{"alt"}
);
Because I have to use the build queue of my factory I have to use "CMD.OPT_CONTROL" instead of "CMD.OPT_SHIFT" (as the wiki says "options.CONTROL -> use the build queue for factories"). But what have I to use insead of CMD.ATTACK? Cause there is no command like "CMD.BUILD"?
If I wouldn't use "CMD.OPT_CONTROL" would this command go to the queue of the unit which is built by my factory, right?
Spring.GiveOrderToUnit(unitID,
CMD.INSERT,
{-1,CMD.ATTACK,CMD.OPT_SHIFT,unitID2},
{"alt"}
);
Because I have to use the build queue of my factory I have to use "CMD.OPT_CONTROL" instead of "CMD.OPT_SHIFT" (as the wiki says "options.CONTROL -> use the build queue for factories"). But what have I to use insead of CMD.ATTACK? Cause there is no command like "CMD.BUILD"?
If I wouldn't use "CMD.OPT_CONTROL" would this command go to the queue of the unit which is built by my factory, right?
-
- Posts: 834
- Joined: 19 May 2009, 21:10
Re: Mod Question Repository... Questions come in, answers go out
For build commands the negative unitdefid is used.thedude wrote:But what have I to use insead of CMD.ATTACK? Cause there is no command like "CMD.BUILD"?
Re: Mod Question Repository... Questions come in, answers go out
The goog thing is I don't get errors but the factory still does not build the unit.
What I use:
Spring.GiveOrderToUnit(factoryID, CMD.INSERT,{-1,-unitdefid,CMD.OPT_CONTROL},{});
The "-1" puts my command at the end of the build queue. What have I to use to put the command on the first position ("0" or "1") ?
What I use:
Spring.GiveOrderToUnit(factoryID, CMD.INSERT,{-1,-unitdefid,CMD.OPT_CONTROL},{});
The "-1" puts my command at the end of the build queue. What have I to use to put the command on the first position ("0" or "1") ?
Re: Mod Question Repository... Questions come in, answers go out
I think you have to put the CMD.OPT_CONTROL into the CMD.INSERT too.
Re: Mod Question Repository... Questions come in, answers go out
Nope,
Spring.GiveOrderToUnit(factoryID, CMD.INSERT,{-1,-unitdefid,CMD.OPT_CONTROL},{CMD.OPT_CONTROL});
doesn't work for me.
After trying a whole week to make the command work I feel like I already tried all possibilities. (But not the right one)
Spring.GiveOrderToUnit(factoryID, CMD.INSERT,{-1,-unitdefid,CMD.OPT_CONTROL},{CMD.OPT_CONTROL});
doesn't work for me.
After trying a whole week to make the command work I feel like I already tried all possibilities. (But not the right one)
Re: Mod Question Repository... Questions come in, answers go out
The command to build a Peewee has the ID -(peewee ID)
So if the peewee unitdef is 46, the command ID is -46
So if the peewee unitdef is 46, the command ID is -46
Re: Mod Question Repository... Questions come in, answers go out
Thanks dude but SirMaverick already told

Spring.GiveOrderToUnit(factoryID, CMD.INSERT,{-1,-unitdefid,CMD.OPT_CONTROL},{CMD.OPT_CONTROL});SirMaverick wrote: For build commands the negative unitdefid is used.
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
I am trying to make a nuclear missile submarine. Is there any way to make a submerged unit fire a missile? I have built a test unit and when its submerged (i use the waterline string in the unit fbi) it won't fire. When I reset the waterline, so it behaves like a ship, it will fire nukes normally. I looked at few old TA units examples, but that didn't help...
Any ideas?
Thanks!
Any ideas?
Thanks!
Re: Mod Question Repository... Questions come in, answers go out
i would bet it needs Lua, have no idea how to do it though.
how exactly does this work anyway (in real). do they catapult the missile out of water, and only then ignite its main engine?
edit:
nice idea, good luck!
how exactly does this work anyway (in real). do they catapult the missile out of water, and only then ignite its main engine?
edit:
nice idea, good luck!

- BrainDamage
- Lobby Developer
- Posts: 1164
- Joined: 25 Sep 2006, 13:56
Re: Mod Question Repository... Questions come in, answers go out
EE ( Expand & Exterminate ) has it, and iirc it had it much longer than spring had lua scripting, search there
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
Thanks! As for the other question not entirelly sure. I would suspect a dual cycle or something like that...
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Mod Question Repository... Questions come in, answers go out
CA's Leviathan - Tactical Nuke/Anti Nuke Missile Sub sounds like what you want. Described here: http://trac.caspring.org/wiki/UnitGuide#Shipyard1tyran_nick wrote:I am trying to make a nuclear missile submarine. Is there any way to make a submerged unit fire a missile? I have built a test unit and when its submerged (i use the waterline string in the unit fbi) it won't fire. When I reset the waterline, so it behaves like a ship, it will fire nukes normally. I looked at few old TA units examples, but that didn't help...
Any ideas?
Thanks!
Unit file is here: http://trac.caspring.org/browser/trunk/ ... ukesub.lua
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
Thanks! I managed to do make my sub fire missiles underwater. Just for reference I used lua, but it seems the only thing I needed was a line in the weapon description (waterWeapon = true), so either fbi or lua are ok. I worked a bit more on the unit and I made it submerge/surface using the unit_replace gadget. However I have a problem now, any nukes that are stockpiled are lost when I change state. Any suggestions?
P.S. My lua skills are very poor (yet). I suspect I could do it with lua, but any more detailed help would be greatly appreciated!
P.S. My lua skills are very poor (yet). I suspect I could do it with lua, but any more detailed help would be greatly appreciated!
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
I have a unit that seems to work alright (no crashes/missing files/etc) but there are times it won't fire its weapons. Sometimes it fires normally and sometimes it won't fire at all. The unit has two weapons, weapon1 is a missile similar to armmerl and the second weapon is a beamlaser mounted on a turret. There are times that the unit will fire all its weapons normally, but most of the times only the laser...! Even if I take control of the unit (by pressing C) I can see that the weapons are ready to fire (after aiming) but when i press the mouse button the missile just won't fire...
Any ideas? The laser always works fine
I haven't used any lua on this one, just standard cob and fbi.

I haven't used any lua on this one, just standard cob and fbi.
Re: Mod Question Repository... Questions come in, answers go out
This can be some kind of script problem. Post your .bos and .fbi maybe?
Also, make sure the object from which the missile is fired (which is referenced in QueryWeapon) is not underwater (if your unit is a ship), because armmerl weapon can't fire from there.
Also, make sure the object from which the missile is fired (which is referenced in QueryWeapon) is not underwater (if your unit is a ship), because armmerl weapon can't fire from there.
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
Thanks, I re-checked the script as you suggested did a few changes and now the missile fires all the time. It wasn't the water... but couldn't really find what it was. My old script was based on the nuke silo (the other mode of the unit is to fire nukes) so it must have been something with that.
Next question
How is the size of the radar blip in the minimap calculated? Can I override it by changing the unit's fbi?
Next question

How is the size of the radar blip in the minimap calculated? Can I override it by changing the unit's fbi?
Re: Mod Question Repository... Questions come in, answers go out
In the \units\that_unit.FBI there is a line such as:
In \gamedata\icontypes.tdf there is an entry such as
Code: Select all
icontype=that_unit_icon;
Code: Select all
[that_unit_icon]
{
bitmap=icons/some_picture.tga;// Image to use
size=1;// Multiplier for icon size
radiusadjust=0;// Does the icon change size according to unit size?
distance=0.5;// Multiplier for the distance at which unit turns into icon
}
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
Thanks!
So based on:
So based on:
I presume its something like unit radius * height from the .s3o file or the footprintX * footprintY for the engine to identify the unit size?radiusadjust=0;// Does the icon change size according to unit size?
- tyran_nick
- Posts: 47
- Joined: 07 Mar 2010, 12:42
Re: Mod Question Repository... Questions come in, answers go out
Can we do cylinders with LUPS (similar to LUPS spheres)?
Are they any example units?
Are they any example units?
Re: Mod Question Repository... Questions come in, answers go out
I┬┤m having a problem with the new spring version. I updated my mod with the game_spawn.lua , just the file as it was posted here in the forum. So far it works, commander gets spawned. But suddenly all my labs disappeared from the build menu.
Infolog tells me that they got removed, but not why
if i try to /give the units i get
But I┬┤m quite sure that I did not change anything besides the game_spawn.lua. The same mod file worked with older Spring versions.
Have i missed a change in that regard?
Infolog tells me that they got removed, but not why
Code: Select all
WARNING: removed the "dgjeagfab" entry from the "dgcom" build menu
if i try to /give the units i get
Code: Select all
Couldnt find wreckage info dgjeagfab
Have i missed a change in that regard?