Jump to content

A little Scripting help please?


Nakalto

Recommended Posts

Hello, first time i'm posting here and i would like a little help with scripting.

 

I made a player home for one of my characters (the paranoid drug-addict eating any drug known to man) so basically it's a meth-lab trailer located in the mountains. quite cozy aswell :P

 

Now, the problem i am having is with scripting the lab itself. for now i just put a copy of the chemistry set from Doc Mitchells house in there. but that is a "one-time-use" and i would like one i can use every 24 in-game hours or something.

 

I had a look at the script for the Doc's chemistry-set but since i don't know how to alter it to work how i want i'm turning to the community instead.

 

Here is the script i want to change:

 

scn GSChemistrySetScript

 

short Button

 

begin OnActivate

 

if IsActionRef player

ShowMessage GSChemistrySetMsg

endif

 

end

 

BEGIN MenuMode 1001

 

set Button to GetButtonPressed

 

if ( Button == 1 )

player.AddItem Stimpak 5

SetDestroyed 1

elseif ( Button == 2 )

player.AddItem Psycho 1

player.AddItem Buffout 1

player.AddItem Mentats 1

player.AddItem NVSteadyChem 1

player.AddItem NVReboundChem 1

SetDestroyed 1

endif

 

END

 

If anyone can help me i would be grateful, and if intrest is shown i can upload the finished trailer when i get this sorted out :)

Link to comment
Share on other sites

Well the first things to do are:

 

A) Make sure you have created a new FormID for the item so that it doesn't affect Doc's set

B) Make sure to call your script something else ;)

 

The first thing you will want to do is get rid of SetDestroyed 1 in the script.

 

As for limiting it to 24 hour period you will want to use a timer; you could try using the getSecondsPassed function [there are 86400 seconds in a 24 hour period]. http://geck.bethsoft.com/index.php/GetSecondsPassed

Link to comment
Share on other sites

Well the first things to do are:

 

A) Make sure you have created a new FormID for the item so that it doesn't affect Doc's set

B) Make sure to call your script something else ;)

 

The first thing you will want to do is get rid of SetDestroyed 1 in the script.

 

As for limiting it to 24 hour period you will want to use a timer; you could try using the getSecondsPassed function [there are 86400 seconds in a 24 hour period]. http://geck.bethsoft.com/index.php/GetSecondsPassed

 

So duplicating the set and giving it a new name isn't enough to make it qualify as a new FormID?

 

And i kinda figured SetDestroyed 1 needs to go :P, but i have no idea where to implement the timer in the script.

i honestly have no idea how to make any of the changes i want really, scripting is almost like a foreign language for me :S

Oh, and getSecondsPassed seems to be for the Real-time clock from what i figured, not the in-game one. or am i wrong?

Link to comment
Share on other sites

Well the first things to do are:

 

A) Make sure you have created a new FormID for the item so that it doesn't affect Doc's set

B) Make sure to call your script something else ;)

 

The first thing you will want to do is get rid of SetDestroyed 1 in the script.

 

As for limiting it to 24 hour period you will want to use a timer; you could try using the getSecondsPassed function [there are 86400 seconds in a 24 hour period]. http://geck.bethsoft.com/index.php/GetSecondsPassed

 

So duplicating the set and giving it a new name isn't enough to make it qualify as a new FormID?

 

And i kinda figured SetDestroyed 1 needs to go :P, but i have no idea where to implement the timer in the script.

i honestly have no idea how to make any of the changes i want really, scripting is almost like a foreign language for me :S

Oh, and getSecondsPassed seems to be for the Real-time clock from what i figured, not the in-game one. or am i wrong?

 

If by new name you mean changing the Editor ID then no, it isn't enough. When you look at the item properties you will see a button labeled Edit Base - click on that and in the FormID text field change it to something unique, when hitting ok it will give you message saying "You have changed the items form id, do you wish to create a new form?" HIT YES so that your changes will not overwrite the original item.

 

From what I can tell on the wiki the getSecondsPassed is indeed for real time, but I cannot figure out a method of using GameDaysPassed to do the same [though I suppose you could create a new global variable that keeps track of the last day that a player used an item and only allowed use if the day has incremented (in other words say you create a new global variable called fltCustomLabUseCntr - the first time the player uses the lab you set that counter to equal the current GameDaysPassed. Next time the user accesses the item the script would check the current GameDaysPassed against the fltCustomLabUseCntr variable and only allow use if the GameDaysPassed is greater in value)]

 

