Jump to content

Scripting Syntax Question - DoOnce on NPC


SickleYield

Recommended Posts

Ha haaa. It's October and this thread is back from the dead to haunt the living.

 

Thanks, GBHis, but the script didn't work. I still get a single activation with the messagebox coming up and absolutely nothing after that - no feeding, no pickpocket, no conversation, no more message - unless I attack him, and then he jumps up and starts beating my test character to death. The eventual plan is for him to be unconscious so that won't happen.

 

I'll do some more research in my increasingly lacking spare time.

 

I told the NPC's AI that he can only sleep within five feet of where I put him, so he IS in the right bed now.

 

Thanks for the helpfulness, all. Folks on this forum can be prickly, but I've noticed everyone's willing to help with a serious question. That's why I keep coming back here. :)

Link to comment
Share on other sites

Sorry, I didn't understand what you needed at first :)

 

 

Okay.... Try this ;)

scn BobbyGoesToSleep2

short state
short sneaker
ref act

Begin OnActivate
set act to getactionref
set sneaker to act.issneaking
;State 0 == (1), state 1 == (2), state 2 == (3)
If State == 0
MessageBox: "Eyjolf stirs faintly at your voice, but no mortal sound can wake him."
return
endif

If State != 1 && sneaker == 1
activate
elseif State < 2 && sneaker == 0
messagebox "He's fast asleep. You can't talk to him right now. (STATE: 1. Sneaking: No)"
return
elseif State > 1
activate
endif
end

Link to comment
Share on other sites

Try just an activate script on a NPC, let me know what it allows, and what it does not. We may have to make this a little more tricky. Right now GBiS's scripts probably won't work because it doesn't initiate any action. If activate doesn't allow something, we need to script another way to do that something. Be it a package which makes them wake up and go to the player (to talk), or even disable the running script if the player is within a certain range and sneaking.
Link to comment
Share on other sites

  GBHis said:
I think [activate] will make them wake and speak to the player? This worked in-game for me...

 

Ok, then let's try this...

 

in your 3d modeling program, create a structure that would sorround an NPC lying down. Think along the lines of a cocoon, make the mesh invisible, and have no collision. May want some visible parts that would be hidden by the bed so that you know where the mesh is, and can move it. Within the CS, associate the mesh with an activator. Name the activator similarly to the NPC so that there isn't that noticable of a difference.

 

On the activator, place all the the stuff you want them to do when activated and the player isn't sneaking/vampire. You have to do this since onactivate blocks seem to disable feeding/stealing on NPCs. Just have the activator point toward the NPC ref anywhere you need to.

 

As far as the NPC goes, now we need to script them to enable/disable the activator based on if the player is sneaking or not. If the player is sneaking, and is close enough to the NPC, have them disable the activator. If the player is not sneaking, or is further than 500 units away have them enable the activator. You could also add a check for vampirism in a similar manner.

 

It's kinda limiting in where it can be used, but should get you the results you want. It does however require some creative use of meshes, so that should be perfect for you.

Link to comment
Share on other sites

  Vagrant0 said:
in your 3d modeling program, create a structure that would sorround an NPC lying down. Think along the lines of a cocoon, make the mesh invisible, and have no collision. May want some visible parts that would be hidden by the bed so that you know where the mesh is, and can move it. Within the CS, associate the mesh with an activator. Name the activator similarly to the NPC so that there isn't that noticable of a difference.

 

On the activator, place all the the stuff you want them to do when activated and the player isn't sneaking/vampire. You have to do this since onactivate blocks seem to disable feeding/stealing on NPCs. Just have the activator point toward the NPC ref anywhere you need to.

 

As far as the NPC goes, now we need to script them to enable/disable the activator based on if the player is sneaking or not. If the player is sneaking, and is close enough to the NPC, have them disable the activator. If the player is not sneaking, or is further than 500 units away have them enable the activator. You could also add a check for vampirism in a similar manner.

 

It's kinda limiting in where it can be used, but should get you the results you want. It does however require some creative use of meshes, so that should be perfect for you.

 

Intriguing. I'll see how that does with my limited activator-oriented skills. :)

 

Thanks!

Link to comment
Share on other sites

Vagrant0...

 

Pickpocket/Feeding is possible when the activate command is used inside the OnActivate?

To be sure that we aren't looping, put in a 1 behind the activate command like:

me.activate player 1

Will activate the "me" ref without running OnActivate.

Link to comment
Share on other sites

  GBHis said:
Vagrant0...

 

Pickpocket/Feeding is possible when the activate command is used inside the OnActivate?

To be sure that we aren't looping, put in a 1 behind the activate command like:

me.activate player 1

Will activate the "me" ref without running OnActivate.

 

If it does, then what is the problem, something like:

scn stillsleepingscript

ref actor
short stage
short init

begin gamemode
if init !=1
set actor to getself
set stage to 0
set pickpocket to 0
set init to 1
endif
end

begin onactivate
if player.issneaking == 1 
activate
elseif stage == 0
message "This individual seems to be resting calmly."
setstage to 1
elseif stage == 1
message "They stir gently as you prod further, then lie still"
set stage to 2
elseif stage == 2
message "They slap your hand away violently, but seem to remain asleep"
player.modav health -1
set stage to 3
elseif stage == 3
actor.startconversation player, rudeawakening
setstage to 4
elseif stage == 4
actor.startconversation player, annoyedsleeper
actor.startcombat player
endif
end

should allow pretty much what you want.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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