Adding an attachment
Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command
Adding an attachment
Hi all,
I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.
I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')
I've created an event trigger: "Scenario is Loaded".
I've tried with and without conditions (and I think this is where the problem is).
I have my actions: LUA script (the line above) and a message, in this order.
I haven't used the console as mentioned on this board. I've been doing it all through the Editor.
I'm using a single overlay for now to test the process, so what you see above is what I am inputting.
The event triggers as expected, the event action message appears, but the overlay is absent, even if I start the scenario or switch sides (I want my overlays to appear for the player and not the AI).
The containing folder GUID is correct, and the required files are present.
Any tips?
Go easy; it's my first time with LUA.
I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.
I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')
I've created an event trigger: "Scenario is Loaded".
I've tried with and without conditions (and I think this is where the problem is).
I have my actions: LUA script (the line above) and a message, in this order.
I haven't used the console as mentioned on this board. I've been doing it all through the Editor.
I'm using a single overlay for now to test the process, so what you see above is what I am inputting.
The event triggers as expected, the event action message appears, but the overlay is absent, even if I start the scenario or switch sides (I want my overlays to appear for the player and not the AI).
The containing folder GUID is correct, and the required files are present.
Any tips?
Go easy; it's my first time with LUA.
RE: Adding an attachment
you shouldn't need a condition, just the scen load trigger with your code above in the lua action. The overlay loads such that it is shown to all sides.
can you upload your scen so we can check it?
can you upload your scen so we can check it?
RE: Adding an attachment
ORIGINAL: Whicker
you shouldn't need a condition, just the scen load trigger with your code above in the lua action. The overlay loads such that it is shown to all sides.
can you upload your scen so we can check it?
Hi Whicker,
I'll have to email it to you. It's a beast.
RE: Adding an attachment
maybe you should try doing it with a small overlay to make sure what you are trying to do isn't too big? how big is the image?
are you attaching the image under Editor >> Scenario Attachments? sounds like you are.
are you attaching the image under Editor >> Scenario Attachments? sounds like you are.
RE: Adding an attachment
ORIGINAL: Whicker
maybe you should try doing it with a small overlay to make sure what you are trying to do isn't too big? how big is the image?
are you attaching the image under Editor >> Scenario Attachments? sounds like you are.
Hi Whicker,
The scenario is very big.
The overlays are not so. There are many overlays to load when the scenario starts.
I've been practicing with just the one I posted, and no joy.
Yes, I am. Is this correct?
RE: Adding an attachment
I think so.
Send it to me an I can have a look. I have only done it a couple times but it seemed straight forward.
Send it to me an I can have a look. I have only done it a couple times but it seemed straight forward.
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
Here is an example scenario showing how to load attachments with Lua.
The original designer required these to be manually added until Lua came along. I updated it to show how to use exsiting attachments as part of the scenario loading.
The original designer required these to be manually added until Lua came along. I updated it to show how to use exsiting attachments as part of the scenario loading.
- Attachments
-
- WECDavos..rrorists.zip
- (2.12 MiB) Downloaded 15 times
Michael
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
Is the folder '0a7490ae-0939-4b15-9631-0047a2f4e2fc' (which contains the attachment in the AttachmentRepo???ORIGINAL: DMAN
Hi all,
I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.
I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')
Michael
RE: Adding an attachment
ORIGINAL: michaelm75au
Is the folder '0a7490ae-0939-4b15-9631-0047a2f4e2fc' (which contains the attachment in the AttachmentRepo???ORIGINAL: DMAN
Hi all,
I admit defeat.
For the life of me, I cannot get my overlays to load automatically with LUA.
I know it's a single line per overlay, something like this: ScenEdit_UseAttachment('0a7490ae-0939-4b15-9631-0047a2f4e2fc')
Hi Michael,
Yes, it was.
I'll have a look at that example scenario you posted and see where I went wrong. Thanks! [:)]
More to follow...
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
If still an issue, send me the zip of the bundle, and I'll take a look at what is loading.
Michael
RE: Adding an attachment
ORIGINAL: michaelm75au
If still an issue, send me the zip of the bundle, and I'll take a look at what is loading.
Hi Michael,
What needs to be in the bundle?
I tested with one overlay, and copied exactly what the test scenario had in the event. Still no overlay.
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
The SCEN file with the 'attachments' folder - the zip you should get when you run 'package scenario for distribution' from the editor.
Michael
RE: Adding an attachment
ORIGINAL: michaelm75au
The SCEN file with the 'attachments' folder - the zip you should get when you run 'package scenario for distribution' from the editor.
Ok. It's a very large build. Can I pm or email it to you?
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
Yes, email it.
Probably better to jump in rather go back and forth with a cut-down version[:D]
Probably better to jump in rather go back and forth with a cut-down version[:D]
Michael
RE: Adding an attachment
ORIGINAL: michaelm75au
Yes, email it.
Probably better to jump in rather go back and forth with a cut-down version[:D]
Haha reap what you sow...
Can you pm your email please?
RE: Adding an attachment
Hi Michael,
Fantastic! It works. Thank-you.
I think the critical step I missed was "re-add the overlay" each time. I simply added them from the repository and ran the package.
Can I continue to rename them or must they use that GUID?
Fantastic! It works. Thank-you.
I think the critical step I missed was "re-add the overlay" each time. I simply added them from the repository and ran the package.
Can I continue to rename them or must they use that GUID?
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
They are designed to use the GUID as that is what gives it the unique name so it won't clash with someone else's attachments.
Michael
RE: Adding an attachment
Hi Michael,
Success with 2 tests!
I will now attempt the event in the actual build, with all overlays. [:)]
Success with 2 tests!
I will now attempt the event in the actual build, with all overlays. [:)]
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
Using the 'Create new' in 'Scenario Attachments' in the editor should be creating the attachments in the AttachmentRepo and giving you the GUID to use in the Properties.
I am seeing that on my Beta copy but don't recall it in the release copy.

I am seeing that on my Beta copy but don't recall it in the release copy.

- Attachments
-
- attachments2.jpg (102.67 KiB) Viewed 838 times
Michael
- michaelm75au
- Posts: 12457
- Joined: Sat May 05, 2001 8:00 am
- Location: Melbourne, Australia
RE: Adding an attachment
FYI
When you create the image overlay (or any other attachment), it should show up in AttachmentRepo then. You can get the GUID from there and make a note which image it belongs to for updating the scripts.
It should be showing in the properties; not sure it isn't.
When you package it up, those folders are copied to the zip so others who install the scenario later will get the same attachments (and GUID).
When you create the image overlay (or any other attachment), it should show up in AttachmentRepo then. You can get the GUID from there and make a note which image it belongs to for updating the scripts.
It should be showing in the properties; not sure it isn't.
When you package it up, those folders are copied to the zip so others who install the scenario later will get the same attachments (and GUID).
Michael