Need help scripting please

Oblivion and Oblivion mod discussion. No adult content, please.

Need help scripting please

Postby Spirited Treasure » Thu May 02, 2013 9:47 am

Done some research and am hopeful that this may work. However I am no scripter and this is for Oblivion.

First the research

http://cs.elderscrolls.com/index.php/GetIsRace
http://cs.elderscrolls.com/index.php/GetPCIsRace

http://cs.elderscrolls.com/index.php/Sp ... ext=Search

Now the script:
Code: Select all
begin RaceCheck

;global script that gets run once to check the PC's race, so it can be used in dialogue

if ( Player.GetIsRace "Argonian" == 1 )
   set PCRace to 1

elseif ( Player.GetIsRace "Breton" == 1 )
   set PCRace to 2
 
elseif ( Player.GetIsRace "Dark Elf" == 1 )
   set PCRace to 3

elseif ( Player.GetIsRace "Your Race" == 1 )
   set PCRace to 8

elseif ( Player.GetIsRace "High Elf" == 1 )
   set PCRace to 4

elseif ( Player.GetIsRace "Imperial" == 1 )
   set PCRace to 5

elseif ( Player.GetIsRace "Khajiit" == 1 )
   set PCRace to 6

elseif ( Player.GetIsRace "Nord" == 1 )
   set PCRace to 7

elseif ( Player.GetIsRace "Orc" == 1 )
   set PCRace to 8

elseif ( Player.GetIsRace "Redguard" == 1 )
   set PCRace to 9

elseif ( Player.GetIsRace "Wood Elf" == 1 )
   set PCRace to 10

endif

stopscript RaceCheck



end


Thanks for any help -s-
I am but a fragment cast apart from the whole.
A bit of flotsam to cling to in the storm.

I am a fly in the ointment, I am a whisper in the shadows.
I am also an old old woman. More than that you need not know.

Step carefully. No path is darker than when your eyes are shut.
-Flemeth, Asha'Bellanar, Witch of the Wilds
User avatar
Spirited Treasure
Defender
 
Posts: 928
Joined: Sun Nov 11, 2012 11:45 am
Title: Free Spirit
Gender: Female

Re: Need help scripting please

Postby Spirited Treasure » Thu May 02, 2013 9:49 am

I am but a fragment cast apart from the whole.
A bit of flotsam to cling to in the storm.

I am a fly in the ointment, I am a whisper in the shadows.
I am also an old old woman. More than that you need not know.

Step carefully. No path is darker than when your eyes are shut.
-Flemeth, Asha'Bellanar, Witch of the Wilds
User avatar
Spirited Treasure
Defender
 
Posts: 928
Joined: Sun Nov 11, 2012 11:45 am
Title: Free Spirit
Gender: Female

Re: Need help scripting please

Postby Jac » Thu May 02, 2013 9:54 am

Looks like the one for Morrowind, aside from using a period instead of an arrow (->). What are you trying to do, ST?
User avatar
Jac
The Boss
 
Posts: 6004
Joined: Sat Feb 12, 2011 8:36 pm
Location: Somewhere on the left side of insanity, the right side was taken.
Title: Elder Wolf

Re: Need help scripting please

Postby Spirited Treasure » Thu May 02, 2013 10:11 am

It is the one from Morrowind. That one works perfectly. All my custom races are referred to as Vanilla.. I'm trying to do the same thing.. I'm told there is no GetRace function in Oblivon, but there is GetIsRace ...

Also they use . instead of ->

so for instance to add gold via console it would be
player.additem f 100
instead of player->additem gold_100 100

Here is the places it is listed as being used in game..

==================

Code: Select all
ScriptName MS40DaggerSpellEffect

ref self


Begin ScriptEffectStart

set self to GetSelf

if ( Self.GetIsRace Argonian == 1 )
   SetStage MS40 60
endif



end

==============================

Scriptname DAHermaeusScript

short questsdone
short raceskilled
short killedargonian
short killedbreton
short killedbosmer
short killedimperial
short killedkhajiit
short killeddunmer
short killedaltmer
short killednord
short killedredguard
short killedorc
short questcount

short spellworking

short initiate

ref target

float fquestdelaytime
short doOnce

short doneVAR

