[HELP} Need help with simple scripting

Post » Sat Feb 19, 2011 7:01 am

Dbl post lol
User avatar
hannah sillery
 
Posts: 3354
Joined: Sun Nov 26, 2006 3:13 pm

Post » Sat Feb 19, 2011 9:18 am

can it be done by running a quest ???
User avatar
Katie Louise Ingram
 
Posts: 3437
Joined: Sat Nov 18, 2006 2:10 am

Post » Fri Feb 18, 2011 10:31 pm

You can avoid calls to getself two ways. For functions of the form "rSomeRef.DoSomething" you can just leave off the rSomeRef and it will assume you mean the object that the script is attached to. For functions where you need to pass the "getself" ref as one of the later parameters, you can just use "this" as shown:

ref rSelfref rSomeOtherRefbegin gamemode    set rSelf to getself    rSomeOtherRef.moveto rSelfend


can be replaced with:

ref rSomeOtherRefbegin gamemode    rSomeOtherRef.moveto thisend

User avatar
jeremey wisor
 
Posts: 3458
Joined: Mon Oct 22, 2007 5:30 pm

Post » Sat Feb 19, 2011 7:30 am

hmmm . both do not work .. maybe there some kind quest needed ??
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Fri Feb 18, 2011 6:03 pm

You can try what Imp posted just substituting this in place of me. Remove "Ref me" and "set me to getself" from the script. I kind of have my doubts now that I see what you are doing. I'm not sure that the script will run at all on an item placed in an explosion like that, I could be wrong, but I remember trying to do something similar with the rockit launcher projectile. Does your message get displayed?
User avatar
Tiffany Castillo
 
Posts: 3429
Joined: Mon Oct 22, 2007 7:09 am

Post » Sat Feb 19, 2011 7:40 am

You can try what Imp posted just substituting this in place of me. Remove "Ref me" and "set me to getself" from the script. I kind of have my doubts now that I see what you are doing. I'm not sure that the script will run at all on an item placed in an explosion like that, I could be wrong, but I remember trying to do something similar with the rockit launcher projectile. Does your message get displayed?



yes .. everything works ... when i assign any other reference in the script package .. it works just fine .. if you want i can send you the esp ... that's if you have FONV ofcourse
User avatar
mollypop
 
Posts: 3420
Joined: Fri Jan 05, 2007 1:47 am

Post » Sat Feb 19, 2011 6:08 am

Ok if you can upload it somewhere I'll try to take a look.
User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Sat Feb 19, 2011 5:36 am

I was able to get this to work finally. I made a mess of the esp trying different things so I need to start fresh with what I know works, and I don't have anymore time tonight.

Basically I used actors because they seem more reliable for getself. You could try replacing that light mesh you use for the explosion with an actor, radroach is what I used, and attach the script to it. There are a few things you can do like setting the alpha of the roach to 0 so it's not seen, and using things like setghost so everyone ignores it. I changed the xmarker to a radroach also, and made that the target of a wander package (I changed your guard package to wander for testing). I think the guard package is ok it just needs to have the Guard Location left blank, you only need the reference to guard.

I also noticed a small error in your NPC script where the scriptpackage is handled. It starts with an elseif statement. Should probably be if. You can avoid having to use that sneak check by setting the NPCs to playerteammate, as player teammates auto sneak with the player. Might be helpful to add them to the player faction with a rank of 100 to avoid friendly fire issues if you get them.

Anyway I'll link you to the butchered esp so you can see what I did, and maybe you can make sense of it. Give it a try in game first to confirm it's working for you.

PM sent...
User avatar
luis ortiz
 
Posts: 3355
Joined: Sun Oct 07, 2007 8:21 pm

Post » Fri Feb 18, 2011 9:14 pm

thanks ... it works .. although the other creatures are attacking my marker lol

anyway ... another question

example:

if i have a character with a script package 1 ... and i want to add a script pakage 2 ... can i just use addscriptpackage package 2 in the character's script
or do i need to remove the scriptpackage 1 first and add the package 2 ??

Thanks
Alex
User avatar
Sudah mati ini Keparat
 
Posts: 3605
Joined: Mon Jul 23, 2007 6:14 pm

Post » Fri Feb 18, 2011 9:10 pm

update on the markers :

the moveto me seems to work when the reference is persistent

is there a way to script a newly placed static activator to become persistent ???
User avatar
Elisabete Gaspar
 
Posts: 3558
Joined: Thu Aug 31, 2006 1:15 pm

Post » Fri Feb 18, 2011 8:33 pm

You don't need to removescriptpackage when adding a new one. An actor can only have one script package at any time so calling addscriptpackage effectively removes the old one.

To keep others from attacking a marker actor add this to its script.

Begin OnLoad

setdestroyed 1 ;it can't be activated
setunconscious 1 ;it cant move about
setghost 1 ;actors should ignore it

saa .0 ;makes it invisible

End

