You guys are going to hate me... as I have explained before I am not a scripter, I can muddle my way through a script and figure out what if will do, but cant write a script from scratch. Anyway I need some help with at least 4 more scripts, most of them may even be the same issues... basically what happens with all of the is when I buy an item say flint that I can use later to create a campfire, or a tent for later resting. a tent or a campfire will randomly appear somewhere else in the mod near another player. or with the tent when clicked later to open a convo to ask the player to pack up the tent it packs up the tent and then right away spawns in another tent in front of the player... It may also be an Onaquire or Onactivate Mod script, I can send thos along as well if you wan to look at that...
Script one: This is my camfire script that when you use flint, a campfire appears next to the player...
#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);
}
script two: This is my tent script, in a convo, that asks you to pack up the tent, when you do,this script fires and it spawns in another tent in front you and puts the tent bundle back in your inventory...
#include "x2_inc_switches"
void main()
{
if (GetUserDefinedEventNumber() != X2_ITEM_EVENT_ACTIVATE)return;
object oPC = GetPCSpeaker();
object oTarget;
oTarget = OBJECT_SELF;
DestroyObject(oTarget, 0.0);
//Give Item
CreateItemOnObject("geo_tent", oPC);
}
and finally my Horse script... When I buy a horse mount/dismount tool from a merchant, it immediatly opens the convo that lets you mount/dismout your horse...
#include "x2_inc_switches"
void main()
{
if (GetUserDefinedEventNumber() != X2_ITEM_EVENT_ACTIVATE)return;
object oPC;
object oTarget;
oPC = GetItemActivator();
//The PC will technically start a conversation with himself
//You should add some odd little sound to the first line in the
//conversation file, or the PC will give his normal voicegreeting.
oTarget = oPC;
AssignCommand(oTarget, ActionStartConversation(oPC, "luc_convo"));
}
item based script help...
Débuté par
seventh_son
, sept. 07 2010 02:10
#1
Posté 07 septembre 2010 - 02:10
#2
Posté 07 septembre 2010 - 02:23
You should probably check your script in your "OnModuleLoad" event. Check to see if it has this line:
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
And that it is uncommented (no "//" in front of it).
SetModuleSwitch (MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS, TRUE);
And that it is uncommented (no "//" in front of it).
#3
Posté 07 septembre 2010 - 02:26
it is in there and it is uncommented
#4
Posté 07 septembre 2010 - 02:33
Ok. Now does each item that you activate have it's own unique tag and each of the names of the scripts that go along with the items match exactly the tag of these items? They need to be unique. Unless you want several items to run the same script...but that's another matter.
Modifié par GhostOfGod, 07 septembre 2010 - 02:33 .
#5
Posté 07 septembre 2010 - 02:35
yes they items being used each have a unique tag and the script firing is the same as the tag of each of the unique items...
#6
Posté 07 septembre 2010 - 02:38
Are you using custom scripts for your module events, such as the "OnActivateItem"?
#7
Posté 07 septembre 2010 - 02:40
yes... I am. I figured that might be part of the problem but the script is huge and didnt want to post it here...
#8
Posté 07 septembre 2010 - 02:44
Don't worry about posting it just yet. Let's take a look at the first script first. Just looking at this script it should technically work if you are using it as intended.
So with this first script, the player uses an item(flint) and then select a location on the ground to put it, and then a campfire should appear on the ground at that location? If this is not happening then what are the exact issues with this one?
So with this first script, the player uses an item(flint) and then select a location on the ground to put it, and then a campfire should appear on the ground at that location? If this is not happening then what are the exact issues with this one?
#9
Posté 07 septembre 2010 - 02:47
well, actually when I wrote it that was my intent. I wanted to choose a location for the campfire, but when i use the item it automatically spawns a campfire right away. I was willing to live that, Small issue... but the real issue with that script is that when I buy the flint at a store, a campfire will immediatly spawn in with my using a flint near another player somewhere else in the mod.
#10
Posté 07 septembre 2010 - 02:52
Ok. For this particular one, check out its item properties and make sure you are using Cast Spell: Unique power. Not Unique power self only. And then of course make sure you edit it to how many uses you want.
Modifié par GhostOfGod, 07 septembre 2010 - 02:53 .
#11
Posté 07 septembre 2010 - 02:56
ok, so It was "Unique power" self only, I switched it to "Unique power", interesting that i didnt notice that one...
#12
Posté 07 septembre 2010 - 02:59
No worries. I do that kind of stuff all the time. Hopefully that fixes that problem.
#13
Posté 07 septembre 2010 - 03:02
that isse with the flint and campfire is more of a random thing... but the tent and the mount/dismount scripts are real issues...
#14
Posté 07 septembre 2010 - 03:02
Now lets go on to the second script you posted. This is the tent item. But first if you could explain exactly what you want to happen, when you use this item. Is it supposed to create the tent? Or start a conversation? Do you only want it to spawn at the player location or do you want to be able to select a location like the campfire? etc...
Modifié par GhostOfGod, 07 septembre 2010 - 03:03 .
#15
Posté 07 septembre 2010 - 03:09
ok, bare with me here...lol. A player buys a rolled up tent, it is single use only... When he uses the rolled up tent, he picks a spot to pitch a tent. The tent appears allowing the player to rest. When the player is finished resting, he clicks on the tent opening a convo... in the convo the player can choose to pack up the tent or do nothing... if he picks to pack up tent, this script fires that destroys the tent he spawned in and gives another rolled up tent in the players inventory. the problem is that when the player choses to pack up the tent, the tent is destoyed and the rolled up tent is placed back in the players inventory but then another tent placeable spawns back in where the other one was.
#16
Posté 07 septembre 2010 - 03:25
Yeah. That sounds like the "geo_tent" script is firing when the player Acquires the item as well. So if you are using that script, with the event check in it, then you probably have something going on with the other custom module event scripts. Probably some lines in them that say things like:
object oItem = GetItem......;
ExecuteScript(GetTag(oItem), OBJECT_SELF);
This was the older method of doing the tagbased scripting. And now using the 2 methods together causes the issues you are describing. There might not be an easy fix here though. Changing these custom event scripts will probably make a bunch of other stuff quit working if it depends on using that older method.
object oItem = GetItem......;
ExecuteScript(GetTag(oItem), OBJECT_SELF);
This was the older method of doing the tagbased scripting. And now using the 2 methods together causes the issues you are describing. There might not be an easy fix here though. Changing these custom event scripts will probably make a bunch of other stuff quit working if it depends on using that older method.
#17
Posté 07 septembre 2010 - 03:29
yes I do use systems with those lines... any ideas... i think one is CNR and the other is a RUNE book of recall I think.
#18
Posté 07 septembre 2010 - 03:34
Well..You could try and comment out the "ExecuteScript" lines and see what happens. Can always undo it if something else quits working. I'm not familiar with those other systems but there is a chance that they will still work since you have tag based scripting turned on.
#19
Posté 07 septembre 2010 - 03:39
I can try that, the problem is that CNR is a full crafting sytem, it might take some time to test it and see if it will work with the tag based execute script commands commented out...
#20
Posté 07 septembre 2010 - 03:49
well, I thank you all for your help, It may just be that i am tired but I think rather than screw with these issues that I dont understand completely, I may just start over and keep it simple. sinse I am so early in the process I should be ok.
Again, thanks for your help.
Again, thanks for your help.
#21
Posté 07 septembre 2010 - 03:50
Ultimately using both methods is just going to keep causing problems with current systems and any future tag scripting you do. Unfortunately that is one of the problems with using some older systems that require altering your default module events.
One other thing that you could do in those custom event scripts is try putting an exclude list before you execute the script. Something like:
If (GetTag(oItem) == "geo_tent" ||
GetTag(oItem) == "xxxxxxx" ||
GetTag(oItem) == "xxxxxxxxxx") return;
Try putting something like that right above the ExecuteScript line. Just keep going with it and put in the tags of the items that you do NOT want to be firing from this event. This way, if the tag of the item matches one of these tags then the script will just end.
Hope that helps. Good luck.
One other thing that you could do in those custom event scripts is try putting an exclude list before you execute the script. Something like:
If (GetTag(oItem) == "geo_tent" ||
GetTag(oItem) == "xxxxxxx" ||
GetTag(oItem) == "xxxxxxxxxx") return;
Try putting something like that right above the ExecuteScript line. Just keep going with it and put in the tags of the items that you do NOT want to be firing from this event. This way, if the tag of the item matches one of these tags then the script will just end.
Hope that helps. Good luck.
Modifié par GhostOfGod, 07 septembre 2010 - 03:56 .
#22
Posté 07 septembre 2010 - 04:01
hhmmm.. not sure what you mean, in what script should I place these lines? and what exactly will they do with the old system of item scripting...?
#23
Posté 07 septembre 2010 - 04:13
You would put them in your custom scripts for your module events. Take the "OnAcquireItem" event for example. You said you have some custom event scripts with lines like:
object oItem = GetItem......;
ExecuteScript(GetTag(oItem), OBJECT_SELF);
Well if you did something like this:
object oItem = GetItem......;
If (GetTag(oItem) == "geo_tent" ||
GetTag(oItem) == "xxxxxxx" ||
GetTag(oItem) == "xxxxxxxxxx") return;//this is what makes the script stop
ExecuteScript(GetTag(oItem), OBJECT_SELF);
Then the custom event script would just stop before the execute script line runs the tag script for your items.
object oItem = GetItem......;
ExecuteScript(GetTag(oItem), OBJECT_SELF);
Well if you did something like this:
object oItem = GetItem......;
If (GetTag(oItem) == "geo_tent" ||
GetTag(oItem) == "xxxxxxx" ||
GetTag(oItem) == "xxxxxxxxxx") return;//this is what makes the script stop
ExecuteScript(GetTag(oItem), OBJECT_SELF);
Then the custom event script would just stop before the execute script line runs the tag script for your items.
Modifié par GhostOfGod, 07 septembre 2010 - 04:16 .





Retour en haut






