View topic - Problems with buildings



All times are UTC + 1 hour


Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Problems with buildings
PostPosted: 18 Mar 2012, 23:10 

Joined: 28 Jan 2012, 03:17
I want to have buildings that have researchable upgrades. I've been able to do this fine for the most part, but I am having trouble with two of them:

1. I want to be able to build a "turret" in the building (i.e. allow it to fire at enemies). In order to do this, my plan was to give the building a weapon in the unitdef and set

Code:
canAttack = false,
fireState = 0,
noAutoFire = true,

so that the unit could not attack unless I changed the fire state manually (which I would do when the building was upgraded). However, it seems as though noAutoFire = true locks the firestate on "Fire at Will". Is there a way to get around this? Or a better way to do what I want to do?

2. I want the buildings to be able to repair units when a certain upgrade is researched. However, apparently I can't set canRepair = true if I have a yardmap in the unitdef. What gives?

Thanks!


Top
 Offline Profile  
 
PostPosted: 18 Mar 2012, 23:14 
Journeywar Developer & Mapper
User avatar

Joined: 24 Jan 2006, 21:12
Location: There is no god - and reality is his prophetess
Why not just allow the weapon to exist normally and then set a boolean on aiming, so that the hidden, not yet upgraded weapon cant fire?

Setting it in the unitdef could (unless changed) permanently label it as a peacefull constructor unit.

Sorry, but it seems a bit overcomplicated.

edit: Sorry, re-reading my post i sound arrogant as SomeWhat. Guess i should keep my lips sealed, using 1200 overcomplicated lines for one freaking train. So disregard my post.


Top
 Offline Profile  
 
PostPosted: 18 Mar 2012, 23:24 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
in the unitscript in function script.AimWeapon1: return false and the weapon will not fire.
you probally also want this: http://answers.springlobby.info/questions/5/lua-unit-script-gadget-communication
can also set the weapon reload time to block it, like this map:
viewtopic.php?f=13&t=26570&hilit=downcount

Quote:
apparently I can't set canRepair = true if I have a yardmap in the unitdef. What gives?
iirc only "mobile" units can spray nanostuff. That is why nanoturrets in BA etc are actually mobile units with maxVelocity=0


Top
 Offline Profile  
 
PostPosted: 19 Mar 2012, 00:42 

Joined: 28 Jan 2012, 03:17
Thanks very much! Got (1) working. I guess I'll have to come up with another plan for (2).


Top
 Offline Profile  
 
PostPosted: 19 Mar 2012, 17:04 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
I'd recommend unit swap instead of toggling weapons for upgrades as it will cause issues with info box tooltips.


Top
 Offline Profile  
 
PostPosted: 19 Mar 2012, 18:41 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
smoth wrote:
I'd recommend unit swap instead of toggling weapons for upgrades as it will cause issues with info box tooltips.
Would rather fix w/e info tooltip wupget then. Weapon upgrades is something that should work without unit swapping simply by (un)blocking weapons or editing them.
Spring.SetUnitWeaponState can also be used to "upgrade" weapons, at least "reloadTime" works as expected.
"aimReady" is maybe even better for blocking but I have not tested.


Top
 Offline Profile  
 
PostPosted: 19 Mar 2012, 18:45 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
cannot re-designate primary weapon, what if he needs to be able to choose weapons? the unit still primarily aims with the weapon 1. Unless they changed that.


Top
 Offline Profile  
 
PostPosted: 19 Mar 2012, 18:56 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
yea, i think its still like that. Though it only matters when you change what stuff the weapon can target. (like swap a cannon vs torpedo or different weapon range)
For a stationary building primary weapon does not matter so much (at all?) because it can not move into range anyway.


Top
 Offline Profile  
 
PostPosted: 20 Mar 2012, 21:48 
Game Developer
User avatar

Joined: 25 Jun 2006, 07:44
Location: Germany
May need some additional information.

Is the building in question a factory? If it is then it cannot do things like repairing. I'm not sure what the restrictions on non-factory buildings are but there are plenty of those with build capability in the form of nanotowers in various mods.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.