Jump to content

Scripting help with enabling


Recommended Posts

So... once again, I'm going crazy with minimal scripting.
Everything left to do for a mod I have is the scripting part. All I need to do is enabling an initially disabled XMarker, with all its children objects, to enable upon the death of two specific npcs.
I have no clue to how are you supposed to do it.
Thanks in advance on who can help me here.

Link to comment
Share on other sites

Multiple ways to do this. One could be:

 

Create two new scripts for each NPC like this:

Begin OnDeath
if otherNPCRef.getdead == 1
MyXMarkerRef.enable
endif
End

You could also use otherNPC.getdeadcount > 0 if you fancy that more.

This method works best if the NPCs are supposed to be killed by the player or during his presence. If they can or are supposed to die "off-screen" then another method using a quest script would be better.

Edited by mixxa77
Link to comment
Share on other sites

Multiple ways to do this. One could be:

 

Create two new scripts for each NPC like this:

Begin OnDeath
if otherNPCRef.getdead == 1
MyXMarkerRef.enable
endif
End

You could also use otherNPC.getdeadcount > 0 if you fancy that more.

 

This method works best if the NPCs are supposed to be killed by the player or during his presence. If they can or are supposed to die "off-screen" then another method using a quest script would be better.

I was trying to make something like that work, but while writing it I had a very stupid but haunting question

Does the script fail to load on other player's systems due to how the esp load order work?

Meaning if the ref id has the 01 digits at the start, so on my script I write the 01 too, do those two digits can change on other people's system, if the esp load order is for example set to a 6a digit, thus making the script useless?

 

I hope I made myself clear enough

Link to comment
Share on other sites

A fair question. If that is an issue, then it is being solved or circumvented by doing it the human way: Using names instead of numbers. You can give references unique names of your choosing, you do so this way:

 

Double click a world reference (your XMarker or the NPCs) and enter a custom "Reference Editor ID" of your choosing (It is one of the few fields you can edit when double-clicking a reference). This name has to be unique, so be creative, like "Mixxa77ModnameFlaviusHonoriusREF". The only thing that matters is that it's unique and at best descriptive for you to easily remember.

 

You can then use these reference "names" in your scripts instead of their IDs.

Edited by mixxa77
Link to comment
Share on other sites

A fair question. If that is an issue, then it is being solved or circumvented by doing it the human way: Using names instead of numbers. You can give references unique names of your choosing, you do so this way:

 

Double click a world reference (your XMarker or the NPCs) and enter a custom "Reference Editor ID" of your choosing (It is one of the few fields you can edit when double-clicking a reference). This name has to be unique, so be creative, like "Mixxa77ModnameFlaviusHonoriusREF". The only thing that matters is that it's unique and at best descriptive for you to easily remember.

 

You can then use these reference "names" in your scripts instead of their IDs.

I seem to be having a problem here: i can't seem to make the scripts work

 

 

I written the two scripts as follow

 

|

 

ScriptName AAAEnableNecroShack

 

BeginOnDeath

 

if AAALouiseDelacroix.getdead == 1

AAANecroShackEnabler.enable

 

endif

End

 

-----------

 

ScriptName AAANecroShackEnable2

 

BeginOnDeath

 

if AAAAlkasAyorus.getdead == 1

AAANecroShackEnabler.enable

 

endif

End

 

|

 

Both the scripts are set to object and assigned to the NPC with the opposite name, but when I do the testings and kill them both, the objects do not appear, but can be forced to appear through the use of Console Commands.

 

I have no idea what is the problem here, and i've spent almost two hours trying to figure this out :sad:

Edited by 9zAZO
Link to comment
Share on other sites

Such is the fun of troubleshooting and testing.

 

Then we have to go a different way.

 

Another possible way would be to use the same script for both NPCs that reads:

Begin GameMode
if NPC1.geatdead == 1 && NPC2.getdead == 1
MyXMarker.enable
endif
End

 

If that also doesn't work, a questscript would probably be needed. For such, create a new quest with the "Enabled at game start" flag checked and attach a questscript to it that reads the following (Same as above):

Begin GameMode
if NPC1.geatdead == 1 && NPC2.getdead == 1
MyXMarker.enable
StopQuest MyNewQuest
endif
End

If you have any questions about the questscript approach or it's (supposed) workings, feel free to ask.

 

 

The issue might also just be a need for a cell change? Maybe the linked items will only enable properly when the cell is loaded again.

Link to comment
Share on other sites

Hey, I am bad at scripting but maybe instead gamemode script from a hidden quest, make a result script on hidden quest that will execute once for better performance(im not sure how fragile oblivion is)?

 

on both targets

begin OnDeath

 

if getstage questenabler < 10

setstage questenabler 10

else

setstage questenabler 20

endif

 

 

and on quest stage 20

 

something.enable

Stopquest questenabler

 

But i haven't done something like this so idk if it would work.

Edited by mythlessninja
Link to comment
Share on other sites

I decided to reduce the required npcs to one, remove the if statement and go with the Begin on Death function on the single npc
Tested out and it's working, so I'm taking the easy route on this XD
Thanks for the help ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...