Jump to content

Scripting Help


Recommended Posts

Trying to edit the script below, but I can't seem to get it to work. Does anyone know what I'm doing wrong here?

scn JeeliusScript

; QUESTS:
; MQ06

short button

begin OnLoad
	if getiscurrentpackage MQ06JeeliusPrisoner == 1
		setunconscious 1
	endif
end

begin onActivate
	
	if MQ06.freePrisoner == 0 && getdead == 0 && getincell LakeArriusShrineDagon == 1
		if IsActionRef player == 1
			messagebox "Do you want to release the prisoner?", "Yes", "No"
		endif
	else
		Activate
	endif
end

begin gamemode

     set button to GetButtonPressed
	if button == 0
		set MQ06.freePrisoner to 1
		setunconscious 0
		JeeliusRef.setfactionrank mythicdawnprisoner -1
		JeeliusRef.setfactionrank NineDivines 8
		JeeliusRef.moddisposition player 50
		setstage MQ06 51
		JeeliusRef.evp
	endif
end

begin OnHit player
	if getiscurrentpackage MQ06JeeliusPrisoner == 1
		JeeliusRef.setfactionrank mythicdawnprisoner -1
		JeeliusRef.setfactionrank NineDivines 8
		; he dies from one hit if he's a prisoner
		kill
		; if the player is still playing the part of a cult initiate, don't put out alarm
		if getstagedone MQ06 41 == 0 && getstagedone MQ06 46 == 0 && getstagedone MQ06 51 == 0
			player.scaonactor
			player.setfactionrank mythicdawn 1
		endif
		if player.GetActorValue Blunt >= player.GetActorValue Blade
			Player.AddSpell SpellName Player
		else
			Player.AddSpell SpellName Player
		; clear the shrine
		MQ06Acolyte01Ref.evp				
		MQ06Acolyte02Ref.evp
		MQ06Acolyte03Ref.evp
		MQ06Acolyte04Ref.evp
	endif
end
Link to comment
Share on other sites

The GameMode block run the GetButtonPressed command continuously, even when no MessageBox is showing. This can interfere with all other menus which show a MessageBox, as they wait for their result, but their result may be captured by this script instead. You need to put a flag to prevent the GetButtonPressed from being called if you're not showing a MessageBox. Edited by forli
Link to comment
Share on other sites

I'm trying to get this segment of the script to work.

		if player.GetActorValue Blunt >= player.GetActorValue Blade
			Player.AddSpell SpellName Player
		else
			Player.AddSpell SpellName Player

Note: "SpellName" is where I plan to add my custom spell(s). Once I can get the script to function as needed.

Link to comment
Share on other sites

And what exactly is the problem? You still haven't answered that question. Does the script just not work as expected ingame? Or does it not compile on saving to begin with?

 

If it's exactly the same as what you're showing above, it should not compile, as you're, indeed, missing an "endif", and it's coincidentally also exactly inside the part you quoted last.

 

Another thing, if "SpellName" is only a placeholder and no actual existing reference of any kind yet, again it won't compile, as nothing inside the code defines this term either.

Additionally "AddSpell" only runs on references and does not take a 2nd parameter, so "Player.AddSpell SpellName Player" is bogus and also won't compile. The last "Player" needs to go, the first is all it needs.

 

And if it's then still not compiling or behaving strangely, it might help putting the "player.GetActorValue ..." terms into brackets, like so:

 

if (player.GetActorValue Blunt) >= (player.GetActorValue Blade)

because ObScript gets sometimes confused by additional strings behind an argument list, mistaking them for yet even more arguments, and of course " >= " is not a valid second place argument for "GetActorValue".

 

It might also be helpful to simply isolate the value retrieval from the comparisons, like so:

 

...
set playerBlunt to player.GetActorValue Blunt
set playerBlade to player.GetActorValue Blade
if playerBlunt >= playerBlade
...

Of course these variables need to be defined at the top of the script as well. (GetActorValue returns an "int" as far as I recall.)

Link to comment
Share on other sites

@ DrakeTheDragon the above isn't working. I was thinking about writing a new script for use on a dagger, that when used on a certain individual (I; e Jeelius), would give the player a certain spell (during the related quest), of which, is determined by your blade, or blunt skill. And also checks whether the player is in the Mythic Dawn faction, or not. In order to prevent the player from acquiring the spell, should they decide to kill Jeelius with the dagger after freeing him.

 

This is a mis-mash of different scripts that may be useful in compiling the new script, as I'm frankly useless at this kind of thing:

ScriptName MS40DaggerSpellEffect

ref self


Begin ScriptEffectStart

set self to GetSelf

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



end
ScriptName 1SDDaggerEffect

Begin ScriptEffectStart

	if ( GetSelf == PrisonerRef )
		if ( GetStage 1SD08 == 30 )
			kill
			triggerHitShader 4
			SetStage 1SD08 40
		endif
	endif

End
		if player.GetActorValue Blunt >= player.GetActorValue Blade
			Player.AddSpell BluntSpell Player
		else
			Player.AddSpell BladeSpell Player
		endif
Edited by DovahbearIsNuts
Link to comment
Share on other sites

  • Recently Browsing   0 members

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