Jump to content

Photo

Scripting help


  • Please log in to reply
24 replies to this topic

#11
OminousVoice

OminousVoice

    Enthusiast

  • Members
  • PipPip
  • 227 posts
I thought I'd try a simpler approach. So I gave this a whirl. It compiles fine but still does nothing in game. Is there any way I can check the script is even being run?

Scriptname AddThunderPerk extends ObjectReference

 

Perk property ThunderPerk auto 

Event OnRead()
	
                Game.GetPlayer().AddPerk(ThunderPerk)
	        Debug.Trace("Heart of Thunder added")
     
EndEvent


#12
draenn

draenn

    Regular

  • Members
  • PipPip
  • 59 posts
Hi, try this :
Scriptname AddThunderPerk extends ObjectReference

Perk property ThunderPerk auto 

auto State waiting
	Event OnRead()
                Game.GetPlayer().AddPerk(ThunderPerk)
	        Debug.Trace("Heart of Thunder added")
		GoToState("allDone")
	EndEvent

endState


State allDone

endState


#13
OminousVoice

OminousVoice

    Enthusiast

  • Members
  • PipPip
  • 227 posts

Hi, try this :

Scriptname AddThunderPerk extends ObjectReference

Perk property ThunderPerk auto 

auto State waiting
	Event OnRead()
                Game.GetPlayer().AddPerk(ThunderPerk)
	        Debug.Trace("Heart of Thunder added")
		GoToState("allDone")
	EndEvent

endState


State allDone

endState


I tried this and it didn't for for me. It's bugging me. The syntax and logic all seem fine in all examples above, but they're having no effect in my game. I think I may be missing something fundemental, like I've neglected to do something basic to get it all to function.

I've made the book and placed it in game. I've added a script to it in the CK. Defined 'ThunderPerk' with the dropdown box. Written/amended the script. Compiled it, and saved the plugin. I've even made sure the compiled .pex file is in my scripts folder.

I don't know what I could be missing.

Edited by OminousVoice, 16 February 2012 - 06:47 PM.


#14
OminousVoice

OminousVoice

    Enthusiast

  • Members
  • PipPip
  • 227 posts
I made sure logging etc was enabled in the .ini. Checked my logs and found that the script wasn't even being called. There was quite literally no trace in the log. I still have no idea what to do.

#15
ctzto

ctzto

    Newbie

  • Members
  • Pip
  • 11 posts
Do you have to add a property to Game.GetPlayer()? For instance like how you added ThunderPack to HasPerk(ThunderPack). So let's say Game.GetPlayer(akActor)? Or does the script Game.GetPlayer already know you mean the main character you're controlling? Sorry I'm new to papyrus scripting myself.

#16
OminousVoice

OminousVoice

    Enthusiast

  • Members
  • PipPip
  • 227 posts

Do you have to add a property to Game.GetPlayer()? For instance like how you added ThunderPack to HasPerk(ThunderPack). So let's say Game.GetPlayer(akActor)? Or does the script Game.GetPlayer already know you mean the main character you're controlling? Sorry I'm new to papyrus scripting myself.


As far as I know Game.GetPlayer() doesn't need a property attached.

#17
draenn

draenn

    Regular

  • Members
  • PipPip
  • 59 posts
did you try to add the perk with the console to see if it is working ?

#18
omega2008

omega2008

    Old hand

  • Members
  • PipPipPip
  • 595 posts
Hi, try replacing Debug.Trace with Debug.MessageBox, that will show you if it works right when you read the book. According to the wiki, Debug.Traces saves the Debug text into a log/txt file. Use MessageBox instead to find if it works. Debug.Notification to show the message at the Top-left corner.

Edited by omega2008, 17 February 2012 - 05:16 AM.


#19
OminousVoice

OminousVoice

    Enthusiast

  • Members
  • PipPip
  • 227 posts

did you try to add the perk with the console to see if it is working ?


The perk adds fine with the console.

Hi, try replacing Debug.Trace with Debug.MessageBox, that will show you if it works right when you read the book. According to the wiki, Debug.Traces saves the Debug text into a log/txt file. Use MessageBox instead to find if it works. Debug.Notification to show the message at the Top-left corner.


My latest revision includes debug.notification. Still nothing.

As I said earlier, it seems the scripts function isn't being called when it should.

#20
Jugg3r

Jugg3r

    Newbie

  • Members
  • Pip
  • 16 posts
I dont think you need to check if the player has the perk, 'caus he wont gain it again anyways.

so 4 lines should do

Scriptname AddThunderPerk extends ObjectReference

Event OnRead()
  game.GetPlayer().AddPerk(ThunderPerk)
endEvent





Page loaded in: 1.197 seconds