Jump to content
  • 0

[SOLVED] Adding an image to a Flag


Thug

Question

[SOLVED]
 
Can someone PLEASE tell me what is wrong with the following. All I see is the flag pole. :huh:
I get this warning in the RPT:   Warning Message: Cannot load texture mpmissions\dayz_epoch_17.chernarus\flag.jpg.
I have my picture in the root of the mission side. its call flag.jpg.  its 512x256.
 
The following is my script, it is called flag.sqf and it is located in the mission side at  signs_flags\flag.sqf
 
if (isServer) then {
 
_vehicle_4 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [6354.6543, 7792.2114, -0.00012207031], [], 0, "CAN_COLLIDE"];
  _vehicle_4 = _this;
  _this setDir 127.06387;
  _this setPos [6354.6543, 7792.2114, -0.00012207031];
  _this setFlagTexture 'flag.jpg';
};
};
 
I call the above from the init.sqf
 []execVM "signs_flags\flag.sqf";
Edited by Thug
[SOLVED]
Link to comment
Share on other sites

Recommended Posts

  • 0

 

Can someone PLEASE tell me what is wrong with the following. All I see is the flag pole. :huh:
I get this warning in the RPT:   Warning Message: Cannot load texture mpmissions\dayz_epoch_17.chernarus\flag.jpg.
I have my picture in the root of the mission side. its call flag.jpg.  its 512x256.
 
The following is my script, it is called flag.sqf and it is located in the mission side at  signs_flags\flag.sqf
 
if (isServer) then {
 
_vehicle_4 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [6354.6543, 7792.2114, -0.00012207031], [], 0, "CAN_COLLIDE"];
  _vehicle_4 = _this;
  _this setDir 127.06387;
  _this setPos [6354.6543, 7792.2114, -0.00012207031];
  _this setFlagTexture 'flag.jpg';
};
};
 
I call the above from the init.sqf
 []execVM "signs_flags\flag.sqf";

 

 

setFlagTexture is local effect only so to make it local to everyone try change this:

_this setFlagTexture 'flag.jpg';

to this:

_this setVehicleInit "this setFlagTexture 'flag.jpg'";
Link to comment
Share on other sites

  • 0

 

setFlagTexture is local effect only so to make it local to everyone try change this:

_this setFlagTexture 'flag.jpg';

to this:

_this setVehicleInit "this setFlagTexture 'flag.jpg'";

 

I think you missed a semicolon there.  If my understanding is correct, then it should be:

_this setVehicleInit "this setFlagTexture 'flag.jpg';";

I could be wrong though.  It wouldn't be the first time.

Link to comment
Share on other sites

  • 0

I think you missed a semicolon there.  If my understanding is correct, then it should be:

_this setVehicleInit "this setFlagTexture 'flag.jpg';";

I could be wrong though.  It wouldn't be the first time.

 

actually i dont think it would matter in this exacte case, when there is the only this line there.

 

... after all it only represents an end of the line, but since its also the end of the code it could be irrelevant in many cases ... however, for good messures, it would be best to place one there anyway.

 

so thanks for noticing ... ;)

Link to comment
Share on other sites

  • 0

 

setFlagTexture is local effect only so to make it local to everyone try change this:

_this setFlagTexture 'flag.jpg';

to this:

_this setVehicleInit "this setFlagTexture 'flag.jpg'";

 

I think you missed a semicolon there.  If my understanding is correct, then it should be:

_this setVehicleInit "this setFlagTexture 'flag.jpg';";

I could be wrong though.  It wouldn't be the first time.

I tried it both ways and still get Warning Message: Cannot load texture mpmissions\dayz_epoch_17.chernarus\flag.jpg.

I changed the the jpg to 256x256 and size is 21.6kb and still get the warning message. I do thank you for your time. 

This is driven me mad. not really but when you see flags on other servers you know it can be done. Hopefully someone that has done it will see this post and help. 

Link to comment
Share on other sites

  • 0

Have you the jpg in your mission root folder? (Where your init.sqf is)

Yes i do. This is driving me crazy. Have you ever had something you just cant let go of. Well this is it of me. This my bone and you cant have it.  

Thank you for checking out this post. if you know any thing that can help, i will pay you in game beer and bacon. lol

Link to comment
Share on other sites

  • 0

Yes i do. This is driving me crazy. Have you ever had something you just cant let go of. Well this is it of me. This my bone and you cant have it.  

