First mod - perk activates when static object in range

Post » Tue May 17, 2011 4:38 am

Hi folks,

I'm trying to start work on a small perk pack, and I'm starting with what I think will be the most difficult one first to teach me the basics of the GECK. Basically I want to alter the player's stats once they're in range of the paper debris static item (ShackPaperDebris01, etc). Now, I've read that in Oblivion it was impossible to do something like that, but there's this "Quest Item" checkbox on statics now, so I'm wondering if I can use that to do what I want. I really have no clue what it does, though; none of the official ESMs use it so I don't know if it's even implemented.

As far as the actual script, my first thought was to check constantly if the player is in range, but that would be a bad idea, so I'm not sure how to implement this - I know range-sensitive stuff can be done as I've seen it in other scripts while playing the game, but I can't find those things in the GECK so I can't learn from them (is there an easy way to tell what a mod changes?). The last time I used one of these tools was trying to build a home for myself in the Morrowind days, and I have only very limited coding experience. I've been trying to figure it out on my own, but I'm having no luck so I figure it's time to call in the cavalry; i.e. you guys who actually know what you're doing.

If using the paper debris isn't possible I might try something similar with garbage cans, in which case I'd still appreciate someone pointing me in the right direction. Sorry to come in with so little knowledge, and I'd greatly appreciate any and all help!
User avatar
Britney Lopez
 
Posts: 3469
Joined: Fri Feb 09, 2007 5:22 pm

Post » Tue May 17, 2011 11:25 am

Are you trying to make it work for every paper or this specific one?

If we are talking about a specific object (I haven't written scripts attached to world objects but ) you could probably attach a script to the object such as:

scn perkScriptref yourObjectbegin gamemodeif yourObject.getDistance player < 1000if player.GetLOS yourObject == 1.....do stuff.....endifendifend

User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Tue May 17, 2011 6:27 am

But here's a lot of paper debris that look the same. So you would have to use debris 1, 2, and 3 in the script. And since it's likely that one would appear a good amount of times in the players range, you have to keep that in mind too.
User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Tue May 17, 2011 10:03 am

I assumed that you want a specific (unique) paper to do all that, but if you want that for all papers in the game you'd either have to attach the script to all the base papers or do a http://www.cipscis.com/fallout/tutorials/loops.aspx where you'd put 82 (debris) and some other checks, but I doubt it. If that's what you want, just post for more info :)
User avatar
jessica breen
 
Posts: 3524
Joined: Thu Aug 03, 2006 1:04 am

Post » Tue May 17, 2011 12:51 am

Thanks for the replies. Yes, I am trying to apply it to every paper debris object. But I'm not sure how to attach a script to such an object; there's no place for it like with items. Can I reference any object in my script or does it have to be something I've attached the script to? I was thinking I could add the perk as a quest since I can't attach it to the papers. Thanks a lot for the code though, that will save me a lot of grief if I can get past this other thing.
And that's a good point mooguy, I'd have to make it so the script only effects the player once, even if they're on top of three or four paper objects.

Also, sorry if I'm not making much sense, like I said I have next to no experience with this stuff so I'm mostly winging it.
User avatar
Killer McCracken
 
Posts: 3456
Joined: Wed Feb 14, 2007 9:57 pm

Post » Tue May 17, 2011 3:51 pm

You can use the ref walk script shown above and the getIsID command:

scn yourScriptshort doonceref yourPaperBegin GameMode	set yourPaper to GetFirstRef 82 1 0 ; Debris	Label 10	if yourPaper != 0		if yourPaper.getDistance player < 1000			if player.getLOS yourPaper == 1				if yourPaper.getIsID ShackPaperDebris01 || yourPaper.getIsID ShackPaperDebris02 ; || etc....					if doonce != 1						; Do stuff........						set doonce to 1					endif				endif			endif		endif		set yourPaper to apple ; Prevent apple bug		set yourPaper to GetNextRef		Goto 10	endifEnd


I think this is what you're looking for :)

Note though that getLOS is a bit weird, in that if you are in 3rd person and the object is close behind you, it might think that you actually had Line Of Sight. To prevent this you could put an extra:

if yourPaper.getDistance player > a value


so that it won't trigger if you are too close.
User avatar
Life long Observer
 
Posts: 3476
Joined: Fri Sep 08, 2006 7:07 pm

Post » Tue May 17, 2011 5:00 pm

You can use the ref walk script shown above and the getIsID command:

scn yourScriptshort doonceref yourPaperBegin GameMode	set yourPaper to GetFirstRef 82 1 0 ; Debris	Label 10	if yourPaper != 0		if yourPaper.getDistance player < 1000			if player.getLOS yourPaper == 1				if yourPaper.getIsID ShackPaperDebris01 || yourPaper.getIsID ShackPaperDebris02 ; || etc....					if doonce != 1						; Do stuff........						set doonce to 1					endif				endif			endif		endif		set yourPaper to apple ; Prevent apple bug		set yourPaper to GetNextRef		Goto 10	endifEnd


I think this is what you're looking for :)

Note though that getLOS is a bit weird, in that if you are in 3rd person and the object is close behind you, it might think that you actually had Line Of Sight. To prevent this you could put an extra:

if yourPaper.getDistance player > a value


so that it won't trigger if you are too close.

Thank you so much! I'll get to work on it right away and see if I can get testing tonight. You've been a huge help!
User avatar
Schel[Anne]FTL
 
Posts: 3384
Joined: Thu Nov 16, 2006 6:53 pm


Return to Fallout 3