short sametarget

Begin GameMode

if ( doOnce == 0 )
   set fquestdelaytime to 0.5
   set doOnce to 1
endif

;if ( target.GetDead == 1 ) && ( spellworking == 1 )
;   if ( target.GetIsRace Argonian == 1 )
;      Set killedargonian to 1
;      SetStage DAHermaeusMora 30
;   elseif ( target.GetIsRace Breton == 1 )
;      Set killedbreton to 1
;      SetStage DAHermaeusMora 31
;   elseif ( target.GetIsRace woodelf == 1 )
;      Set killedbosmer to 1
;      SetStage DAHermaeusMora 32
;   elseif ( target.GetIsRace imperial == 1 )
;      Set killedimperial to 1
;      SetStage DAHermaeusMora 33
;   elseif ( target.GetIsRace khajiit == 1 )
;      Set killedkhajiit to 1
;      SetStage DAHermaeusMora 34
;   elseif ( target.GetIsRace darkelf == 1 )
;      Set killeddunmer to 1
;      SetStage DAHermaeusMora 35
;   elseif ( target.GetIsRace highelf == 1 )
;      Set killedaltmer to 1
;      SetStage DAHermaeusMora 36
;   elseif ( target.GetIsRace nord == 1 )
;      Set killednord to 1
;      SetStage DAHermaeusMora 37
;   elseif ( target.GetIsRace redguard == 1 )
;      Set killedredguard to 1
;      SetStage DAHermaeusMora 38
;   elseif ( target.GetIsRace orc == 1 )
;      Set killedorc to 1
;      SetStage DAHermaeusMora 39
;   endif
;   if ( raceskilled == 0 ) && ( killedargonian == 1 ) && ( killedbreton == 1 ) && ( killedbosmer == 1 ) && ( killedimperial == 1 ) && ( killedkhajiit == 1 ) && ( killeddunmer == 1 ) && ( killedaltmer == 1 ) && ( killednord == 1 ) && ( killedredguard == 1 ) && ( killedorc == 1 )
;      set raceskilled to 1
;      SetStage DAHermaeusMora 40
;   endif
;   set spellworking to 0
;endif


if ( questcount == 14 )
   if ( questsdone == 0 )
      if ( GetStage MQ08 >= 10 )
         set questsdone to 1
      endif
   endif
endif

if ( initiate == 1 )
   CastaFlavusREF.StartConversation Player Greeting
   set initiate to 2
endif

End

Begin MenuMode
if ( Dark00General.Murderer == 1 )
   if ( GetStage Dark01Knife == 0 ) || ( GetStage Dark01Knife == 20 )
      return
   endif
endif


if ( questsdone == 1 ) && ( IsPCSleeping == 1 ) && ( initiate == 0 ) && ( GetStage DAHermaeusMora == 0 )
   CastaFlavusREF.MoveTo Player 12
   set initiate to 1
endif


End

===========================================

scn DAHermaeusSoulsSpell

short neardead
ref newtarget
short badtarget
short sametarget

begin ScriptEffectStart

if ( IsActor == 1 ) && ( GetDead == 0 ) && ( GetIsCreature == 0 )
   set newtarget to GetSelf
   if ( DAHermaeusMora.spellworking == 0 )
      set DAHermaeusMora.target to GetSelf
      ;messageBox "DAHermaeusMora.target: %.0f", DAHermaeusMora.target
      set DAHermaeusMora.spellworking to 1
   else
      if ( newtarget == DAHermaeusMora.target ) && ( DAHermaeusMora.spellworking == 1 )
         MessageBox "That person is already affected by Hermaeus Mora's Soul Trap."
         set DAHermaeusMora.sametarget to 1
      else
         MessageBox "You may only trap one soul at a time for Hermaeus Mora."
      endif
   endif
else
   Message "That is not a valid target for Hermaeus Mora's Soul Trap"
   set badtarget to 1
end

begin ScriptEffectFinish
   if ( badtarget == 0 )
      set newtarget to 0
      set DAHermaeusMora.doneVAR to 1
   endif
endif

end


;begin ScriptEffectUpdate

;this checks the race of the killed NPC and updates the DAHermaeusMoraScript


