Category | Scripting |
Created | 10.02.2011 17:07 |
Edmund Eddie (Unknown) | 10.02.2011 17:11 |
---|---|
I'm looking for a way to get the price of a mod (g_currentMission.vehicles and g_currentMission.steerables). That would be the price set in modDesc.xml. I haven't seen a script yet which would get some data out of there. Thanks in advance. |
Stefan Geiger - GIANTS Software | 14.03.2011 09:39 |
---|---|
You can use this code to find the price of a vehicle. Assume the vehicle is stored in the variable vehicle. E.g. if you loop over g_currentMission.vehicles with for _, vehicle in pairs(g_currentMission.vehicles) This is the code: local vehiclePrice = 0; local filename = vehicle.configFileName:lower(); for i=1, table.getn(StoreItemsUtil.storeItems) do dataStoreItem = StoreItemsUtil.storeItems[i]; if dataStoreItem.species == nil and dataStoreItem.species == "" then if dataStoreItem.xmlFilename:lower() == filename then vehiclePrice = dataStoreItem.prices; break; end; end; end; print("The prices of the vehicle is: "..vehiclePrice); |
David Hunt (Unknown) | 08.06.2011 01:34 |
---|---|
What would the .prices change to if I wanted to get the store image and not the price? Edit: Its ok I managed to figure it out, if anyone else wants to know it would be dataStoreItems.imageActive in place of dataStoreItems.prices |
Note: Log in to post. Create a new account here.