Jump to content

Scripting help for a better Stealth Boy (no NVSE)


lizardsoul

Recommended Posts

Hi people, english isn't my first language, so I'll try to be clear and fast.

 

I want to modify the Stealth Boy so to allow the player to turn it On\Off at will, but still with a limited charge.

To do so, I just need a script ( no NVSE) to keep tranck of how many seconds the Stealth Boy has been active, so to make it stop after the 120 seconds, or 240 if you have the Stealth Girl perk given by Lily.

 

To make it simple for the player and not too much "immersion breaking", I tought to make the Stealth Boy work like the NCR Radio, so to give the player a message where to choose if turn On or Off the stealth field, or even check how much charge remain ( but still thinking about that) , but also keeping it a "consumable" item, which could possibly give a "Depleted Stealth Boy" after being used, but this last part is an easy one even for me.

 

My idea to keep track of how much time the device has been used, was an effect which add a 120\240 "Stealth Boy Charges" every time a new Stealth Boy is used and an hidden Quest wich consume one of those "charges" for each second the stealth field has been active. But still, I've not been able to figure out a way to make a script able to do so...and I repeat, I DON'T want to use the NVSE.

 

I hope someone out there has the ability to make all this "real" :P , and I'm ready to accept any better idea, advice or just question..thx for the time...

 

P.s.I've in mind to use "Depleted Stealth Boys" on a recipe, to recycle them, into a working one. After all, reading the fallout wiki, seems that those devices remain damaged by the same field they project other than consume their energy charge, so I think 5 or 3 of them, a scrap electronic and some energy cells or a fission battery should be enough to assemble a working Stealth Boy.

Link to comment
Share on other sites

Maybe if you instead made the stealth boy an equip-able object (possibly slot-less), instead of a consumable? It would be relatively easy then to apply the stealth field when it is equipped, remove it when it isn't and unequip & remove itself after being equipped for a certain time? Seems a neater way than what you've proposed, and wouldn't suffer from the same problem, in that each device would have it's own unique equipped time, instead of the shared one in your system. You wouldn't see time remaining on the effect, but you wouldn't with your method either, it can easily be overcome though by printing messages when there's 1min...10sec left etc.

 

scn... 

short HasEquipped 
float TimeEquipped 

Begin OnEquip 
set HasEquipped to 1 
GetSeccondsPassed 
;Apply StealthBoy Perk here 
End 

Begin OnUnequip 
set HasEquipped to 0 
;Remove StealthBoy Perk here 
End 

Begin GameMode 
if HasEquipped !=1 
 return 
endif 
if (TimeEquipped<*1*)||((TimeEquipped<*2*)&&(HasPerk *3*)) 
 set TimeEquipped to TimeEquipped + GetSeccondsPassed 
else 
 ;Remove StealthBoy Perk here 
 ;Remove StealthBoy 
 ;Add "Used StealthBoy" here 
endif 
end

*1* being the base time before it's used up, *2* being the extended time and *3* being the perk (StealthGirl) to give the extended time.

 

Baring minor changes, and additional lines to fake the stealthboy sound and activation visuals and possibly display time remaining, that should just about achieve what you're after.

Edited by Skevitj
Link to comment
Share on other sites

Maybe if you instead made the stealth boy an equip-able object (possibly slot-less), instead of a consumable? It would be relatively easy then to apply the stealth field when it is equipped, remove it when it isn't and unequip & remove itself after being equipped for a certain time? Seems a neater way than what you've proposed, and wouldn't suffer from the same problem, in that each device would have it's own unique equipped time, instead of the shared one in your system. You wouldn't see time remaining on the effect, but you wouldn't with your method either, it can easily be overcome though by printing messages when there's 1min...10sec left etc.

 

scn... 

short HasEquipped 
float TimeEquipped 

Begin OnEquip 
set HasEquipped to 1 
GetSeccondsPassed 
;Apply StealthBoy Perk here 
End 

Begin OnUnequip 
set HasEquipped to 0 
;Remove StealthBoy Perk here 
End 

Begin GameMode 
if HasEquipped !=1 
 return 
endif 
if (TimeEquipped<*1*)||((TimeEquipped<*2*)&&(HasPerk *3*)) 
 set TimeEquipped to TimeEquipped + GetSeccondsPassed 
else 
 ;Remove StealthBoy Perk here 
 ;Remove StealthBoy 
 ;Add "Used StealthBoy" here 
endif 
end

*1* being the base time before it's used up, *2* being the extended time and *3* being the perk (StealthGirl) to give the extended time.

 

Baring minor changes, and additional lines to fake the stealthboy sound and activation visuals and possibly display time remaining, that should just about achieve what you're after.

 

 

I really thank you for the quick reply, and now on I will spend more time on that "getsecondspassed" function ;) ...

 