;   if ( GetAV Health <= 5 ) && ( neardead == 0 )
;      Messagebox "I'm DEAD!!!"
;      if ( GetIsRace Argonian == 1 )
;         Set DAHermaeusMora.killedargonian to 1
;      elseif ( GetIsRace Breton == 1 )
;         Set DAHermaeusMora.killedbreton to 1
;      elseif ( GetIsRace darkelf == 1 )
;         Set DAHermaeusMora.killeddunmer to 1
;      elseif ( GetIsRace highelf == 1 )
;         Set DAHermaeusMora.killedaltmer to 1
;      elseif ( GetIsRace imperial == 1 )
;         Set DAHermaeusMora.killedimperial to 1
;      elseif ( GetIsRace khajiit == 1 )
;         Set DAHermaeusMora.killedkhajiit to 1
;      elseif ( GetIsRace nord == 1 )
;         Set DAHermaeusMora.killednord to 1
;      elseif ( GetIsRace orc == 1 )
;         Set DAHErmaeusMora.killedorc to 1
;      elseif ( GetIsRace redguard == 1 )
;         Set DAHermaeusMora.killedredguard to 1
;      elseif ( GetIsRace woodelf == 1 )
;         Set DAHermaeusMora.killedbosmer to 1
;      endif
;      Kill Player
;      set neardead to 1
;   endif
;
;end

;begin ScriptEffectFinish
;   MessageBox "THE SPELL IS DONE"
;end

=============================

scn DAHermaeusStaff

ref target

float timer
short timerOn

Begin GameMode

set target to DAHermaeusMora.target

if ( DAHermaeusMora.doneVAR == 1 ) && ( timerOn == 0 )  && ( DAHermaeusMora.sametarget == 0 )
   set timerOn to 1
elseif ( DAHermaeusMora.doneVAR == 1 ) && ( timerOn == 0 ) && ( DAHermaeusMora.sametarget == 1 )
   set DAHermaeusMora.doneVAR to 0
   set DAHermaeusMora.sametarget to 0
endif

if ( timerOn == 1 )
   set timer to ( timer + GetSecondsPassed )
   if ( timer >= 2 )
      set timerOn to 2
   endif
endif
   

if ( target.GetDead == 1 ) && ( DAHermaeusMora.spellworking == 1 ) && ( timerOn == 2 )
   if ( target.GetIsRace Argonian == 1 )
      Set DAHermaeusMora.killedargonian to 1
      SetStage DAHermaeusMora 30
   elseif ( target.GetIsRace Breton == 1 )
      Set DAHermaeusMora.killedbreton to 1
      SetStage DAHermaeusMora 31
   elseif ( target.GetIsRace woodelf == 1 )
      Set DAHermaeusMora.killedbosmer to 1
      SetStage DAHermaeusMora 32
   elseif ( target.GetIsRace imperial == 1 )
      Set DAHermaeusMora.killedimperial to 1
      SetStage DAHermaeusMora 33
   elseif ( target.GetIsRace khajiit == 1 )
      Set DAHermaeusMora.killedkhajiit to 1
      SetStage DAHermaeusMora 34
   elseif ( target.GetIsRace darkelf == 1 )
      Set DAHermaeusMora.killeddunmer to 1
      SetStage DAHermaeusMora 35
   elseif ( target.GetIsRace highelf == 1 )
      Set DAHermaeusMora.killedaltmer to 1
      SetStage DAHermaeusMora 36
   elseif ( target.GetIsRace nord == 1 )
      Set DAHermaeusMora.killednord to 1
      SetStage DAHermaeusMora 37
   elseif ( target.GetIsRace redguard == 1 )
      Set DAHermaeusMora.killedredguard to 1
      SetStage DAHermaeusMora 38
   elseif ( target.GetIsRace orc == 1 )
      Set DAHermaeusMora.killedorc to 1
      SetStage DAHermaeusMora 39
   endif
   if ( DAHermaeusMora.raceskilled == 0 ) && ( DAHermaeusMora.killedargonian == 1 ) && ( DAHermaeusMora.killedbreton == 1 ) && ( DAHermaeusMora.killedbosmer == 1 ) && ( DAHermaeusMora.killedimperial == 1 ) && ( DAHermaeusMora.killedkhajiit == 1 )
      if ( DAHermaeusMora.killeddunmer == 1 ) && ( DAHermaeusMora.killedaltmer == 1 ) && ( DAHermaeusMora.killednord == 1 ) && ( DAHermaeusMora.killedredguard == 1 ) && ( DAHermaeusMora.killedorc == 1 )      
         set DAHermaeusMora.raceskilled to 1
         SetStage DAHermaeusMora 40
      endif
   endif
   set DAHermaeusMora.spellworking to 0
   set DAHermaeusMora.target to 0
   set DAHermaeusMora.doneVAR to 0
   set timerOn to 0