As to where to put the check - timers are done in GameMode I believe [or at least thats where all of the examples are] but you would need to put a check in the OnActivate event script [where the script currently determines whether to show the message box or not]. If you go the Global Variable route then you will probably be able to get away with just modifying the OnActivate event script to check.

Link to comment
Share on other sites

scn GSChemistrySetScript

short Button

begin OnActivate

if (IsActionRef player && Player.HasMagicEffect DrugSet == 0)
    ShowMessage GSChemistrySetMsg
else
    return
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

if ( Button == 1 )
player.AddItem Stimpak 5
SetDestroyed 1
elseif ( Button == 2 )
player.AddItem Psycho 1
player.AddItem Buffout 1
player.AddItem Mentats 1
player.AddItem NVSteadyChem 1
player.AddItem NVReboundChem 1
PlayerAddSpell DrugSet
endif

END

 

make an effect called drugset that had a dur of 1 day. when it wears off , you are now able to use the set again. Make it so it doesnt show up either.

 

If you duplicated the item/script then you made a copy of it and anything you do wont effect the other

Link to comment
Share on other sites

scn GSChemistrySetScript

short Button

begin OnActivate

if (IsActionRef player && Player.HasMagicEffect DrugSet == 0)
    ShowMessage GSChemistrySetMsg
else
    return
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

if ( Button == 1 )
player.AddItem Stimpak 5
SetDestroyed 1
elseif ( Button == 2 )
player.AddItem Psycho 1
player.AddItem Buffout 1
player.AddItem Mentats 1
player.AddItem NVSteadyChem 1
player.AddItem NVReboundChem 1
PlayerAddSpell DrugSet
endif

END

 

make an effect called drugset that had a dur of 1 day. when it wears off , you are now able to use the set again. Make it so it doesnt show up either.

 

If you duplicated the item/script then you made a copy of it and anything you do wont effect the other

 

Dang, much more simple than my convoluted thinking.

Link to comment
Share on other sites

Allright, so the FormID-thing was very easy to fix. I have been messing around in the Edit Base-tab before (really noobish aswell)

But all that other stuff with the global counters and what-not, i am completly lost again. I didn't think adding a counter would be so difficult script-wise seeing as the game has a clock itself already.

 

I am feeling right now that this is something i won't be able to pull off myself with my almost non-existing skills with scripts. At the most i can add/remove items and the quantaties of the items.

So i am making a general request to anyone out there that can pull this of and send me a copy. Kudos will of course be given if this mod gets published, other than that i have nothing really to offer :/

 

And if all the things i mentioned can't be done, please just do it as close as possible

Link to comment
Share on other sites

scn GSChemistrySetScript

short Button

begin OnActivate

if (IsActionRef player && Player.HasMagicEffect DrugSet == 0)
    ShowMessage GSChemistrySetMsg
else
    return
endif

end

BEGIN MenuMode 1001

set Button to GetButtonPressed

if ( Button == 1 )
player.AddItem Stimpak 5
SetDestroyed 1
elseif ( Button == 2 )
player.AddItem Psycho 1
player.AddItem Buffout 1
player.AddItem Mentats 1
player.AddItem NVSteadyChem 1
player.AddItem NVReboundChem 1
PlayerAddSpell DrugSet
endif

END

 

make an effect called drugset that had a dur of 1 day. when it wears off , you are now able to use the set again. Make it so it doesnt show up either.

 

If you duplicated the item/script then you made a copy of it and anything you do wont effect the other

 

oh crap, didn't see your post while i was writing my last one! if this works i owe you big time! :D

Link to comment
Share on other sites

edit: glad to be of help. make sure you make the effect first (make it a power or something and you can use anything you want ie restorehealth, just set the dur to 1 day and the effect magnitude to 0 so it doesnt actually do anything. if you leave the name blank it shouldnt show up (thats not the editorid, you need to use that))
Link to comment
Share on other sites

edit: glad to be of help. make sure you make the effect first (make it a power or something and you can use anything you want ie restorehealth, just set the dur to 1 day and the effect magnitude to 0 so it doesnt actually do anything. if you leave the name blank it shouldnt show up (thats not the editorid, you need to use that))

Thanks for helping, but i still can't really put this into use. As i said, i have about the same scripting skills as a drunk guy without arms :P (no offence to drunk armless people!)

I need this script ready to the point where i can just apply it to the (new!) chemistry-set, or atleast so close so i just have to add some reference or something

Link to comment
Share on other sites

  • Recently Browsing   0 members

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