Need scripting help w torches+disableenable.

Post » Sun Mar 27, 2016 2:54 am

I'm trying to make an Oblivion mod very similar to my Skyrim mod. Skyrulianfield which makes armies of undead hunt the player at night if you go without a torch outside of cities and outside of player houses. Because Oblivion has no LocationTypeKeyword setting unlike Skyrim, I had to do it slightly differently, where these undead can't open doors. Consequently these type run on a follow player package similar to their Skyrim counterparts, however, where as their Skyrim counterparts AI package conditions prevent them from following a torch carring player, it just does not work the same for Oblivion. I tried both something like Player.Getequipped Torch0 =0 as well as Player.HasTorchOut=0- and neither for the AI packages has worked, even though the exact same thing worked easily for Skyrim. I suppose it's just Skyrim's Creation Kit being more convenient than the Oblivion Construction Set.



Anyways here's the script, I use a total of 7 different script. Each day has it's own unique army of undead where Morndas/Monday is replaced with the other days of the week, so one specific army of undead is scripted to pursue the player each day, with 7 total armies.



scriptname AAATehZomberStalkern

begin gamemode

if gamehour >= 19 || gamehour < 7
GetDayOfWeek(1) == 1 ; Morndas
enable
else
disable
endif

end

I want to alter this script, and the 6 other nearly identical scripts, where these undead get disabled if the player has their torch out, and then get re-enabled if you put down your torch AND it is the specific day/hour of the script. After doing a forum search of a GetEquipped script here is how I attempted to alter it, as I do make use of searches before asking questions.



scriptname AAATehZomberStalkern

begin OnEquip


If ( player.GetEquipped Torch02 == 1 )

Disable
else
Enable
endif
end


begin gamemode

if gamehour >= 19 || gamehour < 7
GetDayOfWeek(1) == 1 ; Morndas
enable
else
disable
endif

end

Good news: Not a single compiling error. Bad News: I tested this script, and the torch had no effect, equipping it didn't disable them. My goal with these scripts is for these undead to ONLY be enabled at a specific time on their own respective day and ONLY when the player isn't holding a torch. If you equip a torch they should remain disabled, or disappear suddenly if you are holding one if you unequip the torch and it's night time they become enabled again, but if you unequip it during the day, or on the day another undead army is active, they won't show up.



Anyways... Can someone please help me make this script work successfully? I'll highly appreciate it, and I'll be sure to credit you for scripting help when I release this mod.

User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Post » Sun Mar 27, 2016 6:04 am

In your first script, this IF works: if GetDayOfWeek == 1 && PlayerRef.GetEquipped Torch02 == 1 && (gamehour >= 19 || gamehour < 7)



(btw, I don't understand that "GetDayOfWeek(1) == 1 ; Morndas". It does compile, but I am not sure what are the effects in game)



I've just found out that GetDayOfWeek has a glitch: it is updated at midnight, but it does not check the date, so, if some mode changes the game date, the day of the week does not get updated and they may no longer be aligned.

User avatar
CHANONE
 
Posts: 3377
Joined: Fri Mar 30, 2007 10:04 am

Post » Sun Mar 27, 2016 8:43 am


Thanks- I'll be sure to mention your scripting advice when I release this mod. :goodjob: :celebration: These undead are now enabled/disabled by the torch as well as the specific time.

User avatar
FITTAS
 
Posts: 3381
Joined: Sat Jan 13, 2007 4:53 pm


Return to IV - Oblivion