About making the Stealth Boy an equippable item, I already tried some time ago to make it so, but I don't know yet how to avoid getting it damaged during combat, not without giving it an innaturally high "durability" at least.

 

Besides, I'd like to keeping it an "ingestible" to allow to stack its duration using more the one at time, like on vanilla, avoiding to remaining uncloacked during the time to equip a new one.

 

Another problem I have, is how make a similar StealthBoy work for any npc ( supposing AI is able to use them ) , because the " addperk" function work only with an existing reference, so I made the script "player only" to work.

 

However, your "timer effect" is very good and clear, if you could post me another script, but just able to remove 1 item (stealth boy cell) every second, I would be very grateful :rolleyes: ...I'm already thinking how to make one, but repeating the same command 120\240 times doesn't seems to me the smartest way :sweat: , so I hope you can help me again..

 

P.s.I already intend to give you credit for this mod, if will ever see "light" ;) ...

Link to comment
Share on other sites

The method I proposed would work as is for any NPC using a stealthboy, whereas your method makes it very difficult if you want anyone other than just the PC to use one.

 

How did you call AddPerk? If you're calling it "Player.AddPerk PerkRef" then that's using explicit referencing, which is incorrect, it will work in most cases, but it is redundant and can cause problems. Just calling "AddPerk PerkRef" is sufficient and will work on any actor the script is run on.

 

 

Ok, Round 2:

 

The way I see this working is that activating a stealthboy will, instead of applying a timed ability, add a permanent ability to the user and add 120/240/etc "Charges" which would be an unplayable quest misc item to avoid the PC seeing it, or NPCs using them and add the "StealthBoy Control" (aka radio) if the PC doesn't already have one. The Stealthboy Perk would then have to be modified to remove one of these charges every second and remove itself and the radio if there are no more charges left to remove. If the radio is used to stop the effect, it adds a stealthboy to the user's inventory, removing the ability and itself. The tricky bit in this is to determine how to handle the time remaining: The neatest way I can see is to add a second unplayable charge corresponding to negative time, and if a new stealthboy is activated, it will immediately add the 120/240 as per usual, but the ability will check for the negative tokens and subtract that amount from the charges.

 

That method should work for all actors, except they will always use it to it's full duration, never stopping it short. The other problem I'm not overly sure about is what would happen in situations where an actor's (including PC) inventory is cleared, since removing the charges could pose a problem.

Edited by Skevitj
Link to comment
Share on other sites

Sorry, I should have been more clear, I did use the AddPerk PerkRef command, but it didn't work, I had to change it to Player.AddPerk PerkRef to make the script apply the stealth field perk I created to the player in game, otherwise it didn't do anything. But perhpas I'm doing something wrong, you should try yourself to see if it works.

 

About the timer effect, I am not very familiar with the GetSecondsPassed command yet, so I don't really know all its capability, I'll just trust you if you say it can't be used in this case ;) .

 

The "negative count cells" instead, are they really necessary? After all should be sufficient a condition which check if any "standard cell" is on the actor inventory, and shut down the Stealth Boy if there isn't one left, but perhaps I just didn't undersdtand what were you saying, in this case I hope you can repeat in a more simple way, sorry :sweat: ...

 

Another thing I thought is to add only 120 "cells" for every stealth boy used, despise the player having or not the StelthGirl perk, instead we can change the rate they are consumed\removed to 1 per second, to 2 per second when the StealthGirl perk is active...assuming is possible to create this "removing item per second effect", because it seems to me the only real problem in this mod...

 

About others Npcs using the stealth boy, i didn't ever saw one doing so, not without being scripted at least, like the nightkins for example, so not very sure if implement this option or not...and not even sure if other players would care about it too...

 

In the meanwhile however, I'm still trying to make that "removing cell every 1\2 seconds" , I hope you'll figure out how to make it, because I'm still in "deep waters" :blush: ...

Link to comment
Share on other sites

Without the Negative token item, there is no way of knowing if a stealthboy is partly used. The neg token just acts as a reminder, keeping track of how much of a stealthboy has been used, so when it's reactivated, it doesn't start from full again.

 

At any rate, if you just want a mechanic to remove one every second:

scn... 

short DoOnce 
float TimerVar 

Begin GameMode 
if DoOnce<1 
 GetSeccondsPassed 
 Set DoOnce to 1 
endif 
set TimerVar to TimerVar + GetSecondsPassed 
if TimerVar>=1 
 Set TimerVar to TimerVar - 1 
 RemoveItem  ;****Remove Item Here**** 
 ;****Other trigger events go in here****
endif 
end

That is the basic structure for an accurate, regular timer which will trigger once every second the script is run.

Edited by Skevitj
Link to comment
Share on other sites

  • Recently Browsing   0 members

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