Jump to content

Scripting Syntax Question - DoOnce on NPC


SickleYield

Recommended Posts

Hey all!

 

Firstly I apologize if this is already down at the CS Wiki - I've been wading through their script tutorials and info for a few days now without success. I need to know how to use the DoOnce syntax, but I'm not finding much on it other than comments such as "Oh, yeah, you're going to want to use that."

 

I'm trying to create a script to apply to a sleeping NPC so that when you activate him the first time, a message pops up, but after that you get regular talk/pickpocket/vampire feeding activation.

 

This is the script so far:

 

short doonce

 

Begin OnActivate

 

If DoOnce==0

MessageBox: "Eyjolf stirs faintly at your voice, but no mortal sound can wake him."

Set DoOnce to 1

endif

 

If DoOnce==1

Return

endif

 

end

 

 

This one doesn't work. The message does come up once, but after that you get no activation at all. I may use this for an "untouchable, sleeping" NPC later on, but at the moment it's not what I want.

 

Anyone?

Link to comment
Share on other sites

Ehh, looking at the Wiki, it appears that you actually DON'T need to initialize it.

 

Try adding a message box in the second if, before the Return, in order to see if it's executing properly.

 

 

This shouldn't matter, but see if changing the second If to ElseIf fixes it..

Link to comment
Share on other sites

short doonce

 

Begin OnActivate

 

If DoOnce==0

MessageBox: "Eyjolf stirs faintly at your voice, but no mortal sound can wake him."

Set DoOnce to 1

endif

 

If DoOnce==1

Return

endif

 

end

 

The problem is that you have a "return", with a return, the script just ends without anything happening. Kinda like a sudden jump to end if a certain condition is present. Instead of a "return" you should try using "activate" as this will cause the action to continue. I'm not sure how this will work exactly on an NPC in relation to a pickpocket/feed action, but it should atleast allow you to talk to him.

Link to comment
Share on other sites

The problem is that you have a "return", with a return, the script just ends without anything happening. Kinda like a sudden jump to end if a certain condition is present. Instead of a "return" you should try using "activate" as this will cause the action to continue. I'm not sure how this will work exactly on an NPC in relation to a pickpocket/feed action, but it should atleast allow you to talk to him.

 

LOL. Thanks for the headsup, at least I won't make that particular mistake again.

 

I tried activate instead of return, and this time first it gave me the "He won't wake up" message, and then he instantly got up and triggered conversation with the PC.

 

There's that one guy in the DB quest in the game, but he's just stationary - all you get from him ever is the "he's unconscious because he's sick" message.

 

Hmmm. I guess I'll have to do some more research. It never makes any sense to me when there are "sleeping" or "unconscious" characters in the game and they can instantly wake up when you talk to them despite not noticing you drinking their blood. I'm also hoping to give a vampire vic a little more personality/backstory. I don't like the way most vampire mods treat people as nameless objects when your vampire PC doesn't have to act that way, and at least one game vampire doesn't either (Count Hassildor).

 

Not to mention possible uses in a quest. Maybe I could use a queststage wherein you get the message until you do a certain action (say read the diary by the bed) and then you can feed, but the person remains unconscious, and then after one more action (say, add a certain object to their inventory) you can wake them up... Would that work?

 

On a slightly humorous note, at the moment I have two vampvictims in WarKirby's castle for testing purposes (since I know the ESP is temporary). They're both male incl. the one in the secret room. I put the Nord in the main bed, but he keeps going to the slab despite his wander package saying "sleep within ten feet of current position." I'll go into the secret room and Eutychus (vic 1) will turn around and look at me because there's an enormous Nord on his slab. It's obviously my imagination that he looks peeved, but still.

Link to comment
Share on other sites

Oh -- If I do this one better than Vagrant0, someone owes me a coke :)

 

Try this, anyway. (Without modificating the code -- at first.)

scn BobbyGoesToSleep1

short doonce
ref act

Begin OnActivate
set act to getactionref

If DoOnce==0
MessageBox: "Eyjolf stirs faintly at your voice, but no mortal sound can wake him."
Set DoOnce to 1
endif

If DoOnce==1
activate act 1
endif

end

 

What is it EXACTLY you want to happen when the DoOnce var is set to 1?

 

This one will prevent the stealing...

scn BobbyGoesToSleep2

short doonce
ref act

Begin OnActivate
set act to getactionref

If DoOnce==0
MessageBox: "Eyjolf stirs faintly at your voice, but no mortal sound can wake him."
Set DoOnce to 1
endif

If (DoOnce==1) && (act.issneaking != 1)
activate act 1
endif

end

Link to comment
Share on other sites

@Sicleyield: For my vic, I commanded her to use only the slab by seting that reference a the target. Try that/

 

WarKirby: I'm clearly doing something wrong, but what happens when I try that is that I get a little red circle with a crosshair. I click on the bed, the crosshair disappears, but the reference resets itself to something-or-other cave in the AI screen. Should I be clicking the reference in the list screen instead?

 

GBHis: Thanks! I'll try it tonight after work.

 

Ideally what I want is for the NPC to have three states.

 

1)No feeding or pickpocketing, message comes up.

2)Feeding and pickpocketing okay, but NPC is unconscious and won't talk to you.

3)Feeding, pickpocketing and talking to NPC are all possible.

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...