Jump to content
ℹ️ Intermittent Download History issues ×

Struggling to get my head around this, looking for help.


Job4aCowboy

Recommended Posts

I'm taking your last script and am going to tweak it. Then try it and see how it works.

 

 

Scriptname J4ACGraveRobbersScript2 extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto  
{Message to say why you cannot use this without RequiredWeapon}

Actor Player = Game.GetPlayer()
;assign the player to the variable Player so that it can be used throughout the script

Event OnLoad()
	Utility.wait(0.50)
	BlockActivation(true)
EndEvent

Event onActivate(objectReference akActivator)
		if (akActivator as Actor) == Player
			if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1
				SEEMESSAGEGraverobfailure.Show()
			else
				gotostate("Access")
			endIf
		endIf
endEvent

STATE access
	Event OnBeginState()
		BlockActivation(false)
                Self.Activate(Player)
                Utility.Wait(1.0) ;lets just wait a second before moving on
		BlockActivation(true)
	Endevent
EndState

 

 

I removed a couple states. Saw no need to keep passing between them. I defined a variable specifically for the player so that it could be used throughout the entire script.

 

Edit -- removed the apostrophe from one of them comment strings... it annoys me when the highlighting colors get thrown off :P

 

Thanks, although it doesn't seem to be compiling for me, here are the errors I get

 


C:\Program Files (x86)\Notepad++>"D:\Steam\SteamApps\Common\Skyrim\Papyrus Compi
ler\PapyrusCompiler.exe" "J4ACGraveRobberScript.psc" -f="TESV_Papyrus_Flags.flg"
 -i="D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source" -o="D:\Steam\SteamApp
s\Common\Skyrim\Data\Scripts"
Starting 1 compile threads for 1 files...
Compiling "J4ACGraveRobberScript"...
D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source\J4ACGraveRobberScript.psc(1
0,15): no viable alternative at input 'Game'
D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source\J4ACGraveRobberScript.psc(1
0,19): required (...)+ loop did not match anything at input '.'
D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source\J4ACGraveRobberScript.psc(1
0,6): Unknown user flag Game
No output generated for J4ACGraveRobberScript.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on J4ACGraveRobberScript.psc

C:\Program Files (x86)\Notepad++>Pause
Press any key to continue . . .

 

 

All point to " Actor Player = Game.GetPlayer()"

Link to comment
Share on other sites

No biggie sometimes it doesn't like it in the empty state. Just move it down inside the functions. Like so...

 

 

Scriptname J4ACGraveRobbersScript2 extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto  
{Message to say why you cannot use this without RequiredWeapon}

Event OnLoad()
	Utility.wait(0.50)
	BlockActivation(true)
EndEvent

Event onActivate(objectReference akActivator)
                Actor Player = Game.GetPlayer()
		if (akActivator as Actor) == Player
			if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1
				SEEMESSAGEGraverobfailure.Show()
			else
				gotostate("Access")
			endIf
		endIf
endEvent

STATE access
	Event OnBeginState()
                Actor Player = Game.GetPlayer()
		BlockActivation(false)
                Self.Activate(Player)
                Utility.Wait(1.0) ;lets just wait a second before moving on
		BlockActivation(true)
	Endevent
EndState

 

 

Link to comment
Share on other sites

No biggie sometimes it doesn't like it in the empty state. Just move it down inside the functions. Like so...

 

 

Scriptname J4ACGraveRobbersScript2 extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto  
{Message to say why you cannot use this without RequiredWeapon}

Event OnLoad()
	Utility.wait(0.50)
	BlockActivation(true)
EndEvent

Event onActivate(objectReference akActivator)
                Actor Player = Game.GetPlayer()
		if (akActivator as Actor) == Player
			if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1
				SEEMESSAGEGraverobfailure.Show()
			else
				gotostate("Access")
			endIf
		endIf
endEvent

STATE access
	Event OnBeginState()
                Actor Player = Game.GetPlayer()
		BlockActivation(false)
                Self.Activate(Player)
                Utility.Wait(1.0) ;lets just wait a second before moving on
		BlockActivation(true)
	Endevent
EndState

 

 

 

ok this compiles, and kind of works.

 

It checks for the tools, and only allows activation if the player has the tools. but when they do and they activate it, the chest activates itself over and over again. This is the problem I had before, beginning to think this script is impossible...

