Posted September 02, 2014
I wrote a script that allows you to activate a bundle of firewood and spawn a campfire if you have a piece of flint in your inventory. Without the flint you just get a message saying that you need flint to start a campfire. Well, the activate function in the firewood's properties is set to single use. So, even if you don't have flint you still lose your bundle of firewood. So, I added a line to add a bundle of firewood back to your inventory if you don't have flint. But now when I activate the firewood in the game without flint it fills my entire inventory up with bundles of firewood. Here's the script. Can someone please tell me what I did wrong. Thanks!!
#include "x2_inc_switches"
void main()
{
object oSpawn;
// Get the creature who triggered this event.
object oPC = GetItemActivator();
// Abort if the PC does not have the item Flint.
if ( GetItemPossessedBy(oPC, "jw_flint") == OBJECT_INVALID )
{
CreateItemOnObject("jw_firewood", oPC, 1);
SendMessageToPC(oPC, "You need a piece of flint to start the fire.");
return;
}
// Spawn Campfire.
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "jw_campfire", GetLocation(oPC));
}
#include "x2_inc_switches"
void main()
{
object oSpawn;
// Get the creature who triggered this event.
object oPC = GetItemActivator();
// Abort if the PC does not have the item Flint.
if ( GetItemPossessedBy(oPC, "jw_flint") == OBJECT_INVALID )
{
CreateItemOnObject("jw_firewood", oPC, 1);
SendMessageToPC(oPC, "You need a piece of flint to start the fire.");
return;
}
// Spawn Campfire.
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "jw_campfire", GetLocation(oPC));
}
No posts in this topic were marked as the solution yet. If you can help, add your reply