Thank you for checking out this post. if you know any thing that can help, i will pay you in game beer and bacon. lol

 

i should have maybe read your op better, but maybe you should read the bi page about setFlagTexture again:

 

https://community.bistudio.com/wiki/setFlagTexture

 

so most likely you error is cause of the size of the picture.

 

(fred actually mentions this in the first post aswell)

Link to comment
Share on other sites

  • 0

 

i should have maybe read your op better, but maybe you should read the bi page about setFlagTexture again:

 

https://community.bistudio.com/wiki/setFlagTexture

 

so most likely you error is cause of the size of the picture.

 

(fred actually mentions this in the first post aswell)

I have tried 200x200, 256x256,512x256, 512x512 and 128x128. but thank you

Link to comment
Share on other sites

  • 0

I have tried 200x200, 256x256,512x256, 512x512 and 128x128. but thank you

 

try another picture and make sure it is 200x200, from what i read it is also mp compatable, so you do not need to set it in a vehicle init either, as long as the server creates and sets the texture (but most likely texture is needed in mission file for clients to see it).

 

some pictures just wont work, most likely cause of currupted data or pixels in colours it will not accept, so try a few diffrent pics to see if you get same result but make sure they are exactly 200x200.

Link to comment
Share on other sites

  • 0

try another picture and make sure it is 200x200, from what i read it is also mp compatable, so you do not need to set it in a vehicle init either, as long as the server creates and sets the texture (but most likely texture is needed in mission file for clients to see it).

 

some pictures just wont work, most likely cause of currupted data or pixels in colours it will not accept, so try a few diffrent pics to see if you get same result but make sure they are exactly 200x200.

will try tomorrow, thank you

Link to comment
Share on other sites

  • 0

let me test something then I can give you some results :)

 

EDIT:

Left one is spawned local for each client and the right one is spawned via Server (Cannot load Texture Error)

gfzp6dys.png

code for this:

if (isServer) then {

_vehicle_108 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [15190.2, 16197.3, 0.01], [], 0, "CAN_COLLIDE"];
  _vehicle_108 = _this;
  _this setDir -538.32678;
  _this setFlagTexture 'server_logo.paa';
};
};

_vehicle_107 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [15180.2, 16197.3, 0.01], [], 0, "CAN_COLLIDE"];
  _vehicle_107 = _this;
  _this setDir -538.32678;
  _this setFlagTexture 'server_logo.paa';
};
 

This means you have to set the Flags via Server and then make a client sided check for this flag all over the map and then set the texture for each client.

that is actually pretty simple

 

Just use your code as normal to spawn the flag and then make a new file and call it what ever you like with this content:

//Author: Schwede 
private ["_Flag"];

//get all the Flags on Map
_Flag = [];
_Flag = [0,0,0] nearEntities [["FlagCarrierWhite_EP1"], 10000000];

{
	_x setFlagTexture 'yourImageHere.jpg';
} count _Flag; 

and call it at the end of your init.sqf

 

This will catch every FlagCarrierWhite_EP1 and set the texture to it

Link to comment
Share on other sites

  • 0

Hi,

Just a smal addition:

In the BI Page it is saying, that jpg can be used but this is only partly correct, as server side jpg files are not passed to the client.

The client downloads the mission folder only, so executing this on server would cause the issue that you are getting, as the texture can not be downloaded.

Ofc schwedes way is a fix for that, but you can allways define the image in your description.ext, which will in return allow you to set the object texture server sided, without the need of counting all flags + you then can have individual flags.

I'm on my phone atm, but schwede is a good scripter, im sure if he quickly reads in to that he could provide an example.

Link to comment
Share on other sites

  • 0

Hi,

Just a smal addition:

In the BI Page it is saying, that jpg can be used but this is only partly correct, as server side jpg files are not passed to the client.

The client downloads the mission folder only, so executing this on server would cause the issue that you are getting, as the texture can not be downloaded.

Ofc schwedes way is a fix for that, but you can allways define the image in your description.ext, which will in return allow you to set the object texture server sided, without the need of counting all flags + you then can have individual flags.

I'm on my phone atm, but schwede is a good scripter, im sure if he quickly reads in to that he could provide an example.

 

Actually both the server and client download and run the mission file. https://community.bistudio.com/wiki/6thSense.eu:EG#Order_of_Initialization

Link to comment
Share on other sites

  • 0

When i placed my flag image in the missionfile root it doesnt work with this code:

