REAL ship deliveries
Moderator: Mod Contributor
-
- Lead Network Developer
- Posts: 2560
- Joined: Sun Jan 12, 2003 9:13 am
- Location: Palo Alto CA
- Contact:
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
In weapons_lib.py there is the sentence:
That seems to be the link to the ship purchase dialog.
Code: Select all
Base.Link (room1, 'my_link_id', -0.0175, 0.336667, 0.66, 0.45, 'Upgrade_Ship', room0)
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Good hunting, javier. So, I guess, taking the code as is presently in PU,
We'd have to add here a check to see if the cargo in the player's ship fits in the new ship's cargo space. Not sure how, but one complicating factor is that we need to communicate to the user what the problem is, if the cargo can't be moved.
Then...
And here we need code to move the cargo from the old ship to the new.
While we're at it, we could also try to move mission cargos... Well, I'm not sure what the problem is, but there's a problem with taking a mission and then changing ships that the mission is lost.
Code: Select all
def CanBuyShip(shipname):
import VS
creds=VS.getPlayer().getCredits()
return creds+ShipValue(VS.getPlayer().getName(),True)+CargoValue(VS.getPlayer())>=ShipValue(shipname,False)
Then...
Code: Select all
def BuyShip(shipname):
import VS
import Base
name=VS.getPlayer().getName()
value=CargoValue(VS.getPlayer())+ShipValue(name,True)
oldcargo=[]
oldun=VS.getPlayer()
for i in range(oldun.numCargo()):
c=oldun.GetCargoIndex(i)
if c.GetCategory().find("upgrades")!=0:
oldcargo.append(c)
#print value
#print VS.getPlayer().getCredits()
VS.getPlayer().addCredits(value)
success=Base.BuyShip(shipname,False,True)
if (success!=False):
Base.SellShip(name)
#print VS.getPlayer().getCredits()
#VS.getPlayer().addCredits(-ShipValue(shipname,False))
#print VS.getPlayer().getCredits()
#for carg in oldcargo:
# VS.getPlayer().addCargo(carg)
where=shipname.find(".blank")
if (where!=-1):
shipname=shipname[0:where]
VS.playSound('sales/pitch'+shipname+'accept.wav',(0,0,0),(0,0,0))
return True
else:
where=shipname.find(".blank")
if (where!=-1):
shipname=shipname[0:where]
VS.playSound("sales/pitch"+shipname+"duplicate.wav",(0,0,0),(0,0,0))
return False
While we're at it, we could also try to move mission cargos... Well, I'm not sure what the problem is, but there's a problem with taking a mission and then changing ships that the mission is lost.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
This functions are invoked from function ShipPurchase in bases/weapons_lib.py. The way to solve it could be creating a new function CanHoldCargo that compares cargo hold of the objective vessel with actual cargo volume, and inserting a call to it after successful invocation to CanBuyShip, adjusting fixer dialog on failure, something like
But the problem with this is that this function doesn't get invoked from the upgrade ship computer screen, as I mentioned before. And that's what I'm trying to find now. Where the the upgrade ship dialog control is. I'm afraid this have to be C++ code, that I'm not capable to deal with at the moment. This can be a simple question for one of the core developers.
Code: Select all
def ShipPurchase(shipname):
.
.
.
elif CanBuyShip(shipname+".blank"):
if CanHoldCargo(shipname+."blank"):
# sucess
.
.
else:
# failure
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
I guess this is then a feature request that the python purchase function be called from the Ships GUI code; so that all purchases go through a common, interceptable piece of code.
OT:
I'd also like to add another request, namely that all quitting actions be interceptable by Python. This is to be able to change quit actions so they quit to main menu, rather than to the desktop.
/OT
OT:
I'd also like to add another request, namely that all quitting actions be interceptable by Python. This is to be able to change quit actions so they quit to main menu, rather than to the desktop.
/OT
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
Yes, I do think so. Indeed, it seems the only way to go in this case, because all the ships in the game but the original ones can only be bought from the computer screen. Theoretically, it could be solved with fixers and a lot of scripting, but it's not worth the effort.chuck_starchaser wrote:I guess this is then a feature request that the python purchase function be called from the Ships GUI code; so that all purchases go through a common, interceptable piece of code.
OT:
I'd also like to add another request, namely that all quitting actions be interceptable by Python. This is to be able to change quit actions so they quit to main menu, rather than to the desktop.
/OT
So, I think we have reached a dead end about all of this. The inevitable conclusion is we really need a set of callback python functions embedded in the C++ code, and that this need is only to be greater in the future. This have to be a high priority feature to be implemented, IMHO.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Alright, devvies; whaddya say?
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
I kept looking at c++ code and I found the function buyShip in source module basecomputer.cpp. I'm going to open a feature request in the Future Development forum.
But, looking at the source, I have found too the configuration variable persistent_mission_across_ship_switch under general section, who does exactly that. If set, the active missions will be carried at ship changes.
I think this question has been asked before, and don't know if someone has come with this solution nor the option is documented anywhere.
But, looking at the source, I have found too the configuration variable persistent_mission_across_ship_switch under general section, who does exactly that. If set, the active missions will be carried at ship changes.
I think this question has been asked before, and don't know if someone has come with this solution nor the option is documented anywhere.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Wow, good find! Gotta try that variable tonight. And I'll have a look at basecomputer.cpp too. Maybe we could make a few functions callable from python.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
I do not know if I actually want to see that fixed. It's like booking a passage on a ship, which is being shown as a luxury liner on the ad image, but then there's this tiny footnote saying "ship example image, may vary slightly" and then you're being transfered to a chinese container freighter moving 300 brutto register tons of hard-cooked eggs which have expired in 1972 and are now being transfered to iceland so they do not stink that much.
Or imagine you have a real hot delivery, say you want to smuggle some cocaine from A to B, and then you're being introduced to a guy who'll do it for you for 500$, and he has this really fast but unsuspicious looking car. You think "yeah, that's exactly what I'm looking for" and hire this guy. The next day he comes around to pick up the cocaine, in a purple-orange monster truck with a text on the back window, "Fuck Da Bloody Donut-Eatin' Mothafuckin' Cops", hits the hump and 90 decibels of synthesized "Catch me if you can" break the windows of that major police station on the other side of the street.
I mean, you do not only hire the pilot, you also hire the ship. You want to make sure your cargo makes it from A to B, and even if it's not a cargo mission you want to make sure that the mission is completed in time.
What I'd rather like to see would be a mission log per-ship. Missions can be aborted at any time, and campaign missions can be retaken, so there's no problem with that. But if you decided to clean Perry from confed presence in your eject pod and your customer is insane enough to accept that, damn, you'll have to do it like that - maybe he just wants to see you roasted
Or imagine you have a real hot delivery, say you want to smuggle some cocaine from A to B, and then you're being introduced to a guy who'll do it for you for 500$, and he has this really fast but unsuspicious looking car. You think "yeah, that's exactly what I'm looking for" and hire this guy. The next day he comes around to pick up the cocaine, in a purple-orange monster truck with a text on the back window, "Fuck Da Bloody Donut-Eatin' Mothafuckin' Cops", hits the hump and 90 decibels of synthesized "Catch me if you can" break the windows of that major police station on the other side of the street.
I mean, you do not only hire the pilot, you also hire the ship. You want to make sure your cargo makes it from A to B, and even if it's not a cargo mission you want to make sure that the mission is completed in time.
What I'd rather like to see would be a mission log per-ship. Missions can be aborted at any time, and campaign missions can be retaken, so there's no problem with that. But if you decided to clean Perry from confed presence in your eject pod and your customer is insane enough to accept that, damn, you'll have to do it like that - maybe he just wants to see you roasted
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
Sorry, maybe I don't explained myself.
What I'm saying is that you know, reading the mission briefing, what you will be carrying but not how much, so you don't know in advance if you have the storage needed to fulfill it. Only when accepted a decision is made, so you could get one mission and find it aborted before start. This should not happen.
If this is solved, then you could think about how failing a mission affects your reputation or relation with the faction you chose the mission from.
What I'm saying is that you know, reading the mission briefing, what you will be carrying but not how much, so you don't know in advance if you have the storage needed to fulfill it. Only when accepted a decision is made, so you could get one mission and find it aborted before start. This should not happen.
If this is solved, then you could think about how failing a mission affects your reputation or relation with the faction you chose the mission from.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Yeah, the mission should specify space needed, and if it doesn't fit you should get a message "you don't have enough space", rather than silently fail the mission.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Elite Hunter
- Posts: 1149
- Joined: Mon Aug 14, 2006 3:56 pm
- Location: Black Forest, Germany
Well, atm the engine takes your overall cargo hold and calculates the missions in a way that even the three most cargo-intensive cargo missions cannot bust your luggage. There are two problems though:
1) The engine doesn't care for cargo which you already have
2) When switching ships the missions don't get updated to your new cargo hold, you need to save and load for that
So best solution would be, for autogenerated missions, some sort of live-update every time you switch a ship. So buying/switching a ship should reload the whole basescript, as well as leaving the commodity exchange.
1) The engine doesn't care for cargo which you already have
2) When switching ships the missions don't get updated to your new cargo hold, you need to save and load for that
So best solution would be, for autogenerated missions, some sort of live-update every time you switch a ship. So buying/switching a ship should reload the whole basescript, as well as leaving the commodity exchange.
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
And that drives us again to the need of fixing the excess cargo bug. That way, after accepting the mission you cannot switch to a ship unable to hold the compromised cargo. I'm beginning to feel the importance of that problem is greater than thought.Dilloh wrote:Well, atm the engine takes your overall cargo hold and calculates the missions in a way that even the three most cargo-intensive cargo missions cannot bust your luggage. There are two problems though:
1) The engine doesn't care for cargo which you already have
2) When switching ships the missions don't get updated to your new cargo hold, you need to save and load for that
So best solution would be, for autogenerated missions, some sort of live-update every time you switch a ship. So buying/switching a ship should reload the whole basescript, as well as leaving the commodity exchange.
The first problem shouldn't be too much difficult to nail. But I think generating the amount with the mission itself is a more elegant solution.
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
I think the first step would be to remove the buy ship function from c++, and replace it with a python function, if that's possible. Inside python we know the cargo hold space of ships, and can test for transferability.
A nice touch would be that if a cargo expansion would allow you to make the cargo tranfer, you'd be given a chance to pay for the expansion and have it installed together with the switchover.
And while we're at it, we might want to add a Dump button to the upgrades, for like when an upgrade costs more to fix than to buy new.
And also, the having to buy your own ship in order to switch ships is a bit unintuitive.
A nice touch would be that if a cargo expansion would allow you to make the cargo tranfer, you'd be given a chance to pay for the expansion and have it installed together with the switchover.
And while we're at it, we might want to add a Dump button to the upgrades, for like when an upgrade costs more to fix than to buy new.
And also, the having to buy your own ship in order to switch ships is a bit unintuitive.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Bounty Hunter
- Posts: 186
- Joined: Mon Aug 06, 2007 2:34 am
- Location: Cambs
Agreed, any chance you could throw in the a sale value indicator for ships too?chuck_starchaser wrote: And also, the having to buy your own ship in order to switch ships is a bit unintuitive.
Save The Economy
http://vegastrike.sourceforge.net/forum ... hp?t=10605
My boxes: Dual Opteron 280s, Geforce 7600, 2GB RAM, but waiting for a new PSU! grrr...
500 MHz Compaq laptop that gives DC electric burns
http://vegastrike.sourceforge.net/forum ... hp?t=10605
My boxes: Dual Opteron 280s, Geforce 7600, 2GB RAM, but waiting for a new PSU! grrr...
500 MHz Compaq laptop that gives DC electric burns
-
- Elite
- Posts: 8014
- Joined: Fri Sep 05, 2003 4:03 am
- Location: Montreal
- Contact:
Sorry, I was busy setting up svn repos last night; haven't had a chance to look at the code, yet; probably tonight.
Latest version of Cinemut Opaque
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
Latest version of LaGrande noodleworks (scroll down).
An evolving La Grande How-To...
The non-working, but latest, CineMut test_bike
PU (Privateer: Parallel Universe's Home). WC or Privateer Drayman for you?
WCpedia --The Wing Commander Encyclopedia-- From Angel Deveraux through Belisarius to Zachary Banfeld...
WC Nexus forum, the Moonbase Tycho of WC fans.
-
- Bounty Hunter
- Posts: 137
- Joined: Tue Jan 31, 2006 12:46 am
I'm testing a patch right now, and if everything works I'll post it this afternoon, intended to be revised by developers, in thread http://vegastrike.sourceforge.net/forum ... hp?t=10814
Could somebody change the above thread from Future Development to Bug Triage? I think it belongs there.
Could somebody change the above thread from Future Development to Bug Triage? I think it belongs there.