Jump to content

Scripting Help


puddles

Recommended Posts

Is there anyone around capable of helping me decipher the intricacies of this...script-thing. I've looked at the scripts for some high-complexity quests in other mods, and even they made more sense to me. I know what it 'does' from seeing it in action so many times, but even then some of the mechanisms don't actually seem to work...if you say 'no' or 'later', it doesn't usually let you try again on this or any of its variants left in Emily's script.

Scriptname MGhanged

Short controlvar
Short button

Begin OnActivate
  If ( controlvar == 0 )
    MessageBox "This captive isn't dead yet. Do you wish to save her?", "Later", "No", "Yes", "Never"
    Set controlvar to 1
  ElseIf ( controlvar > 1 )
    Activate
  EndIf
End

Begin GameMode
  If ( controlvar == 1 )
    Set button to GetButtonPressed
    If ( button == -1 )
      Return
    ElseIf ( button == 2)
    removeScriptPackage 111DPhang
    removeScriptPackage 111DPhangside
	ModDisposition Player 100
	player.additem 0101236b 1
	removeitem 0100e43a 1
	removeitem 01007096 1
	removeitem 01002355 1
	removeitem 01004d0a 1
	removeitem	 010024eb 1
	additem 0101012c 1
	equipitem 0101012c 1
	GetInFaction Prey
		AddScriptPackage 001HUNTGOBLIN
      Set controlvar to 2
    Else
      MessageBox "Maybe Later."
      Set controlvar to -1
    EndIf
	EndIf
	
End

Begin OnActivate
  If ( controlvar == 0 )
    MessageBox "Do you wish to save the captive?", "Later", "No", "Yes", "Never"
    Set controlvar to 1
  ElseIf ( controlvar > 1 )
    kill
  EndIf
End
;<CSEBlock>
;<CSECaretPos> 1061 </CSECaretPos>
;</CSEBlock>
Link to comment

Going to guess; so there's 4 'button'-possibilities (yes, later, no, never) but I only see two really fleshed out, also if you say no that negative 'controlvar' never gets reset and always says 'no', probably should only be that like for 'never' option but it would have to be reset on load or something so other prisoners using the script don't get messed up.

 

Also read starting scripts/items with numbers can interfere with script firing, not sure if this is still true all these years later though.

 

Helps to look at other scripts to get an idea, a good example of menu selection then action (also globals) would be Pwner's marijuana mod or any of its variants. You pick what type, it checks against what you have, applies the correct thing, and so on.

Link to comment

Okay, I think I have it...partially explained. I've copied it into a new script and modified it a bit, but now I'm having another issue. If I choose Button == 1 then...uh, it does 1 and then does 0. If I press 2 it does nothing, as expected.

ScriptName MGCaptiveSuffocating

Short controlvar
Short button

Begin OnActivate 			
	If eval ( IsActionRef Player == 0 )
		Activate

	ElseIf eval ( controlvar == 0 ) && ( GetDead == 0 )
		MessageBox "This girl is barely clinging to life, what should you do?", "Help", "Kill", "Nothing"
		Set controlvar to 1
	ElseIf eval ( controlvar > 1 ) || ( GetDead )
		Activate 				
	EndIf

End

Begin GameMode
	EquipItem MGFaceSackEx
	If eval ( controlvar == 1 )
		Set button to GetButtonPressed
		If eval ( button == -1 )
		Return
		ElseIf eval ( button == 0)
			messagebox "You remove the sack from her head and help her."
			UnequipItem MGFaceSackEx
			removeitem MGFaceSackEx 1
			AddItem MGEscapeSlip 1
			EquipItem MGEscapeSlip
			Set controlvar to 2
		elseif eval ( button == 1 )
			messagebox "You snap her neck to put her out of her misery."
			kill
		Elseif eval ( button == 2 )
			MessageBox "You don't do anything: too late to help."
			Set controlvar to 0
		EndIf
	EndIf
End

Begin OnActivate
	If eval ( controlvar == 0 )
		MessageBox "Do you wish to save the captive?", "Later", "No", "Yes", "Never"
		Set controlvar to 1
	ElseIf eval ( controlvar > 1 )
		kill
	EndIf
End
Link to comment

Archived

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

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use