_vehicle_2 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierUSA_EP1", [6969.86, 8851.02, 0], [], 0, "CAN_COLLIDE"];
  _vehicle_2 = _this;
  _this setVehicleInit "this SetFlagTexture ""ch.jpg""";
  _this setPos [6969.86, 8851.02, 0];
};

 

But when i made a subfolder and placed the image in it and used this code everything works:

_vehicle_2 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierUSA_EP1", [6969.86, 8851.02, 0], [], 0, "CAN_COLLIDE"];
  _vehicle_2 = _this;
  _this setVehicleInit "this SetFlagTexture ""flags\ch.jpg""";
  _this setPos [6969.86, 8851.02, 0];
};

 

Both codes are executet serverside.

So you might wanna try with my code and place the image which should be in 256x256 in a subfolder.

Link to comment
Share on other sites

  • 0

When i placed my flag image in the missionfile root it doesnt work with this code:

_vehicle_2 = objNull;

if (true) then

{

  _this = createVehicle ["FlagCarrierUSA_EP1", [6969.86, 8851.02, 0], [], 0, "CAN_COLLIDE"];

  _vehicle_2 = _this;

  _this setVehicleInit "this SetFlagTexture ""ch.jpg""";

  _this setPos [6969.86, 8851.02, 0];

};

 

But when i made a subfolder and placed the image in it and used this code everything works:

_vehicle_2 = objNull;

if (true) then

{

  _this = createVehicle ["FlagCarrierUSA_EP1", [6969.86, 8851.02, 0], [], 0, "CAN_COLLIDE"];

  _vehicle_2 = _this;

  _this setVehicleInit "this SetFlagTexture ""flags\ch.jpg""";

  _this setPos [6969.86, 8851.02, 0];

};

 

Both codes are executet serverside.

So you might wanna try with my code and place the image which should be in 256x256 in a subfolder.

So when you say put the image in a folder. That folder is put in the Server side root or the Mission side root?

Also do i put this script in the mission.sqf server side? 

Link to comment
Share on other sites

  • 0

So when you say put the image in a folder. That folder is put in the Server side root or the Mission side root?

Also do i put this script in the mission.sqf server side? 

 

i just did this on a flag so i know it works, however, the texture is mirrored on the oppisite site, so dont put an actual flag there or it will look bad.

 

the flag is build server side and flagtexture is set by the server, then effect is global but obviusly the clients needs the texture to see it so you need to share the texture in the mission.

Link to comment
Share on other sites

  • 0

i just did this on a flag so i know it works, however, the texture is mirrored on the oppisite site, so dont put an actual flag there or it will look bad.

 

the flag is build server side and flagtexture is set by the server, then effect is global but obviusly the clients needs the texture to see it so you need to share the texture in the mission.

just tried it and it did not work. Im going to try a different pic

Link to comment
Share on other sites

  • 0
_Flag = [0,0,0] nearEntities [["FlagCarrierWhite_EP1"], 10000000];

 

maybe remove a couple of zeros here, this is just retarded ...

 

 

When i placed my flag image in the missionfile root it doesnt work with this code:

_vehicle_2 = objNull;

if (true) then

{

  _this = createVehicle ["FlagCarrierUSA_EP1", [6969.86, 8851.02, 0], [], 0, "CAN_COLLIDE"];

  _vehicle_2 = _this;

  _this setVehicleInit "this SetFlagTexture ""ch.jpg""";

  _this setPos [6969.86, 8851.02, 0];

};

 

But when i made a subfolder and placed the image in it and used this code everything works:

_vehicle_2 = objNull;

if (true) then

{

  _this = createVehicle ["FlagCarrierUSA_EP1", [6969.86, 8851.02, 0], [], 0, "CAN_COLLIDE"];

  _vehicle_2 = _this;

  _this setVehicleInit "this SetFlagTexture ""flags\ch.jpg""";

  _this setPos [6969.86, 8851.02, 0];

};

 

Both codes are executet serverside.

So you might wanna try with my code and place the image which should be in 256x256 in a subfolder.

 

you do not need to execute on all clients, it is already mp compatable if set by the owner (in this case the server), so remove the setvehicleinit stuff again and just use:

_this SetFlagTexture "flags\ch.jpg";
Link to comment
Share on other sites

  • 0

let me test something then I can give you some results :)

 

EDIT:

Left one is spawned local for each client and the right one is spawned via Server (Cannot load Texture Error)