I don't think there is a way to set placed objects to be persistent. I'm not sure what you are after here. I think you could just use the b3Roach I created as the object placed by the explosion, and combine the script from the light mesh you are using so it calls moveto on the b3Roach2.

In one of my mods I just used small activators like bobbleheads, and the concealed land mine as the target of the AI Package. They work nicely and you can change their texture to the null texture set so they cant be seen. So you might be able to substitute one of those for the b3Roach2. Using an actor for the placeatme object assures that you can get a reference to it using getself the way I did in its script.
User avatar
Heather M
 
Posts: 3487
Joined: Mon Aug 27, 2007 5:40 am

Post » Fri Feb 18, 2011 6:51 pm

You don't need to removescriptpackage when adding a new one. An actor can only have one script package at any time so calling addscriptpackage effectively removes the old one.

To keep others from attacking a marker actor add this to its script.

Begin OnLoad

setdestroyed 1 ;it can't be activated
setunconscious 1 ;it cant move about
setghost 1 ;actors should ignore it

saa .0 ;makes it invisible

End

I don't think there is a way to set placed objects to be persistent. I'm not sure what you are after here. I think you could just use the b3Roach I created as the object placed by the explosion, and combine the script from the light mesh you are using so it calls moveto on the b3Roach2.

In one of my mods I just used small activators like bobbleheads, and the concealed land mine as the target of the AI Package. They work nicely and you can change their texture to the null texture set so they cant be seen. So you might be able to substitute one of those for the b3Roach2. Using an actor for the placeatme object assures that you can get a reference to it using getself the way I did in its script.



thanks .. i've allready made subs for those roaches ... :)
thanks for the explaining about the packages too .. that will make my script .. much and much shorter :)
User avatar
Honey Suckle
 
Posts: 3425
Joined: Wed Sep 27, 2006 4:22 pm

Post » Fri Feb 18, 2011 11:54 pm

hello all ,

i was wondering if there is a way to keep track of all killed creatures/actors by your teammates/followers ??

thanks
Alex
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Fri Feb 18, 2011 6:30 pm

I don't think so. Actually I would like this a lot. If you recall the finger/ear quests from FO3, there is a problem that kills by companions do not "drop" these items. That is because the entry point that allows this dropping does not trigger on companion kills. There is no known workaround. I have learned about the finger/ear implementation in http://www.thenexusforums.com/index.php?/topic/277027-guaranteed-loot-drop-by-creaturetype and I have used it in my quest mod below. If somebody proposes an NVSE based solution, I will be interested to see if it can distinguish between NPC's killed by *companions* and NPC's killed by *noncompanions*.
User avatar
Far'ed K.G.h.m
 
Posts: 3464
Joined: Sat Jul 14, 2007 11:03 pm

Post » Sat Feb 19, 2011 3:07 am

I don't think so. Actually I would like this a lot. If you recall the finger/ear quests from FO3, there is a problem that kills by companions do not "drop" these items. That is because the entry point that allows this dropping does not trigger on companion kills. There is no known workaround. I have learned about the finger/ear implementation in http://www.thenexusforums.com/index.php?/topic/277027-guaranteed-loot-drop-by-creaturetype and I have used it in my quest mod below. If somebody proposes an NVSE based solution, I will be interested to see if it can distinguish between NPC's killed by *companions* and NPC's killed by *noncompanions*.



to bad ... makes things less interesting
User avatar
Raymond J. Ramirez
 
Posts: 3390
Joined: Sun Oct 14, 2007 8:28 am

Post » Sat Feb 19, 2011 8:35 am

what about the XP ?
User avatar
Jenna Fields
 
Posts: 3396
Joined: Mon Dec 11, 2006 11:36 am

Post » Sat Feb 19, 2011 2:02 am

I don't understand the question. In FNV, the player gets all the XP for any kills by the player or any companion.
User avatar
Vicki Blondie
 
Posts: 3408
Joined: Fri Jun 16, 2006 5:33 am

Post » Fri Feb 18, 2011 11:38 pm

i meant the XP gain that was caused by the kills of you companions
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Sat Feb 19, 2011 9:10 am

No, I don't know how to tell how much of your XP came from companion kills. How would you like to use this information, if you could get it?
User avatar
Racheal Robertson
 
Posts: 3370
Joined: Thu Aug 16, 2007 6:03 pm

Post » Fri Feb 18, 2011 8:48 pm

well ... i would use this information for the upgrade of my squad members .. say if sniper has scored 500 point then he would unlock a new weapon or an armor for him to use
User avatar
XPidgex Jefferson
 
Posts: 3398
Joined: Fri Sep 08, 2006 4:39 pm

Post » Sat Feb 19, 2011 3:40 am

You could probably get this idea to work. Running a quest script you would have to ref walk the nearby cells and check for dead actors. When you find one you check to see if he has a special token item (that you make to keep from running on the same dead actor more than once). If he doesn't have the item, you add the item, then use the function "IsKiller" to test if any of your companion refs killed them. If so you could add + 1 to some variable for that companion to store his kills.

