Jump to content

trying to new perks


bwins95

Recommended Posts

i'm trying to make a mod where, when perception reaches 10. boone, rex and ed-es' perks are added without them as companions not as a perk added at level up, i want it to be like bug stamper, so it's added automatically.. my test character has 5 perception.

 

my setting on condition is getpermanantactorvalue perception <= 10.00 run on subject, use global, or are both unchecked.

 

the same thing is on each perk entry with absolute value set.

 

what am i doing wrong.

Edited by bwins95
Link to comment
Share on other sites

you need to make a blank quest with this script. make the perk first and have it give the 3 spotting abilities. dont bother with the restrictions since this will be how it is given (set it to level 0 and have all 3 checkboxes unchecked)

 

scn (name and make a quest script)

int hasit

begin GameMode

if (player.GetPermanentActorValue Perception == 10 && hasit == 0)
	player.addperk (name of perk)
               set hasit to 1
      endif
end

Link to comment
Share on other sites

Yep that will work :)

But effieciency is a pet peeve of mine.

 

1/ Always test least CPU intensive conditions first.

A simple test for equality is faster than calling a function and then testing equality.

So the order of the tests should be...

if ( (hasit == 0) && (player.GetPermanentActorValue Perception == 10) )

 

2/ Caveat: The && and || operators do not act like they do in most other languages

In most languages, the l.h.s. operation is evaulated first and the r.h.s. op is skipped if the whole result is already known.

eg. in the following examples the 'Some expensive operation' will *never* be evaluated in most languages...

if ((1 == 0) && (Some expensive operation))
if ((1 == 1) || (Some expensive operation))

However, the GECK scripting language does not have this efficiency shortcut. Both sides are *always* evaluated regardless of the l.h.s. result.

So for the above example it is more efficient to use 2 'if' statements.

if (hasit == 0)
 if (player.GetPermanentActorValue Perception == 10)
 endif
endif

 

3/Always stop your quests when they have served their purpose.

Once the quest script has added the perk, then it serves no further use. So we can change the code to...

 

scn (name and make a quest script) 

begin GameMode 
 if (player.GetPermanentActorValue Perception == 10) 
   player.addperk (name of perk)
   StopQuest (name of this quest)
 endif 
end

 

I would also increase the default time that the quest script runs. If you leave it at the default value then the quest will run every 5 seconds.

For this type of script I'd set the 'Script Processing Delay' to 60 seconds or more.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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