Cannot spawn custom item created with item wizard
Forge
Member Posts: 32
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?
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?
0
Comments