elseif ( target.GetDead == 0 ) && ( DAHermaeusMora.spellworking == 1 ) && ( timerOn == 2 )
   set DAHermaeusMora.Spellworking to 0
   set DAHermaeusMora.target to 0
   set DAHermaeusMora.doneVAR to 0
   set timerOn to 0
endif

End

=================================

scn DASkullofCorruptionSpellScript

ref target
short doOnce
ref summon


Begin ScriptEffectStart

set target to GetSelf
set DASkullofCorruption.target to GetSelf

;Find the race of the target

if ( DASkullofCorruption.spellworking == 0 ) && ( IsActor == 1 ) && ( IsGuard == 0 ) && ( GetDead == 0 ) && ( GetIsCreature == 0 ) && ( GetItemCount DASkullCorruption == 0 )
   ;if ( GetIsRace Argonian == 1 )
   ;   set DASkullofCorruption.raceVAR to 1
   ;elseif ( GetIsRace Breton == 1 )
   ;   set DASkullofCorruption.raceVAR to 2
   ;elseif ( GetIsRace DarkElf == 1 )
   ;   set DASkullofCorruption.raceVAR to 3
   ;elseif ( GetIsRace HighElf == 1 )
   ;   set DASkullofCorruption.raceVAR to 4
   ;elseif ( GetIsRace Imperial == 1 )
   ;   set DASkullofCorruption.raceVAR to 5
   ;elseif ( GetIsRace Khajiit == 1 )
   ;   set DASkullofCorruption.raceVAR to 6
   ;elseif ( GetIsRace Nord == 1 )
   ;   set DASkullofCorruption.raceVAR to 7
   ;elseif ( GetIsRace Orc == 1 )
   ;   set DASkullofCorruption.raceVAR to 8
   ;elseif ( GetIsRace Redguard == 1 )
   ;   set DASkullofCorruption.raceVAR to 9
   ;elseif ( GetIsRace WoodElf == 1 )
   ;   set DASkullofCorruption.raceVAR to 10
   ;endif

   ;if ( GetIsSex Male == 1 )
   ;   set DASkullofCorruption.sexVAR to 1
   ;elseif ( GetIsSex Female == 1 )
   ;   set DASkullofCorruption.sexVAR to 2
   ;endif
   
   ;if ( IsSpellTarget VampDisease == 1 )
   ;   set DASkullofCorruption.vampVAR to 1
   ;endif

   set DASkullofCorruption.spellworking to 1
endif

End


Begin ScriptEffectFinish


;set DASkullofCorruption.spellworking to 0
;set DASkullofCorruption.raceVAR to 0
;set DASkullofCorruption.sexVAR to 0
;set DASkullofCorruption.changeOnce to 0

;set DASkullofCorruption.goAway to 1

End
I am but a fragment cast apart from the whole.
A bit of flotsam to cling to in the storm.

I am a fly in the ointment, I am a whisper in the shadows.
I am also an old old woman. More than that you need not know.

Step carefully. No path is darker than when your eyes are shut.
-Flemeth, Asha'Bellanar, Witch of the Wilds
User avatar
Spirited Treasure
Defender
 
Posts: 928
Joined: Sun Nov 11, 2012 11:45 am
Title: Free Spirit
Gender: Female

Re: Need help scripting please

Postby Spirited Treasure » Sun May 05, 2013 2:16 pm

Ok it appears this will work with OBSE..They need to be attached to a quest

The script you wrote needs to be attached to a spell or magic ability. It will work if you add conditions GetGlobalValue PCRace == X to dialogue responses. (And create such global value, of course)

