Want to blend script into my OnActivateItem script

Can someone please help me incorporate the script in the zipped attachment into my OnActivateItem script I also have in the same zipped folder. I can’t post the script it is too lengthy apparently.

Please

OnActivateItem Script.zip (9.6 KB)

After some adjusting, I moved the gun bits into your impressive OnActivate script. I put them above the last section. It compiled but I couldn’t test to see if these things could actually work. Hoping it does.
OnActivateItemEdited.zip (8.2 KB)

hey thanks Mannast…much appreciated. I will test it. Thanks bud.

Well everything worked (I have some stuff in there that still do not work as they should…i.e. the powderkeg explodes but the placeable does not dissapear, portable gate can’t be dismissed after using it, etc), but only one issue with this script redo…that is my intelligent sword Lilicor was disabled I think because of the intelligent weapon script part.

Thanks for doing this anyways bud.

1 Like

For myself, I tend to keep the OnEvent scripts like this as wrapper files that call other scripts. This way, I avoid trying to figure out how to fit them all together in one ever-lengthening script. For example, this is my OnActivate script for one of my modules:

//"wrap_activate" Scry and Teleport System v.0.8.2 by Mannast 3/20/2013
//sample wrapper script if copyng into your own wrapper, copy these includes and then the Scry Device section below
#include "x2_inc_switches"
void main()
{
    object oSelf = GetItemActivated();
    string sTag = GetTag(oSelf);
    if(GetStringRight(sTag, 7)=="scrydev") ExecuteScript("scry_device", oSelf);
    if(GetStringRight(sTag, 7)=="MSHtool") ExecuteScript("harvest_gen_tool", OBJECT_SELF);
    if(GetStringLeft(sTag, 10)=="HorseToken") ExecuteScript("horse_tool", OBJECT_SELF);
//default OnActivate script - no need to copy this into your own custom wrapper
//ExecuteScript("x2_mod_def_act", OBJECT_SELF);//replaced by "zep_on_activate2"
    ExecuteScript("zep_on_activate2",OBJECT_SELF); // CEP2.3 CRAP
    ExecuteScript("cf_mod_act_item",OBJECT_SELF); //Camping and Resting System
    ExecuteScript("htf_mod_act_item",OBJECT_SELF); //HTF System
    ExecuteScript("htf_fishing",OBJECT_SELF);  //HTF Fishing System
    ExecuteScript("im_nav_lock", OBJECT_SELF);//Inter Module Syste Lock item for DMs
    ExecuteScript("cnr_module_onact",OBJECT_SELF);//CNR
    ExecuteScript("dmfi_activate_ed", OBJECT_SELF);//DMFI modification
}

This keeps all the processes separate and easier to figure out. You will also note that I don’t have to have all those other include scripts. Of course, once you “frankenstein” a big script together like the one you have, it is hard to break it up again into manageable parts. Something to think about if you need to rebuild.

1 Like

Wow, impressive.

There are so many times where I would like to start fresh all over again with a new module. But, having invested over 20 years on this module…I feel I can’t do another 20 years for a new one…lol

I wish I had 1/10th your skills…nice that your module runs so clean.

1 Like

So I went in and wanted to try to clean this up and present it in a cleaner format. I would do a “save as” to see if any of this works before importing it. As I don’t have all the includes, I can’t test if any of it works, just get it cleaned up. I broke out three sections for their own scripts - the black powder, the horse scripts and the UIAS stuff at the end - and made ExecuteScript calls for them. I organized the ExecuteScript calls all together at the top and then went through to remove extra stuff which had taken over much of the rest of the script. Hopefully, it works as you intended, and still has your intelligent sword work, too! The erf import shouldn’t overwrite anything. You would then change your module OnAct script to “wrap_mod_onact” and see if things run.
onact_clean.zip (14.8 KB)

Thanks Mannast,

I will test it later today…can’t wait. :slight_smile:

Ah bummer. On my preliminary test…I tested 5 items …none of them worked :frowning:

Darn!- it is likely something simple I missed or messed up. Which items did you try, out of curiosity? And I am assuming you did a full script build after importing and changing the scripts.