Jump to content

Photo

How could I make a perk do this in New Vegas?

- - - - -

  • Please log in to reply
6 replies to this topic

#1
Expresate

Expresate

    Ambassador

  • Ambassadors
  • 24 posts


Users Awards
Hey, I'm trying to put together a perk just for the heck of doing it. I know how to add perks. What I don't know is how to properly script for a perk to do something. How would I make it so my perk, upon being selected, would reward the player with a random item every X number of hours? Any idea?
  • 0

#2
eloquate

eloquate

    Senior Member

  • Allies
  • 36 posts


Users Awards
Hi,

Unfortunately I haven't got quite as much time to explore this as I would like but in brief I would use perks Tag or Animal Friend as a base. Rather than adding a value to the player they are used to set the stage on a quest (the quest Generic) with an associated script.

The way I would go about your request would be to either add a new quest or add a new stage to the Generic quest for your perk. The attached script would set a new Global variable to true i.e.

set perkAddItemRand 1
Then set up a new miscellaneous script which checks for this global variable. The script would then run a timer (see these tutorials by Cipscis for more on intro scripting including timers). For the random item I would set up a new Form List containing your items or refer to an existing one.

I hope that there's enough here to point you in the right direction, best of luck!
  • 0

#3
Expresate

Expresate

    Ambassador

  • Ambassadors
  • 24 posts


Users Awards
Thanks for the information. One problem, though: Every time I try to add a script to the stage I put in Generic, and either close the box, or switch to another stage and come back, it's gone. It's obviously not saving. But why? What do I specifically do to save it? I've tried a few things, but nothing worked.
  • 0

#4
eloquate

eloquate

    Senior Member

  • Allies
  • 36 posts


Users Awards

Thanks for the information. One problem, though: Every time I try to add a script to the stage I put in Generic, and either close the box, or switch to another stage and come back, it's gone. It's obviously not saving. But why? What do I specifically do to save it? I've tried a few things, but nothing worked.

The problem with the New Vegas GECK is that it doesn't report errors in scripts... and if there is an error in your script it won't save it. I personally use this mod, GECK PowerUp, to enable error reporting.

Either way, the steps I've followed to achieve the quest script (by much trial-and-error I must admit!) are as follow:

1 - Create the new Global variable.

If you write your script before the variable it references is created, it will fail validation and not save. Unlike other objects a new Global variable cannot be created by right clicking in the object window. You need to go to Gameplay at the top of the GECK window, then Globals..., then you can right-click and select New as normal. I used the formID PerkAddItemRand. Then make sure the type checked is Short and the value is 0.

2 - Write the Quest script

I then added a stage 115 to the Generic quest and added an EMPTY Log Entry. In the Result Script box I added the following:

; Set flag to add random items to player as per perk
set perkAddItemRand to 1


I missed the 'to' from my initial script which would also cause it to break.

Hit Compile Result and then Ok at the bottom of the window.

That should do the trick!
  • 0

#5
Expresate

Expresate

    Ambassador

  • Ambassadors
  • 24 posts


Users Awards
I'm just going to say I have no idea what I'm doing. I've got everything done but the actual script. Basically, I walked into the nearest timer tutorial (This one right here: http://cs.elderscrol..._a_Simple_Timer), picked random things off the shelves, and left. Ended up with this:

scn AddItemPerk

float timer
float fQuestDelayTime

begin gameMode
		if perkAddItemRand == 1
			set fQuestDelayTime to 0.001
				
			if  ( time < 720 )
				set time to timer + getSecondsPassed
			elseif ( time >= 720 )
				player.additem f 100
			endif
		endif
	end

I know there's something horribly wrong with that. Horribly, horribly wrong. Many things horribly wrong and immoral. Basically, I want to have a timer be activated when perkAddItemRand returns 1. That timer will give the player a random item every 12 minutes (for now). Since making it so the player does receive a random item is a whole other ballpark; right now I'm just trying to get 100 caps to work.

GECK Power Up keeps giving me an error saying fQuestDelayTime isn't a valid variable name. I just followed the tutorial. Are they not telling me things, now? I feel so out of the loop...

I am confus.
  • 0

#6
WillieSea

WillieSea

    Senior Scholar

  • Skyrim Scholars
  • 4,857 posts


Users Awards
Quickly looking over the script, you do not have a variable defined called 'time'.

Change all the parts where you have 'time' to 'timer'.

You also need to make sure 'perkAddItemRand' is defined as a global variable.

Another thing, 'fQuestDelayTime' can only be used in a quest script. Did you change the script-type to in the drop-down to a quest type?
  • 0

#7
Expresate

Expresate

    Ambassador

  • Ambassadors
  • 24 posts


Users Awards
I did have it set as quest. Now it's working. Odd. Anyway, thanks for pointing out "timer." It saved properly. I'm going to see if it works.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users