gfzp6dys.png

code for this:

if (isServer) then {

_vehicle_108 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [15190.2, 16197.3, 0.01], [], 0, "CAN_COLLIDE"];
  _vehicle_108 = _this;
  _this setDir -538.32678;
  _this setFlagTexture 'server_logo.paa';
};
};

_vehicle_107 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [15180.2, 16197.3, 0.01], [], 0, "CAN_COLLIDE"];
  _vehicle_107 = _this;
  _this setDir -538.32678;
  _this setFlagTexture 'server_logo.paa';
};
 

This means you have to set the Flags via Server and then make a client sided check for this flag all over the map and then set the texture for each client.

that is actually pretty simple

 

Just use your code as normal to spawn the flag and then make a new file and call it what ever you like with this content:

//Author: Schwede 
private ["_Flag"];

//get all the Flags on Map
_Flag = [];
_Flag = [0,0,0] nearEntities [["FlagCarrierWhite_EP1"], 10000000];

{
	_x setFlagTexture 'yourImageHere.jpg';
} count _Flag; 

and call it at the end of your init.sqf

 

This will catch every FlagCarrierWhite_EP1 and set the texture to it

Ok, i copied and paste what you showed. put my information in.

  put the []execVM "signs_flags\flag_check";  in the init.sqf, made a file called flag_check.sqf and put in my signs_flags folder mission side.  

on server side i put the following in a folder called addons and pointed to it from the server_fuctions.sqf

 

/*--------------------------------------------------testing of logo on flag---------------------------------------------------------------*/
 if (isServer) then {
  _vehicle_500 = objNull;
if (true) then
{
  _this = createVehicle ["FlagCarrierWhite_EP1", [13348.2,12058.2,0.00151825], [], 0, "CAN_COLLIDE"];
  _vehicle_500 = _this;
  _this setDir -90.00;
   _this setFlagTexture 'signs_flags\flag.paa';
  _this setPos [13348.2,12058.2,0.00151825];
 
};
  
};
 
The flag.paa:  256x256  10.8kb  and is simple text saying tbsgaming on white back ground
Then i get this lovely message in the RPT file:  Warning Message: Cannot load texture mpmissions\dayz_epoch_17.chernarus\signs_flags\flag.paa
Maybe i missed some thing. Can i send you my pic and you try it, so i can rule it out or in?
Link to comment
Share on other sites

  • 0

i just did this on a flag so i know it works, however, the texture is mirrored on the oppisite site, so dont put an actual flag there or it will look bad.

 

the flag is build server side and flagtexture is set by the server, then effect is global but obviusly the clients needs the texture to see it so you need to share the texture in the mission.

Did you use 200x200 or what? what was the size of your file?(picture)

Link to comment
Share on other sites

  • 0

 

maybe remove a couple of zeros here, this is just retarded ...

 

 

 

you do not need to execute on all clients, it is already mp compatable if set by the owner (in this case the server), so remove the setvehicleinit stuff again and just use:

_this SetFlagTexture "flags\ch.jpg";

 

I got it never to work with _this SetFlagTexture

Thats why i decided to use vehicleinits, and you see the result is:

10bcabd7a4.jpg

Link to comment
Share on other sites

  • 0

Did you use 200x200 or what? what was the size of your file?(picture)

 

yes, 200x200 ... never mind about the ratio, it will fill out when its on the flag

 

 

I got it never to work with _this SetFlagTexture

Thats why i decided to use vehicleinits, and you see the result is:

 

this is on arma 3, but still ... the info is from Operation Flashpoint, my guess is its the same:

 

http://images.akamai.steamusercontent.com/ugc/38623030693270676/8240061A946761A73BE6AA7C0A910B25FE884765/

Link to comment
Share on other sites

  • 0

yes, 200x200 ... never mind about the ratio, it will fill out when its on the flag

 

 

 

this is on arma 3, but still ... the info is from Operation Flashpoint, my guess is its the same:

 

http://images.akamai.steamusercontent.com/ugc/38623030693270676/8240061A946761A73BE6AA7C0A910B25FE884765/

Would you be will to send me the image you used so i could check to see if thats the problem?  if so [email protected]

I tried a 200x200 and still get the error

Link to comment
Share on other sites

  • 0

Thug just a smal question:

Is the Image File actually in your Root Directory of the Mission Folder or is it in another Folder?

Because somestimes files won't load, if in root directory.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Discord

×
×
  • Create New...