"Couldn't resolve state "ready" for image" and icons wont load on item

Author Topic: "Couldn't resolve state "ready" for image" and icons wont load on item  (Read 2103 times)

So I'm working on a phone item / prop mod that has some extremely simple scripting, yet I'm having this error with the addon when loaded:



This second image is the continuation of "Add-Ons/Item_Smartphones/item_PhoneIBlack.cs (0): preload failed for PhoneIBlackImage:"


I'd really love any help for this because I'm damn confused as to what the hell it means and how to fix it.

Model names:
Quote
PhoneIBlack.dts = Phone model made to look like a black iphone, this model is in your hand
PhoneIBlackDisplay.dts = Phone model made to look like a black iphone, this model is only used for display on spawn brick

PhoneIGold.dts = Phone model made to look like a gold iphone, this model is in your hand
PhoneIGoldDisplay.dts = Phone model made to look like a gold iphone, this model is only used for display on spawn brick

PhoneIWhite.dts = Phone model made to look like a white iphone, this model is in your hand
PhoneIWhiteDisplay.dts = Phone model made to look like a white iphone, this model is only used for display on spawn brick

PhoneAGrey.dts = Phone model made to look like a grey andoid phone, this model is in your hand
PhoneAGreyDisplay.dts = Phone model made to look like a grey android phone, this model is only used for display on spawn brick

PhoneARed.dts = Phone model made to look like a red andoid phone, this model is in your hand
PhoneARedDisplay.dts = Phone model made to look like a red android phone, this model is only used for display on spawn brick

PhoneABlue.dts = Phone model made to look like a blue andoid phone, this model is in your hand
PhoneABlueDisplay.dts = Phone model made to look like a blue android phone, this model is only used for display on spawn brick

https://www.dropbox.com/s/8wmw96y41x83k8a/Item_Smartphones.zip?dl=1

Alright got the scripting part, just had to follow this



The icons still won't load, would there be any reason why?

post code for icon part

It's in the download link lol

Code: [Select]
//item_PhoneABlue.cs



//////////
// item //
//////////
datablock ItemData(PhoneABlue)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./PhoneABlueDisplay.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "S: Fast Blue Smartphone";
iconName = "./PhoneABlue.png";
doColorShift = false;
colorShiftColor = "1.0 1.0 1.0 1.0";

// Dynamic properties defined by the scripts
image = PhoneABlueImage;
canDrop = true;
};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(PhoneABlueImage)
{
   // Basic Item properties
   shapeFile = "./PhoneABlue.dts";
   emap = true;


   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeoffset = 0; //"0.7 1.0 0.0";
   rotation = eulerToMatrix( "0 0 0" );

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = true;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = PhoneABlue;
   ammo = " ";
   projectile = gunProjectile;
   projectileType = Projectile;

casing = gunShellDebris;
shellExitDir        = "0.0 0.0 0.0";
shellExitOffset     = "0 0 0";
shellExitVariance   = 0.0;
shellVelocity       = 0.0;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;

   doColorShift = true;
   colorShiftColor = PhoneABlue.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";


   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0]                     = "Activate";
stateSound[0] = weaponSwitchSound;
};

Anyone know why this is happening? The icon is 64x64 and is a png and everything, it should work fine

try doing it without the extension on the end, so it would be:
Code: [Select]
iconName = "./PhoneABlue";
also make sure it is spelled correctly and in the exact same case as it is in the files.

also just as a rule of thumb, always include Add-ons/addon_youraddon/image instead of ./image, as sometimes it won't register correctly in zip files and you'll get a weird error in the chat when you start your server

it might not affect you but it will affect others who download it

try doing it without the extension on the end, so it would be:
Code: [Select]
iconName = "./PhoneABlue";
also make sure it is spelled correctly and in the exact same case as it is in the files.
That's what I did and it is spelled correctly

That's what I did and it is spelled correctly
use an exact path to the file, eg "Add-ons/Item_Props/icon" instead of "./icon". Sometimes that fixes things


also just as a rule of thumb, always include Add-ons/addon_youraddon/image instead of ./image, as sometimes it won't register correctly in zip files and you'll get a weird error in the chat when you start your server

it might not affect you but it will affect others who download it
use an exact path to the file, eg "Add-ons/Item_Props/icon" instead of "./icon". Sometimes that fixes things
Yup this fixed it

Thanks!

also just as a rule of thumb, always include Add-ons/addon_youraddon/image instead of ./image, as sometimes it won't register correctly in zip files and you'll get a weird error in the chat when you start your server

it might not affect you but it will affect others who download it
i never knew this, all this time I've been using ./ for icons and just assumed it was fine as it worked for me.

i never knew this, all this time I've been using ./ for icons and just assumed it was fine as it worked for me.
"./" is the start of where the cs directory is. So let's say we have a zip/folder as "Add-Ons/Weapon_Guns", but the weapon cs is in "Add-Ons/Weapon_Guns/Gun/Gun.cs", and your icon is in "Add-Ons/Weapon_Guns/Icons/"

Doing "./" for the icon will not work in this case because in that cs it starts with "Add-Ons/Weapon_Guns/Gun/" and your icon is in a different folder, so you would need to put the entire file location.

"./" is the start of where the cs directory is. So let's say we have a zip/folder as "Add-Ons/Weapon_Guns", but the weapon cs is in "Add-Ons/Weapon_Guns/Gun/Gun.cs", and your icon is in "Add-Ons/Weapon_Guns/Icons/"

Doing "./" for the icon will not work in this case because in that cs it starts with "Add-Ons/Weapon_Guns/Gun/" and your icon is in a different folder, so you would need to put the entire file location.
that doesn't explain why OP's file worked for me using ./ but not for him. I think phanto was saying that there was a problem with zip files so that it didn't work for some people but not others.

It even works for defaults.