Skip to content

Cannot spawn custom item created with item wizard

I made an item which will not spawn after script is executed, and Item does not appear in Dungeon Master creator tree after compiling module. Item appears in the editor custom items tree and can be planted on the ground.

Script below:


void main()
{


object oTarget = GetLastUsedBy(); //setup object Player character
object oSelf = OBJECT_SELF; //setup The plant placeable in the area
string sItemTemplate1 = "LeafWrtLeaf"; //String for the item to spawn after harvesting
int nStackSize = 1; //Stack size for the required function
int nAnimation = ANIMATION_LOOPING_GET_LOW; //Animation for player character




if(GetIsObjectValid(GetItemPossessedBy(oTarget, "HerbKnife"))== TRUE){ //Function that checks if player has the item required for harvesting

AssignCommand(oTarget, ActionPlayAnimation(nAnimation, 1.0, 1.0)); //Function to animate player character
ActionSpeakString("You harvest the Leafwort leaves"); // Function to tell the player if harvesting was succesful


CreateItemOnObject(sItemTemplate1, oTarget, nStackSize); //Function to spawn the item (leaves from plant)

DestroyObject(oSelf, 1.0f); //Destroy the placeable after harvesting

}


else //Check if no knife

ActionSpeakString("You lack the proper tool to harvest this plant for leaves"); //Function to tell player if hasnt got required item for harvesting





}



Script works with a bottle of ale correctly


Why the custom item doesnt work?

Comments

  • ProlericProleric Member Posts: 1,316
    Your value for sItemTemplate1 contains uppercase, which makes me think it might be the tag. That won't work, because the function is expecting the resref (a lower case string) not the tag.
  • ForgeForge Member Posts: 32
    It worked, thankyou. I thought it would require a tag instead of resref.
Sign In or Register to comment.