Jump to content

New Modder- BEWARE!


competentfake

Recommended Posts

Hey GECKers! This thread outlines my concept, and as no one has come forth to run with it, I decided to try to do it myself. I've grasped (I think) the basics of scripting, but I'm fuzzy on 'references', even after a couple hours reading and rereading Cipscis's 'Scripting for Beginners'. I have the first part of the script just fine, I think:

 

I'm using as an example the 'Long Haul' perk, to be awarded when the player has 60 Barter, is Level 12, and has 6 Endurance.

 

scn SkillBasedPerks
int xBARTER 
set xBARTER to player.GetPermAV Barter
begin GameMode	
if xBARTER >= 60
	if player.HasPerk LongHaul == 0
		if player.GetLevel >= 12
			if player.GetPermAV Endurance >= 6

;Now here's where I get fuzzy. I want two messages to pop up. The first (xSkillPerkMSG011) tells the player they have gained the Long Haul perk. The second (xSkillTrade) asks them if they want to keep the perk, or trade it in for a one-time +5 bonus to Barter. This is how I originally conceived the elseif statement:

				ShowMessage xSkillPerkMSG011
				ShowMessage xSkillTradeBarter
					set ButtonVar to GetButtonPressed
						if ButtonVar == 0 
							player.AddPerk LongHaul
						elseif ButtonVar == 1
							player.ModPCSkill Barter 5
						endif
			endif
		endif
	endif
endif

I don't really grasp what I'm doing with the ButtonVar thing, I just copied it from an example I found that I'm beginning to think is way different from what I want to do. I have also discovered that there is a problem with

player.ModPCSkill Barter 5

-and that problem is that "functions cannot be used directly to call reference functions with explicit reference synxtax, nor can they be used as parameters in other functions'. After two hours, I still can't decipher what that is supposed to mean. :( I get that I have to declare a reference, and use that somehow to add the +5 to Barter, but every crazy way I've tried it has failed horribly (the last time, the G.E.C.K. gave me radiation sickness). The example given in the tuturial is regarding GetContainer (not sure what that is), and I can't find an example of references relating to tweaking player statistics. I'd be ever so appreciative of a little guidance, and maybe a RadAway. ~Fake

Link to comment
Share on other sites

I have also discovered that there is a problem with

player.ModPCSkill Barter 5

-and that problem is that "functions cannot be used directly to call reference functions with explicit reference synxtax, nor can they be used as parameters in other functions'. After two hours, I still can't decipher what that is supposed to mean. :( I get that I have to declare a reference, and use that somehow to add the +5 to Barter, but every crazy way I've tried it has failed horribly (the last time, the G.E.C.K. gave me radiation sickness). The example given in the tuturial is regarding GetContainer (not sure what that is), and I can't find an example of references relating to tweaking player statistics. I'd be ever so appreciative of a little guidance, and maybe a RadAway. ~Fake

 

ModPCSkill already implies the "player." reference, so your syntax would evaluate as follows:

 

player.player.modav barter 5

 

This obviously would throw an error. GetContainer assumes the object is contained within a container and returns reference value if it is (and 0 if it isn't or doesn't yet have the value).

 

The way you use this line is also bothersome:

 

set xBARTER to player.GetPermAV Barter

 

You have that outside the begin/end block, so I'm not sure where it's supposed to be iterated.

Link to comment
Share on other sites

Thanks for responding!

 

So the syntax would be:

 set ButtonVar to GetButtonPressed
                                                       if ButtonVar == 0 
                                                               player.AddPerk LongHaul
                                                       elseif ButtonVar == 1
                                                               player.ModAV Barter 5
                                                       endif

?

-

The 'set xBARTER to player.GetPermAV Barter', as I understand it, sets 'xBARTER' as whatever the player's Barter skill level is, but every time I find a new reference it leads me to something else, and 'modav' led me to 'getav', so I could write it to say 'set xBARTER to player.GetAV Barter'? As to it and the 'int' line being outside the Begin/end block, that's how I saw it written in the original mod script. Are they supposed to be inside the block? Also, are the ButtonVar and GetButtonDepressed functions written correctly? Thanks again for your time. ~Fake

 

edit: GetPermAV returns the permanent value, without modifications from perks, items, etc. Which is the correct one to use if I want the base unmodified skill level, affected only by implants or Intense Training upgrades to SPECIAL attributes?

Link to comment
Share on other sites

This is what I have now:

 

For skills granted when the criteria of skill level, player level, and SPECIAL attribute score (if applicable) is met:

Variables:

int xEXPLOSIVES

int ButtonVar

set xEXPLOSIVES to player.GetPermAV Explosives

	if xEXPLOSIVES >= 60
	if player.HasPerk HitTheDeck == 0
		if player.GetLevel >= 12
			ShowMessage xSkillPerkMSG031 ;Message informing the player he recieved the perk
			ShowMessage xSkillTrade; Message offering to trade the perk in for 5 skill points if he doesn't want it
			set ButtonVar to GetButtonDepressed
				if Buttonvar == -1
					return
				elseif ButtonVar == 0
					player.AddPerk HitTheDeck
				elseif ButtonVar == 1
					player.ModAV Explosives 5
				endif
		endif
	endif
endif

 

And for perks granted automatically when a skill is tagged:

	if player.HasPerk RunNGun == 0
	if IsPlayerTagSkill Energy Weapons
		ShowMessage xTAGEnergy ;Message informing the player that he has recieved the perk for having tagged Energy Weapons
		player.AddPerk RunNGun
	endif		
endif

As to the putting the variables before the begin block, it seemed to me that when xEXPLOSIVES is called, it will reference the player's current base explosives skill, and then make the decision whether or not the player has earned a new perk. Is that what they mean by an explicit reference?

 

Also confusing me, on the Message dialog in the GECK, do you have to set a display time, and if not, what does it default to? And what is AutoDisplay, the wiki has no definition for it. Thanks!!

Link to comment
Share on other sites

The specifics for Messages are defined by the Message resource itself. None of that is coded (anymore).

 

From what I understand, putting a "set" before the "begin" only gives that variable that value once. So, if that actor variable ever changes, your variable will *not* change with it. Is that the behavior you want?

 

Don't get too confused about terminology. Just think about what the variable does and how and why. That's all you need to know.

Link to comment
Share on other sites

OHHH! I get it, the original author put the 'set xSKILL' commands outside of the Begin/End block, so you'd have to restart the game for it to scan your xSKILL levels again (I had wondered why I didn't immediately recieve perks when I reached the skill level thresholds). I misunderstood you, I thought you were saying the variable declarations should be inside the Begin block, sorry. Got a lot rattling around in the ol' noggin. Thank you again for your help, I think (I hope) I have everything I need. <3~Fake

 

begin GameMode	
;-----------------------------------------------------------------------BARTER
set xBARTER to player.GetPermAV Barter
set xEndurance to player.GetPermAV Endurance
if xBARTER >= 60
	if player.HasPerk LongHaul == 0
		if player.GetLevel >= 12
			if xEndurance >= 6
				ShowMessage xSkillPerkMSG011
				ShowMessage xSkillTrade
					set ButtonVar to GetButtonPressed
						if ButtonVar == -1
						return
						elseif ButtonVar == 0 
							player.AddPerk LongHaul
						elseif ButtonVar == 1
							player.ModAV Barter 5
						endif
			endif
		endif
	endif
endif

BOOSH! *light bulb* That's what he meant by not being able to call reference functions directly by calling the function explicitly, you have to set a variable to refer to that function instead, which, I think is what he meant by an implicit reference. Yay.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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