senterpat Posted July 21, 2014 Share Posted July 21, 2014 So I'm having a couple of problems with this script, and I would appreciate any help, as it's becoming quite a bother. Essentially I'm trying to transfer the items on the ghoul to the newly spawned ghoul, which has another script to add them. The first issue is that getLOS isn't working properly on the corpses. As far as I can tell it's not registering the getLOS on the dead bodies, which I'd really like to get working, as I'd prefer the player not see them pop in. The second is that once I try adding the items to new container, the script stops running. I've tried using NPCs, Creatures, and containers, with the same results. I've also tried using a quest to save the variables, didn't work like that either. SCN SUPERGhoulRaiseDeadScript short pDead short pScale ref sRef ref nRef ref itemType int amountOfItems ref itemType2 int amountOfItems2 ref itemType3 int amountOfItems3 begin gamemode if getDead == 1 set sRef to getSelf set nRef to SUPERFeralGhoul01Ref if islimbgone 7 == 0 && islimbgone 10 == 0 && islimbgone 1 == 0 ;check if they have head and legs still ; if player.getlos sRef == 0 if islimbgone 3 == 0 && islimbgone 5 == 0 ;still has arms set pScale to GetScale set itemType to GetInventoryObject 1 set amountOfItems to GetItemCount itemType set itemType2 to GetInventoryObject 2 set amountOfItems2 to GetItemCount itemType2 set itemType3 to GetInventoryObject 3 set amountOfItems3 to GetItemCount itemType3 ;this is where the script stops SUPERFeralGhoul01Ref.additem itemtype amountofitems SUPERFeralGhoul01Ref.additem itemtype2 amountofitems2 SUPERFeralGhoul01Ref.additem itemtype3 amountofitems3 placeatme SUPERFeralGhoul01Respawn disable markfordelete endif ; endif else set pDead to 1 endif endif end Link to comment Share on other sites More sharing options...
Xilandro Posted July 21, 2014 Share Posted July 21, 2014 You can try to use sRef.removeallitems SUPERFeralGhoul01Ref Link to comment Share on other sites More sharing options...
jazzisparis Posted July 21, 2014 Share Posted July 21, 2014 Try this: begin OnDeath set sRef to GetSelf if (IsLimbGone 1 || IsLimbGone 3 || IsLimbGone 5 || IsLimbGone 7 || IsLimbGone 10 || player.GetLOS sRef) == 0 set nRef to PlaceAtMe SUPERFeralGhoul01Respawn 1 RemoveAllItems nRef Disable MarkForDelete endif end Link to comment Share on other sites More sharing options...
senterpat Posted July 21, 2014 Author Share Posted July 21, 2014 (edited) Thank Jazzis, that's working perfectly! And your script is so much cleaner then mine :D You too xilandro! Edit: I'm having another problem though, trying to copy the creatures scale, as I have a block in the script to slightly randomize their height. I've tried it a few ways, but it doesn't work or freezes the game. set pScale to sRef.GetScale nRef.SetScale pScale If I set pScale up as a short, it sets nRef to .01, regardless of sRef's current scale. If I set it up as an int, the same thing happens. It returns 1 if the scale is unmodified though. Also even though the scale says .01, they are still normal size unless I use console resurrect.I can just remove the scaling function, but I'd prefer to keep it if anyone knows how I can do this. Edited edit: Also the GetLOS function only seems to be working the instant the ghoul dies, if I kill him and turn around immediatly the spawn happens, but if i kill him, and look at him until he stops moving, the spawn doesn't happen. Edited July 21, 2014 by senterpat Link to comment Share on other sites More sharing options...
Fallout2AM Posted July 22, 2014 Share Posted July 22, 2014 (edited) scale should be a float, shouldn't it?by the way, shorts and ints are the same, concerning used resources, so if you always use ints is pretty much the same And about the GetLOS you're right, I guess that can't work on a OnDeath block. What about removing the GetLOS from the conditions of the OnDeath, and just move/spawn a marker to that position, then check the GetLOS on a separated GameMode block? Anyway I guess it would require to be staged, GetLOS called on a non-actor is pretty slow Edited July 22, 2014 by Fallout2AM Link to comment Share on other sites More sharing options...
senterpat Posted July 23, 2014 Author Share Posted July 23, 2014 (edited) Edit: First part has been solved, the second question (GetLOS) is still unsolved.Switching the scale variable to a float did work, in theory anyways. When i use getscale with the console it says it's the scale it's supposed to be, but it's size hasn't changed. Attaching a script to the new ghoul that resurrects it fixes this(trying to call resurrect on the reference in the main scirpt freezes the game) , but it also resets it's inventory, so does anyone know of a way to make the scale actually show up, I'd appreciate it. Also still can't get the GetLOS to function right, currently have the script set up like this: begin gamemode if doonce == 0 ; this block is only for testing if the scaling is working setscale .8 set doonce to 1 endif if getdead == 1 && player.getlos xRef == 0 if (IsLimbGone 1 || IsLimbGone 7 || IsLimbGone 10) == 0 if islimbgone 3 == 0 && islimbgone 5 == 0 set nRef to PlaceAtMe SUPERFeralGhoul01Respawn 1 removeallitems nRef set pScale to sRef.GetScale nRef.SetScale pScale disable markfordelete endif endif endif end begin OnDeath set sRef to GetSelf ;I also tried using a XmarkerHeading I placed in the testing cell and referenced set xRef to PlaceAtMe XMarkerHeading end Using it on the death block does indeed only register it the moment of death, using it on a corpse alone also doesn't seem to work. I thought for sure the xmarkerheading would work, but that too failed, there has to be a way to do this right? if not I can just use distance instead of LOS and hope they don't notice them popping in too often. Edit: OK, so I figured out how to transfer the scale, using the above script as is, with another script on the new creature that checks the scale and sets it to the same value. Dunno why it won't just register it on the new script, but hopefully the info will help someone. Edited July 23, 2014 by senterpat Link to comment Share on other sites More sharing options...
jazzisparis Posted July 27, 2014 Share Posted July 27, 2014 1. You may need to wait a frame for the new creature to render before you can change its scale. 2. If GetLOS does not work properly, you can use GetHeadingAngle instead. Test this: ref sRef ref nRef float fScale begin GameMode if nRef set fScale to GetScale nRef.SetScale fScale RemoveAllItems nRef set nRef to 0 Disable MarkForDelete endif end begin OnDeath set sRef to GetSelf if ((IsLimbGone 1 || IsLimbGone 3 || IsLimbGone 5 || IsLimbGone 7 || IsLimbGone 10) == 0) && (player.GetHeadingAngle sRef > -75) && (player.GetHeadingAngle sRef < 75) set nRef to PlaceAtMe SUPERFeralGhoul01Respawn 1 endif end Link to comment Share on other sites More sharing options...
senterpat Posted August 7, 2014 Author Share Posted August 7, 2014 Awesome, just checked this post and saw this. Will try out tomorrow. Thanks :D Link to comment Share on other sites More sharing options...
senterpat Posted August 12, 2014 Author Share Posted August 12, 2014 Finally got some time to work on the mod, tested that out, allows them to respawn, but seems to have the same problem as GetLOS, it only seems to function the frame that the ghoul dies. I also tried moving the ondeath if/endif block to a gamemode block. Also tried this script SCN SUPERGhoulRaiseDeadScript ref sRef ref nRef float fScale begin GameMode if ((IsLimbGone 1 || IsLimbGone 3 || IsLimbGone 5 || IsLimbGone 7 || IsLimbGone 10) == 0) && (player.GetHeadingAngle sRef > -75) && (player.GetHeadingAngle sRef < 75) set nRef to PlaceAtMe SUPERFeralGhoul01Respawn 1 endif if nRef set fScale to GetScale nRef.SetScale fScale RemoveAllItems nRef set nRef to 0 Disable MarkForDelete endif end begin OnDeath set sRef to Placeatme XmarkerHeading end Do creature scripts continue to run after the creature dies? Is there maybe some other way to this with a quest script or an armor token? Link to comment Share on other sites More sharing options...
devinpatterson Posted August 14, 2014 Share Posted August 14, 2014 Do creature scripts continue to run after the creature dies? Is there maybe some other way to this with a quest script or an armor token? I don't see anything in there you couldn't do with a quest script, but since you'd be going from implicit to explicit you'd want to use getSelf to set your refs. There is also this caution in re: to getSelf; "GetSelf will return 0 if called on a reference that has been created dynamically (for example, created via PlaceAtMe, or dropped from an inventory into the game world)." so that might fubar any chance of getting an accurate refId from getSelf if you need it later, but if I understand your script correctly just going to be zapping nRef anyway right? Link to comment Share on other sites More sharing options...
Recommended Posts