Jump to content


Photo

Scripting Difficulties


  • Please log in to reply
3 replies to this topic

#1 Sticz

Sticz

    Monkey - In the time of Chimpanzees

  • Member
  • 385 posts

Posted 21 July 2008 - 07:37 AM

Hello all,

I am getting into scripting with Oblivion, now that I had finally become a Journeyman with it in the IE games. I am running into problems finding good examples in the game itself. I have a teleportation spell that works wonders (though if I learn more about scripting I will make it so that quests won't be broken). My primary concern now is that I would like to have options on where to teleport to. Here is what I have:

ScriptName ManorHouseSCRIPT

; This is the script that runs when using the Teleport spell
int iButton

Begin ScriptEffectStart
; Open messagebox for selecting desired Teleport destination.
MessageBox "Do you wish to travel to Wayside Manor?", "Yes", "No"
End

Begin GameMode
set iButton to GetButtonPressed
; did the player press a button?
if iButton > -1
; depending of the button that was pressed in the messagebox, Teleport to a guildhall.
playSound DRSOblivionGateOpen
if iButton == 0
player.MoveTo MANNORHOUSEGATEREF
endif
endif
End


This works fine and there are no hitches. However, I would also like to add menues as various quests get completed. So that once I am master of the Thieves Guild, I can teleport directly to the guild. And the same with the Mages guild, Fighters guild and dark brotherhood. What I am lacking is an order to put the pieces together in. I am pretty sure that my variables/globals need to be in this first line.

Begin ScriptEffectStart
; Open messagebox for selecting desired Teleport destination.
MessageBox "Do you wish to travel to Wayside Manor?", "Yes", "No"
End


I am a little slow in this, but here goes

Begin ScriptEffectStart
if myVar1 == 1 && myVar2 == 1 && myVar2 == 5
; Open messagebox for selecting desired Teleport destination.
MessageBox "Do you wish to travel to Wayside Manor?", "Yes", "No"

ElseIf
if myVar1 == 1 && myVar2 == 1 || myVar2 == 5
; Open messagebox for selecting desired Teleport destination.
MessageBox "Where do you want to Travel?", "The Manor", "The Sanctuary", "Fighters Guild", "Dareloth's Home"
Else
MessageBox "Do you wish to close this menu?", "Yes", "No"

End



What I am really looking for is how to identify the quest stages for the main factions in the game. I also need to know how to specifically target a range in that questline so that I can target the time when, for instance, I get the key to the thieves guild. Pouring through all of the code/scripts in the game has gotten me more confused than anything. I appreciate the help, thanks.

Sticz
"For a crazy person, you don't drool much." Complement from Dilbert's Wally.

#2 Sticz

Sticz

    Monkey - In the time of Chimpanzees

  • Member
  • 385 posts

Posted 21 July 2008 - 09:10 PM

Ok, after alot of trial and error, this is what I have:

ScriptName MyHouseSCRIPT

; This is the script that runs when using the Teleport spell
int iButton

Begin ScriptEffectStart
; Open messagebox for selecting desired Teleport destination.
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dark Sanctuary", "Dareloth's House", "Cloud Ruler Temple", "Nowhere",

end

Begin GameMode
set iButton to GetButtonPressed

; did the player press a button?
if iButton > -1
; depending of the button that was pressed in the messagebox, Teleport to a guildhall.
playSound DRSOblivionGateOpen
if iButton == 0
player.MoveTo MYHOUSEGATEREF
endif

if iButton == 1 && getstage Dark01Knife >= 40
player.MoveTo DarkSancDoorSoundRef
Else
TriggerHitShader 3
Message "You have not earned this location"
endif

if iButton == 2 && GetStage TG11HEIST == 160
player.MoveTo TGGateREF
Else
TriggerHitShader 3
Message "You have not earned this location"
endif

if iButton == 3 && Getstage MQ04 >= 50
player.MoveTo cloudrulergateREF
Else
TriggerHitShader 3
Message "You have not earned this location"
endif

endif
End





HOWEVER: This is a really lazy work around. I would rather have the buttons ("Wayside Manor" , "Dark Sanctuary", etc.) be 'activated' with variables, but I tried that several ways and to no avail. Does anyone know of a way to set up those buttons as variables? This script works with the only hitch that button number 4 seems to always default to one of the other button "else" conditions. I am not sure why.

Any expertise would be very welcome.

Sticz
"For a crazy person, you don't drool much." Complement from Dilbert's Wally.

#3 SConrad

SConrad

    I swear to drunk I'm not God

  • Administrator
  • 11148 posts

Posted 21 July 2008 - 09:44 PM

Moved to Oblivion Modding Help. :)

Posted Image Khadion NPC mod - Team leader, head designer
Posted Image Hubelpot NPC mod - Team leader, coder
Posted Image NPC Damage - Coder
Posted Image PC Soundsets - Coder, voice actor
Posted Image Brythe NPC mod - Designer
Posted Image DragonLance TC - Glory of Istar - Designer
Posted Image The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
Posted Image The Jerry Zinger Show - Producer

Iron Modder 5 - Winner


#4 Sticz

Sticz

    Monkey - In the time of Chimpanzees

  • Member
  • 385 posts

Posted 24 July 2008 - 02:33 AM

As a point of reference should anyone else be attempting a similar spell, here is what someone came up with for me:

ScriptName MyHouseSCRIPT

ref pLocation1
ref pLocation2
ref pLocation3
short iButton

begin ScripEffectStart

if ( getStage, Dark01Knife >= 40 )
set pLocation1 to DarkSancDoorSoundREF

if ( getStage, TG11Heist == 160 )
set pLocation2 to TGGateREF

if ( GetStage, MQ04 >= 50 )
set pLocation3 to cloudRulerGateREF
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dark Sanctuary", "Dareloth's House", "Cloud Ruler Temple", "Nowhere"

else
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dark Sanctuary", "Dareloth's House", "Nowhere"

endif

elseif ( GetStage, MQ04 >= 50 )
set pLocation2 to CloudRulerGateREF
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dark Sanctuary", "Cloud Ruler Temple", "Nowhere"

else
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dark Sanctuary", "Nowhere"

endif

elseif ( GetStage, TG11Heist == 160 )
set pLocation1 to TGGateREF

if ( GetStage, MQ04 >= 50 )
set pLocation2 to CloudRulerGateREF
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dareloth's House", "Cloud Ruler Temple", "Nowhere"

else
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Dareloth's House", "Nowhere"

endif

elseif ( GetStage, MQ04 >= 50 )
set pLocation1 to CloudRulerGateREF
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Cloud Ruler Temple", "Nowhere"

else
MessageBox "Where do you wish to travel?" , "Wayside Manor" , "Nowhere"

endif

end


Begin GameMode

set iButton to GetButtonPressed

; did the player press a button?
if iButton > -1

; depending of the button that was pressed in the messagebox, Teleport to a guildhall.
playSound DRSOblivionGateOpen

;Determine button
if ( iButton == 0 )
player.MoveTo, MyHOUSEGATEREF

elseif ( iButton == 1 )
if ( pLocation1 != 0 )
player.moveTo, pLocation1
endif

elseif ( iButton == 2 )
if ( pLocation2 != 0 )
player.moveTo, pLocation2
endif

elseif ( iButton == 3 )
if ( pLocation3 != 0 )
player.moveTo, pLocation3
endif

endif

endif

end

Hope this helps someone.


Sticz
"For a crazy person, you don't drool much." Complement from Dilbert's Wally.