Link to comment
Share on other sites

ok... that might be because the chest is now stuck in the access state and needs to get kicked out of it. Let me look up another script I've seen that does the block activation thing and see how they handled it. It had no problems other than when applied to stock crafting stations said stations couldn't be used when the script was removed.

 

EDIT... scratch that. Just realized it doesn't need states at all

 

 

 

Scriptname J4ACGraveRobbersScript2 extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto
{Message to say why you cannot use this without RequiredWeapon}

Event OnLoad()
    Utility.wait(0.50)
    BlockActivation(true)
EndEvent

Event onActivate(objectReference akActivator)
	Actor Player = Game.GetPlayer()
	if (akActivator as Actor) == Player
		if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1
			SEEMESSAGEGraverobfailure.Show()
		else
			BlockActivation(false)
	                Self.Activate(Player)
	                Utility.Wait(1.0) ;lets just wait a second before moving on
			BlockActivation(true)
		endIf
	endIf
endEvent

 

 

Edited by IsharaMeradin
Link to comment
Share on other sites

Taking some tips from the wood block script... but I've no clue why it is looping for you. doesn't make sense.

 

 

 

Scriptname J4ACGraveRobbersScript2 extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto
{Message to say why you cannot use this without RequiredWeapon}

Event OnLoad()
    BlockActivation(true)
EndEvent

Event onActivate(objectReference akActivator)
  Actor Player = Game.GetPlayer()
  if (akActivator as Actor) == Player
    bool allowActivation = true
    If SEEFORMLISTGravetools      
      if akActivator.GetItemCount(SEEFORMLISTGravetools) == 0
        allowActivation = false
        SEEMESSAGEGraverobfailure.Show()
      EndIf
    EndIf
    If allowActivation
      Activate(Player)
    endIf
  endIf
endEvent

 

Try it... what have you got to loose at this point?

 

What object is the script on btw? Is it on the container reference or on the container base?

Link to comment
Share on other sites

Taking some tips from the wood block script... but I've no clue why it is looping for you. doesn't make sense.

 

 

 

Scriptname J4ACGraveRobbersScript2 extends ObjectReference
{Script attached to GraveActivator, checks to see if player has required items...}

formlist property SEEFORMLISTGravetools auto
{Player must have at least one item from this formlist to interact}

Message Property SEEMESSAGEGraverobfailure Auto
{Message to say why you cannot use this without RequiredWeapon}

Event OnLoad()
    BlockActivation(true)
EndEvent

Event onActivate(objectReference akActivator)
  Actor Player = Game.GetPlayer()
  if (akActivator as Actor) == Player
    bool allowActivation = true
    If SEEFORMLISTGravetools      
      if akActivator.GetItemCount(SEEFORMLISTGravetools) == 0
        allowActivation = false
        SEEMESSAGEGraverobfailure.Show()
      EndIf
    EndIf
    If allowActivation
      Activate(Player)
    endIf
  endIf
endEvent

 

Try it... what have you got to loose at this point?

 

What object is the script on btw? Is it on the container reference or on the container base?

 

on the container reference, if by that you mean the one I placed in the render window, not in the edit tab.

 

Will try it in a second

Edited by Job4aCowboy
Link to comment
Share on other sites

One little thing that I didn't transfer from the wood choping script. That is probably what prevented it from activating before you added the block activation thing.

Change Activate(Player) to Activate(Player, true)

 

The added true forces it to activate despite activation being blocked.... (and it dawns on me why it loops) and doesn't send any on activate events to the object...

 

It was looping because we were forcing it to activate and that was triggering the on activate event all over again...

Link to comment
Share on other sites

Got it working!!!!!!!!

 

Re-did the script from scratch, used a lot of code from the wood chopping script. changed things around a bit;

 

checked for required items with > 0 instead of 1 <

allowed the activation before denying activation,

 

Thanks so much for your help, time and patience. I'll be sure to credit you (all of you) in anything I used this script for.

And thanks Ishara, without your help I would have never had the idea to cannibalize the wood chopping script.

 

Edit. just noticed you replied during my reply, but yeh, thanks!

Edited by Job4aCowboy
Link to comment
Share on other sites

  • Recently Browsing   0 members

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