Aller au contenu

Photo

random script firing


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
seventh_son

seventh_son
  • Members
  • 37 messages
I am using a campfire system that I created that when you use flint it creates a campfire that is restable, the campfire is a system off the vault but the flint is of my design. My problem is that when I buy a piece of flint it creates a campfire next to one of the other players in the mod... I think it may be the script I use to create a campfire when the flint is used, but I dont know. If anyone can help me I would appreciate it, I will post the scipt i use to create a campfire when the flint is used...

void main()
{
object oPC;

object oTarget;
object oSpawn;
location lTarget;
oPC = GetItemActivator();

lTarget = GetItemActivatedTargetLocation();

oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "rr_campsite", lTarget);

}

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
It's because of tag based scripting(The tag of the item being the same as the name of the script). The script is firing because with tag based scripting it fires for the OnAcquire event as well. And OnUnacquire, OnEquip/UnEquip, etc. So you have to put a check at the top of these scripts to make sure it only fires for the event you want it to fire for. In this case your script with the necessary changes would look like this:

#include "x2_inc_switches"
void main()
{
if (GetUserDefinedEventNumber() != X2_ITEM_EVENT_ACTIVATE)return;
object oPC;

object oTarget;
object oSpawn;
location lTarget;
oPC = GetItemActivator();

lTarget = GetItemActivatedTargetLocation();

oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "rr_campsite", lTarget);

}

Hope that helps.

Modifié par GhostOfGod, 05 septembre 2010 - 04:30 .


#3
seventh_son

seventh_son
  • Members
  • 37 messages
that is exactly what i was looking for. I had a similar problem a while ago, and had a fix for it, but lost the script.... this is great, Thanks for the help...