Jump to content

New to Scripting


InActionMan64

Recommended Posts

Just started and need help with the following scenario.

 

Got an On Activate script that's attached to a base object, with three reference objects. I need to find a way for the script to know which of the reference objects called it.

 

Example would be, A script attached to VendingMachine (Nuka Cola machine), which has 170 reference objects (all over the World).

 

 

Anyone got any ideas.

 

 

Link to comment
Share on other sites

  • Replies 76
  • Created
  • Last Reply

Top Posters In This Topic

Well if you are only going to have 3 ref instances , I would just have 3 different base objects with their own scripts.

 

Err is that not conducive to your render vision ? Which if you explain that , could better help to pull that off.

 

And you may need more than 1 frame to get/set and do something with it.

Link to comment
Share on other sites

Got another.

 

I want the player to drink whiskey. I'm looking for a way to have the effects of drinking a whiskey or 5 applied after an event. The effect can't be attached to anything, it needs to be a command(s) I can put into a script.

 

I've looked through and I just can't seem to find a way to have the player consume an ingestible.

Link to comment
Share on other sites

Using "EquipItem" on an ingestible will consume it as normal as if picked from the pipboy inventory.

But player would have to have at least 1 in their inventory.

So you would add the item first , then equip it. Which could not be done in the same frame ... therefore "OnActivate" alone wouldn't work.

Which there is a few ways to do it ... like making a unique ingestible that gets added with the "OnActivate" block of the activator.

Then that ingestible has a script with a "Begin OnAdd" to then equip on the player.

 

Or if that doesn't work ... I would suggest having a trigger box with a script at the activator using "OnTrigger" .

Which is initially disabled , then enable it with the activator at same time the whiskey is added to player.

Which that then equips the ingestible ... and disables itself.

 

Hope that helps ... just ask if need more clarification , or you get tripped up on it.

Cuz I know things don't always work as they are theoretically suppose to.

 

By the way ... ingestible effects don't stack. So having player consume 5 whiskeys ... will only run the addiction chance 5 times.

So a unique ingestible with custom effects would be the way to go for that.

Link to comment
Share on other sites

Right again.

 

I looked at EquipItem but it seemed to relate to armours and weapons only. But looking through again I see there is a line about ingestibles.

 

I'm gonna give my idea a go and get back with the results, or non-results depending :confused: .

Link to comment
Share on other sites

Hit a stumbling block. This is what I've got so far

 

 

;Add x number of whiskeys here

Set iShots to Player.GetItemCount Whiskey
If iShots != 0
If iShots <= 5
;message here
else iShots <= 10
;message here
Player.CrippleLimb 0 player
else
;message here
Player.Kill Player 0 6
endif
Player.Equipitem Whiskey iShots
endif
I need a way to have it fire only after all whiskey has finished being added.
I thought maybe a trigger when closing the pipboy but that might be a bit extreme.
Maybe there is away for the 'on add' to be delayed once all queued additions to the inventory have finished, i.e. check if its the last one.

 

Tried 'On Add' but that doesn't work for created items till they are dropped and then picked up again, according to the wiki.

Tried adding SetOnCraftingEventHandler but that fires for each added item for the whole.

 

Will keep trying things, any further suggestions welcome. :cool:

Link to comment
Share on other sites

You can only equip 1 whiskey at a time. It will not accept a count of items to equip in the case of ingestibles . The 2 flags for that function are to make the item non unequipable ... and to hide the equip message. Which the non unequipable flag doesn't appear to apply to ingestibles. But also the effects don't stack ... so is no reason to consume whiskey 5 / 10 times .

However , you can make the script do things based on the ishots variable ... which if you are adding X# whiskey to be counted then consumed immediately. You just set the variable to check against for messages and other commands instead of actually adding multiple ingestibles to the player inventory.

 

Which if I understand correctly what you are doing ... you don't even need the player to actually consume a vanilla whiskey item.

But if you made a unique one ... you could then set custom effects to apply when it is consumed. Thereby only needing that item to be added to inventory , then equipped for your scripting.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...