Jump to content

My mod scripts must run always?


majistik

Recommended Posts

Hi,

I made 2 scripts for my angry bird mod.

As i have been instructed all of the scripts are in a quest that runs all of the time.

 

Is there a possibility to (.start) (.stop) the quests at certain situations? My scripts are not doing anything if one of the 8 bows from the mod arent equipped.

 

I tried to (quest.stop) and (quest.start) the quest in a script i entered on the weapon with (on.equip) and (on.unequip) but it doesnt seems to work (i understood the scripts on the weapon are in a container and cannot access some stuff, is this true to quests aswell - or it is suppose to work?)

 

What can I do? Thanks :psyduck:

Edited by majistik
Link to comment
Share on other sites

The onequipped and onunequipped events should still fire - they do every time an item is equipped or unequipped. After that the item is considered to be inside a container and so (if a script is attached to it) can't call any member functions (unless it's a persistent ref I think). For a start/stop script attached to the item, make sure your quest is declared as a property (quest property questname auto - and fill in that property to point to your quest), after that you should be able to call questname.stop() and questname.start()

 

Alternatively, I think it's fairly safe to let the quest just run, however, if you don't want your script (which IIRC has many many checks for certain item types in the player inventory) to eat processor cycles you'll probably have to move to using states, one state to do a quick check if one of your bows is equipped (perhaps use a keyword on the bows so you can just do one check) and if it is, move to the second state where you start doing checks on inventory etc. until the item is unequipped again, at which point you move to the initial state.

 

http://www.creationk...s_%28Papyrus%29

 

I usually provide the user with a config book/spell which allows for manual control over the quest for upgrade/uninstall purposes via a menu.

 

You can also cut down on script processor intensity by replacing the game.getplayer() calls (which asks the game engine "hey, which guy is the player again" every single time) by either referring to the quest player alias (which you have declared) or declaring an Actor Property PlayerRef Auto and then referring to PlayerRef.

 

See alsothis interesting best practices thread.

 

I'm not sure if repeated If-Endifs are less efficient than If-ElseIf-ElseIf-EndIf statements though.

Edited by acidzebra
Link to comment
Share on other sites

The onequipped and onunequipped events should still fire - they do every time an item is equipped or unequipped. After that the item is considered to be inside a container and so (if a script is attached to it) can't call any member functions (unless it's a persistent ref I think). For a start/stop script attached to the item, make sure your quest is declared as a property (quest property questname auto - and fill in that property to point to your quest), after that you should be able to call questname.stop() and questname.start()

 

Alternatively, I think it's fairly safe to let the quest just run, however, if you don't want your script (which IIRC has many many checks for certain item types in the player inventory) to eat processor cycles you'll probably have to move to using states, one state to do a quick check if one of your bows is equipped (perhaps use a keyword on the bows so you can just do one check) and if it is, move to the second state where you start doing checks on inventory etc. until the item is unequipped again, at which point you move to the initial state.

 

http://www.creationk...s_%28Papyrus%29

 

I usually provide the user with a config book/spell which allows for manual control over the quest for upgrade/uninstall purposes via a menu.

 

You can also cut down on script processor intensity by replacing the game.getplayer() calls (which asks the game engine "hey, which guy is the player again" every single time) by either referring to the quest player alias (which you have declared) or declaring an Actor Property PlayerRef Auto and then referring to PlayerRef.

 

See alsothis interesting best practices thread.

 

I'm not sure if repeated If-Endifs are less efficient than If-ElseIf-ElseIf-EndIf statements though.

 

Thanks again for a great reply, however im interested in the most simple form which you said is possible - quest start and end on item equip. One more question, does quest.stop() clear the script from the memory? or sould i finish the quest and make it repeatable?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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