My script needs to be attached to a quest. It will run every gameload and set "race alias" each time, meaning that GetIsRace checks used in all vanilla dialogue will recognize one race as another.

My script will require OBSE, yours won't.


Code: Select all
scn MyQuestScript

Begin GameMode
   If GetGameLoaded == 1
      SetRaceAlias MyRace Orc
   Endif
End


And this
Code: Select all
scn STJRaceCheck

Begin GameMode
   If GetGameLoaded == 1
      SetRaceAlias Orsimer Orc
      SetRaceAlias Bosmer Wood Elf
      SetRaceAlias Dunmer Dark Elf
      SetRaceAlias Imperial2 Imperial
      SetRaceAlias Breton2 Breton
      SetRaceAlias Redguard2 Redguard
      SetRaceAlias Kat Khajiit
      SetRaceAlias Argonian2 Argonian
      SetRaceAlias Nord2 Nord
   Endif
End


This appears as though it will work with vanilla.. It needs to be attached to a spell or magic effect

Yes, assuming you are going to use it as a magic effect for a spell or magical ability.


Code: Select all
ScriptName STJRaceCheck

short GetIsRace

;global script that gets run once to check the PC's race, so it can be used in dialogue

Begin ScriptEffectStart

if ( Player.GetIsRace "Argonian" == 1 )
   set PCRace to 1

elseif ( Player.GetIsRace "Breton" == 1 )
   set PCRace to 2
 
elseif ( Player.GetIsRace "Dark Elf" == 1 )
   set PCRace to 3

elseif ( Player.GetIsRace "Your Race" == 1 )
   set PCRace to 8

elseif ( Player.GetIsRace "High Elf" == 1 )
   set PCRace to 4

elseif ( Player.GetIsRace "Imperial" == 1 )
   set PCRace to 5

elseif ( Player.GetIsRace "Khajiit" == 1 )
   set PCRace to 6

elseif ( Player.GetIsRace "Nord" == 1 )
   set PCRace to 7

elseif ( Player.GetIsRace "Orc" == 1 )
   set PCRace to 8

elseif ( Player.GetIsRace "Redguard" == 1 )
   set PCRace to 9

elseif ( Player.GetIsRace "Wood Elf" == 1 )
   set PCRace to 10

endif



end


The part I don't get is attaching it to something, rather than just putting in like I did in Morrowind.
There are a bunch of tutorials I found.. None of them explain just how to do this.

http://cs.elderscrolls.com/index.php/Portal:Scripting

http://forums.nexusmods.com/index.php?/ ... scripting/

http://cs.elderscrolls.com/index.php/Gl ... te_a_Quest

Can someone walk me through it please? Thank you.
I am but a fragment cast apart from the whole.
A bit of flotsam to cling to in the storm.

I am a fly in the ointment, I am a whisper in the shadows.
I am also an old old woman. More than that you need not know.

Step carefully. No path is darker than when your eyes are shut.
-Flemeth, Asha'Bellanar, Witch of the Wilds
User avatar
Spirited Treasure
Defender
 
Posts: 928
Joined: Sun Nov 11, 2012 11:45 am
Title: Free Spirit
Gender: Female

Re: Need help scripting please

Postby Jac » Sun May 05, 2013 2:20 pm

Sorry, St, but I've never delved into Oblivion scripting.
User avatar
Jac
The Boss
 
Posts: 6004
Joined: Sat Feb 12, 2011 8:36 pm
Location: Somewhere on the left side of insanity, the right side was taken.
Title: Elder Wolf

Re: Need help scripting please

Postby Spirited Treasure » Sun May 05, 2013 2:34 pm

It seems complicated. :crying:
I am but a fragment cast apart from the whole.
A bit of flotsam to cling to in the storm.

I am a fly in the ointment, I am a whisper in the shadows.
I am also an old old woman. More than that you need not know.

Step carefully. No path is darker than when your eyes are shut.
-Flemeth, Asha'Bellanar, Witch of the Wilds
User avatar
Spirited Treasure
Defender
 
Posts: 928
Joined: Sun Nov 11, 2012 11:45 am
Title: Free Spirit
Gender: Female


Return to Oblivion

Who is online

Users browsing this forum: No registered users and 1 guest

  • Advertisement