so
if DeadTarget.IsKIller MyCompanionRef  ;get DeadTarget by refwalking the cell for dead actors  set MyCompanionRefDeadCounter to MyCompanionRefDeadCounter + 1endifif DeadTarget.getitemcount MyDeathItem == 0   DeadTarget.additem MyDeathItem 1endif


Just the basic idea for you to toy with.
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Fri Feb 18, 2011 7:55 pm

With respect to the ears and fingers, if I remember correctly those are added by an "add levelled list item" perk entry, which will only be activated when the kill is made by the player due to the fact that the perk is the player's. Perks do not work on NPCs, so this isn't a viable solution.

The solution mentioned by b3w4r3 is what I'd recommend as well. Here's an example script that could work for a single companion:
Spoiler
ref rCurrentRefBegin GameMode        set rCurrentRef to GetFirstRef 200 1 0 ; Actors        Label 10        if rCurrentRef                if rCurrentRef.GetDead                        if rCurrentRef.GetItemCount KillerCheckedToken                        else                                rCurrentRef.AddItem KillerCheckedToken 1 1                                if rCurrentRef.IsKiller PlayerTeammateREF ; Where 'PlayerTeammateREF' is the editorRefID of the teammate in question                                        if rCurrentRef.GetIsCreature                                                set PlayerTeammateCreaturesKilled to PlayerTeammateCreaturesKilled + 1 ; Where PlayerTeammateCreaturesKilled is a global variable                                        else                                                set PlayerTeammatePeopleKilled to PlayerTeammatePeopleKilled + 1 ; Where PlayerTeammatePeopleKilled is a global variable                                        endif                                endif                        endif                endif                set rCurrentRef to Pencil01 ; Prevent apple bug                set rCurrentRef to GetNextRef                Goto 10        endifEnd

This code could be extended to pull its companion refIDs from a form list, by inserting another loop in the middle of it. This would allow companions to be added or removed without having to change this script, so long as the form list is appropriately maintained. The difficulty would then be in storing the number of kills for a number of actors that is not predetermined. Instead of using variables, it would make more sense to use "kill tokens" stored in the companion's inventory, given that variables in object scripts can only be accessed via editorRefIDs. For example:
Spoiler
ref rCurrentCorpseref rCurrentCompanionint iIndexBegin GameMode	set rCurrentCorpse to GetFirstRef 200 1 0 ; Actors	Label 10	if rCurrentCorpse		if rCurrentCorpse.GetDead			if rCurrentCorpse.GetItemCount KillerCheckedToken			else				rCurrentCorpse.AddItem KillerCheckedToken 1 1				set iIndex to 0				Label 20				if iIndex < ListGetCount CompanionFormList					set rCurrentCompanion to ListGetNthForm CompanionFormList iIndex					if rCurrentCorpse.IsKiller rCurrentCompanion						if rCurrentCorpse.GetIsCreature							rCurrentCompanion.AddItem CreatureKillToken 1 1						else							rCurrentCompanion.AddItem PersonKillToken 1 1						endif					else						set iIndex to iIndex + 1						Goto 20					endif				endif			endif		endif		set rCurrentCorpse to Pencil01 ; Prevent apple bug		set rCurrentCorpse to GetNextRef		Goto 10	endifEnd

Cipscis

EDIT:

Note that this script wouldn't need to run particularly often. The default script processing delay of 5 seconds should be easily enough to ensure accuracy, and if you want to ensure that the number is reported correctly in a menu, then you could run the code once whenever the player enters http://geck.gamesas.com/index.php/MenuMode.

Cipscis
User avatar
Bird
 
Posts: 3492
Joined: Fri Nov 30, 2007 12:45 am

Post » Fri Feb 18, 2011 10:01 pm

thanks a lot guys .. you've cleared the road of fallen trees for me

:)
User avatar
Monika Krzyzak
 
Posts: 3471
Joined: Fri Oct 13, 2006 11:29 pm

Post » Sat Feb 19, 2011 9:29 am

it works .. thanks all
User avatar
Camden Unglesbee
 
Posts: 3467
Joined: Wed Aug 15, 2007 8:30 am

Post » Sat Feb 19, 2011 4:46 am

With respect to the ears and fingers, if I remember correctly those are added by an "add levelled list item" perk entry, which will only be activated when the kill is made by the player due to the fact that the perk is the player's. Perks do not work on NPCs, so this isn't a viable solution.

I agree with you that it is not viable, but according to an older gamesas post, perks are *supposed* to be addable to companions. I tried it, and I couldn't get it to work. Here is the reference, I did not trace back any further:
http://www.thenexusforums.com/index.php?/topic/265969-npc-perks/page__view__findpost__p__2455258
User avatar
Sarah Unwin
 
Posts: 3413
Joined: Tue Aug 01, 2006 10:31 pm

PreviousNext

Return to Fallout: New Vegas