Some things

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Just go ahead this way. Using a counter should be pretty simple. Increment it by one on each use and if it's ten, remove the equipment.

For use of variables you may also look at the short script for the Fuel Scoops Enhancer I was posting here once. It works by incrementing a variable and awarding a little bit of fuel after a couple of increments.

One problem I had with variables was that in 1.69.1 local_foo variables don't seem to be able to store integers, which is what you need for a counter. No problem with mission_foo variables, though.
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

I've played around with some options but have run into a couple of snags. The testForEquipment method doesn't seem to want to work with missiles and mines (i.e. EQ_XXX_MISSILE or EQ_XXX_MINE). I can get around this by having a separate EQ_CHAFF_LAUNCHER that exists as a piece of equipment fitted into the ship, and then use this to set the chaff_count upon launch. I would still need to have individual chaff mines so the player can use them at will, but these could be regarded as refills for the chaff dispenser.

Would anyone be able to confirm whether testForEquipment works with missiles and mines or not, or if I'm just missing something?

I then had a plan to keep re-equipping the player with a chaff mine until their chaff_count ran out. I've tried putting awardEquipment: EQ_CHAFF_MINE as a deathAction in the mine's shipdata but nothing seems to be happening. Maybe I'll try putting this in the script as a STATUS_IN_FLIGHT occurance rather than in the shipdata.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Yes, indeed missiles and mines can not be queried by testForEquipment. They also cannot be removed by removeEquipment (and probably also not be awarded as well). I think I read that recently in a post of LittleBear, so not my personal finding.
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

I think I've worked out a solution to this. I'll add a post to the Missiles and Bombs thread in the Expansion Packs forum.
Download Resistance Commander plus many other exciting OXPs HERE
Post Reply