Category | Farming Simulator 2013 |
Created | 14.02.2015 10:02 |
Bilbo Beutlin (BBeutlin) | 14.02.2015 10:02 |
---|---|
I'm working on a script to display nearest horseshoe position on PDA. But I can't access the horseshoe data table. So far I've experimented with "collectableHorseshoesObject" (referenced in sampleModMap.lua) and "collectableHorseshoes, horseshoe, horseshoeTrigger" (referenced in map.i3d). Without success. Where is this horseshoe table? |
Emil Drefers (Unknown) | 11.03.2015 12:06 |
---|---|
Hi, actually there should be a mod out there whcih does exactly what you want to do, if I remeber correcttly. Anyway, see what you can do with the following tip: g_currentMission.collectableHorseshoesObject and g_currentMission.collectableHorseshoesObject.horseshoes Cheers, Emil |
Bilbo Beutlin (BBeutlin) | 16.03.2015 10:18 |
---|---|
Thanks for the answer. I tried it now with: for k,item in ipairs(g_currentMission.collectableHorseshoesObject.horseshoes) do 1) local obj = item; 2) local obj = item.item; 3) local obj = item.rootNode; 4) local obj = g_currentMission:getNodeObject(**like 1-3**); Tried also with "for k,i in pairs(...)" In all cases I get nil or index error. Now what's wrong with this method? Also I didn't find a mod like mentioned. Do you have a link? |
Emil Drefers (Unknown) | 16.03.2015 14:33 |
---|---|
Hi, not sure what you tried exactly ,) But for k,item in ipairs(g_currentMission.collectableHorseshoesObject.horseshoes) do for l,horseshoe in pairs(item) do print(tostring(l)..": "..tostring(horseshoe)); end end should give you some results. Anyway, you could try horseshoeTriggerId, horseshoeId and visId ;) Cheers, Emil |
Bilbo Beutlin (BBeutlin) | 16.03.2015 16:10 |
---|---|
Ah .. thanks for the hints :) I wasn't aware that the table is nested once more. Too bad that such things are rarely documented. The more thanks to the useful support by yours. |
Bilbo Beutlin (BBeutlin) | 18.03.2015 01:46 |
---|---|
It's nearly done. My "horseshoe radar" now works fine (with default icons). Remaining problem: How can I use custom icons for the PDA? I tried it with PNGs in various 2^n formats, DDS in DXT1,2,3 - but I get always: "Error: Can't load resource: ...." What's the secret of the PDA icons? And besides: what's the meaning of the last 5 arguments in "createMapHotspot(... , false, false, false, 0, true)" |
Emil Drefers (Unknown) | 18.03.2015 09:00 |
---|---|
Hi, maybe the path to the image file is not correct? How do you set/create the path exactly? As requested: function MissionPDA:createMapHotspot(name, imageFilename, xMapPos, yMapPos, width, height, blinking, persistent, showName, objectId, hidable) Cheers, Emil |
Bilbo Beutlin (BBeutlin) | 18.03.2015 10:17 |
---|---|
The files are all together in one directory. I'm using g_currentMission.missionPDA:createMapHotspot("Horseshoe", Utils.getFilename("hud_pda_spot_horseshoe.png", self.baseDirectory), ....) where the icon file is a 64x64 DDS DXT3 (one alpha channel). The adequate PNG is also there. I tried also 32x32, DXT5, .. get always "Error: Can't load resource: hud_pda_spot_horseshoe.png" If I use map default icons, all runs fine. Is there a certain format necessary? I've read something about icon files with multiple icons inside. |
Emil Drefers (Unknown) | 18.03.2015 17:08 |
---|---|
Hi, please do a "debug print" and check what's the outcome of: Utils.getFilename("hud_pda_spot_horseshoe.png", self.baseDirectory) Maybe that can already solve your problem ;) Cheers, Emil |
Bilbo Beutlin (BBeutlin) | 18.03.2015 17:58 |
---|---|
hhmm .. curious. I've now inserted in the "loadMap()" section: self.iconFile = Utils.getFilename("hud_pda_spot_horseshoe.png", self.baseDirectory); debug print in "draw()": print(self.iconFile) --> "hud_pda_spot_horseshoe.png" print(Utils.getFilename("hud_pda_spot_horseshoe.png", self.baseDirectory)) --> "hud_pda_spot_horseshoe.pngfalse" Now I used: ..createMapHotspot("Horseshoe", self.iconFile, ...); But same Error: Can't load resource: hud_pda_spot_horseshoe.png |
Emil Drefers (Unknown) | 19.03.2015 08:17 |
---|---|
Hi, the "false" returned by the call to "Utis.getFilename" tells us that the variable "self.baseDirectory" is not set. Please check that with a debug print ;) Anyway, sou are doing this in your mod map? Why not do it as a normal mod? In this way it would work with every map which has horseshoes! Cheers, Emil |
Bilbo Beutlin (BBeutlin) | 19.03.2015 11:50 |
---|---|
No - it is a "normal mod" in the user mod directory, not an inbuilt map feature. All runs fine if I use the default icons of "$dataS/.." But for some strange reason it will not accept my custom, selfmade icons. Meanwhile I've searched intensively in the web, didn't find any mod with custom PDA icons. So I assume, custom icons are not supported at all .. or they need a special format, which I didn't get yet ;) |
Bilbo Beutlin (BBeutlin) | 22.03.2015 14:27 |
---|---|
Problem solved! The variable 'self.baseDir' wasn't set properly, works only with vehicles and similiar. I had to set 'myMod.myDir = g_currentModDirectory;' immediately at start, just after 'myMod = {};' Then I got access with iconFile = myMod.myDir.."icon.png" |
Note: Log in to post. Create a new account here.