Jump to content

Multiple 'Begin' blocks won't run


Recommended Posts

Okay so I'm trying to make a script that forces the player to equip an item at a specific time and remove it at another time. Had a hell of a time getting it to even do anything, and right now I'm using an 'onpackagestart' and 'onpackagedone' thing.

 

This seems to work okay to begin with, the first block (Begin onpackagestart ~~ - player.additem ~~ - player.equipitem ~~ - end)

That part works fine and the item is added and equipped.

 

The difficulty is that the game seems to refuse to run the next block of the script which is basically identical except for running 'onpackagedone' and unequiping/removing the items.

 

After playing around a bit I've found out that this script just refuses to run anything beyond the first block and I have no idea what could cause that. I have other scripts in the same mod which have multiple begin/end blocks, there are a half dozen so long that they exceeded the maximum script length and they have no problem.

 

I'm currently running the up to date oblivion and the latest stable OBSE.

 

Any thoughts on what could be causing this would be greatly appreciated. Thanks

Link to comment
Share on other sites

Hmm. This might be a normal CS limitation, but I'm not sure. I always try to fit my scripts in one block, so I haven't encountered such problems before.

 

Can you show us that script?

 

The problem might be in there; some functions also act as a 'Return' command, so it could be that a function you used causes the Oblivion engine to go back to the beginning of the script over and over.

Link to comment
Share on other sites

begin onpackagestart PossumCrafterSleep

messagebox "woot"

player.additem possumwerewolfform 1

player.equipitem possumwerewolfform 1

player.additem possumwerewolfsmask 1

player.equipitem possumwerewolfsmask 1

end

 

begin onpackagedone PossumCrafterSleep

messagebox "Weej"

player.unequipitem possumwerewolfform

player.removeitem possumwerewolfform 1

player.unequipitem possumwerewolfsmask

player.removeitem possumwerewolfsmask 1

end

 

 

Thats the script. It just the bones atm, I always get the basics working then flesh them out. The messageboxes are just in there to make it easier for me testing it.

Link to comment
Share on other sites

What is this script attached to?

 

Sleep packages, like wander packages do not ever complete as they are ongoing states.

 

Using something like this which causes a change to the player based on when an actor does a package is probably a very bad idea since packages are not particularly reliable. If the NPC is in the active area, where the player is, it may take several minutes to trigger the package. If the NPC is in another cell, it can take hours or simply never trigger the package. Packages never run on the player.

Link to comment
Share on other sites

It's attached to an actor who just uses package (sleep) from 22.00 for 8 hours. Like I said, I was having massive trouble getting anything to work using the 'gamehour' or 'getcurrenttime' functions. I'll fiddle around a bit more today and see what I can come up with.
Link to comment
Share on other sites

I could certainly use some help! I'm just trying to have a script force the place to equip something between 10pm and 5am~ and remove it outside those times.

 

I'm not sure if I'm doing something wrong but I've tried using;

 

If gamehour >= 22 && <= 5

 

If getcurrentime >= 22.00 && <= 5.00

 

(short time) set time to (getcurrenttime)

if time >= 22.00 && <= 5.00

 

 

 

If you could please suggest a script that works for you, I can check if its just a bug with my editor/game or if the problem lies between the seat and keyboard.

 

Thanks in advance =]

Link to comment
Share on other sites

How about:

Scn EquipStuffScript

Short Equipped

Begin GameMode

If GameHour >= 22 && GameHour <= 5
Player.AddItem ColovianSignetRing 1
Player.EquipItem ColovianSignetRing
Set Equipped to 1
ElseIf GameHour <= 22 && GameHour >= 5 && Equipped == 1
Player.UnequipItem ColovianSignetRing
Player.RemoveItem ColovianSignetRing 1
Set Equipped to 0
EndIf

End

Make sure this is a quest script and attach it to a new quest (just set the priority to 60).

 

I haven't tested this, and I'm a bit sleepy at the moment so I could have made a very stupid mistake, but I think this should do the job just fine.

Link to comment
Share on other sites

How about:

Scn EquipStuffScript

Short Equipped

Begin GameMode

If GameHour >= 22 && GameHour <= 5
Player.AddItem ColovianSignetRing 1
Player.EquipItem ColovianSignetRing
Set Equipped to 1
ElseIf GameHour <= 22 && GameHour >= 5 && Equipped == 1
Player.UnequipItem ColovianSignetRing
Player.RemoveItem ColovianSignetRing 1
Set Equipped to 0
EndIf

End

Make sure this is a quest script and attach it to a new quest (just set the priority to 60).

 

I haven't tested this, and I'm a bit sleepy at the moment so I could have made a very stupid mistake, but I think this should do the job just fine.

 

This should be

 

Scn EquipStuffScript

Short ringworn

Begin GameMode

If GameHour > 22 || GameHour < 5 && ringworn == 0
Player.AddItem ColovianSignetRing 1
Player.EquipItem ColovianSignetRing
Set ringworn to 1
ElseIf GameHour <= 22 && GameHour >= 5 && ringworn == 1
Player.UnequipItem ColovianSignetRing
Player.RemoveItem ColovianSignetRing 1
Set ringworn to 0
EndIf

End

Begin MenuMode 1012;; so that it runs while the player is sleeping/waiting

If GameHour > 22 || GameHour < 5 && ringworn == 0
Player.AddItem ColovianSignetRing 1
Player.EquipItem ColovianSignetRing
Set ringworn to 1
ElseIf GameHour <= 22 && GameHour >= 5 && ringworn == 1
Player.UnequipItem ColovianSignetRing
Player.RemoveItem ColovianSignetRing 1
Set ringworn to 0
EndIf

End

 

using a conditional OR instead of an AND in the first condition, and removing the "=" to avoid looping. the game hour cannot be greater than 22 AND less than 5, it needs to be greater than 22 OR less than 5. If if the first condition does not trigger, the second one will not. Changed the variable name to reduce chance of function confusion or variable conflicts. Used variable in first condition to prevent doubling if the remove portion were skipped due to some other script changing time.

 

Item name should be replaced with the 8 number FORM ID of the item you want to use. Using the editor ID only works with certain functions.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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