Various activation scripts

Post » Mon Jan 11, 2010 12:42 pm

Alright, my mod is nearing a close, and i need but two or so more things done. I have my player sleep in a bed, and when he wakes up, there is two guards in the cell, and he gets a journal update to speak to an npc, named Jim for our purposes. Thats the first part i need help with. The second part is probably really easy, but what command is there that will remove a player from a faction?

So two things i need help with, a script that activates the above after sleeping, and a command to remove a player from a faction. Any and all help appreciated! Thanks!
User avatar
Red Bevinz
 
Posts: 3318
Joined: Thu Sep 20, 2007 7:25 am

Post » Mon Jan 11, 2010 4:14 pm

Alright, my mod is nearing a close, and i need but two or so more things done. I have my player sleep in a bed, and when he wakes up, there is two guards in the cell, and he gets a journal update to speak to an npc, named Jim for our purposes. Thats the first part i need help with. The second part is probably really easy, but what command is there that will remove a player from a faction?

So two things i need help with, a script that activates the above after sleeping, and a command to remove a player from a faction. Any and all help appreciated! Thanks!

For the first one, see if this outline is enough to help:
short Sleepif ( GetJournalIndex "Whatever" = 666 ) ;Or whatever the appropriate pre-condition is.   if ( GetPCSleep )      set Sleep to 1   else      if ( Sleep )         set Sleep to 0         ;Do stuff      endif   endifendif


For the second, unfortunately, there IS no such command. The closest that exists is PCExpell "FactionName", but that doesn't exactly remove them completely.
User avatar
Elisabete Gaspar
 
Posts: 3558
Joined: Thu Aug 31, 2006 1:15 pm

Post » Mon Jan 11, 2010 1:44 pm

First part:

Script suggested by ManaUser looks good.
If i could take it one step further:

1. Make the 2 NPC's. Set their wander to 0, just so they dont wander anywhere. Now place them around or near the bed you want this to all take place near.
2. Make a script which will be attached to both of them. This script will make them disabled (invisible and not in the game) until a journal reaches a certain point (whereby they are activated and will now appear ingame where they were placed). This would look something like this:

Begin script_nameif ( GetDisabled == 0 )	if ( GetJournalIndex Journal_Index < 10 )		Disable	endifelseif ( GetDisabled == 1 )	if ( GetJournalIndex Journal_Index >= 10 )		Enable	endifendifif ( GetJournalIndex Journal_Index < 10 )	returnendifEnd script_name


As you can see, this sets them to default Disabled, and then the journal index hits 10, they are enabled. This is a butchered script i use for static item enabling/disabling (much like how player strongholds are activated in stages) and should definately work ingame for NPC's.

3. So, now in the "do stuff here" section in the suggested script from Manauser, simply put in a Journal updater that will change the journal index to the value that will make them appear. The index could be something like "i have been awoken" [elaborate]. And thena journal index after they have talked to you about what to do then.


The second part is tricky. Like Manauser said i cant think of a way to totally remove the faction for a players faction list. My suggestion is to simply use the suggested expell player command and be content that it will atleast say "expelled". You;d expect that with a Joinfaction command they would have a Removefaction or Leavefaction command. but no -_-

Hope this helps
User avatar
Eduardo Rosas
 
Posts: 3381
Joined: Thu Oct 18, 2007 3:15 pm

Post » Mon Jan 11, 2010 5:12 pm

After reading what i posted i also thought of a much simpler way to do this.

Instead of putting together a seperate script for the NPC's , in the "Do stuff" section simply put this:

"NPC_1_ID"->enable "NPC_2_ID"->enable Journal Journal_index 10 "NPC_1_ID"->forcegreeting



This will enable them, update your journal and then make you talk to the first one.

Naturally however, they would need to be disabled in the first place. In most mods i make, i usually have one "MASTER" script which runs ONCE the first time the mod is installed. This does important things like enabling/disabling existing and new NPC's, setting global states, ensuring existing NPC's are alive, etc. I suggest that you have something like this, run it as a global script that runs once (put in a doonce function) and in it put the lines:

"NPC_1_ID"->disable "NPC_2_ID"->disable


Of course if this sounds too complex, you could still make a simple script which attaches to each NPC like this:

Begin script_name  disable  End


90% sure this would work ok. Or you could use the script i suggested in the previous post, and simply remove the stuff related to the enabling.


There is ofcourse the option of having some elaborate script that places the npc's near you (sort of like how the assassins are spawned near you from the Tribunal expansion) but i honestly would never be bothered doing that.

Hope that helps.
User avatar
Rik Douglas
 
Posts: 3385
Joined: Sat Jul 07, 2007 1:40 pm

Post » Mon Jan 11, 2010 1:36 pm

if getpcrank "nameoffaction"> 0    pclowerrank


lowering rank should work. might have to lower rank to "-1" i forget.
User avatar
Lori Joe
 
Posts: 3539
Joined: Tue Jun 20, 2006 6:10 am

Post » Mon Jan 11, 2010 2:56 pm

if getpcrank "nameoffaction"> 0    pclowerrank


lowering rank should work. might have to lower rank to "-1" i forget.

I was prepared to be impressed, but sadly this didn't seem to work.
User avatar
Matt Fletcher
 
Posts: 3355
Joined: Mon Sep 24, 2007 3:48 am

Post » Tue Jan 12, 2010 12:49 am

Alright everyone, i've gotten everything set right except for one little kink. Obviously, to activate the script, you have to sleep in the bed. BUT, when you attach the script to the bed, then the sleeping script is removed, and you can't sleep, therefore the script doesn't work. How do i get around this?
User avatar
Chris Guerin
 
Posts: 3395
Joined: Thu May 10, 2007 2:44 pm

Post » Mon Jan 11, 2010 9:54 pm

Alright everyone, i've gotten everything set right except for one little kink. Obviously, to activate the script, you have to sleep in the bed. BUT, when you attach the script to the bed, then the sleeping script is removed, and you can't sleep, therefore the script doesn't work. How do i get around this?

You need to append the standard bed script to your script. Putting it at the top should do it, though you will want to remove the MenuMode check. You might be able to put it at the bottom too, and leave the MenuMode check. Finally, you could probably add "else ShowRestMenu" at the end of the block that has OnActivate.
User avatar
Kelly Osbourne Kelly
 
Posts: 3426
Joined: Sun Nov 05, 2006 6:56 pm

Post » Mon Jan 11, 2010 9:50 am

Or just attach it to something else in the room, whichever.
User avatar
Rebecca Dosch
 
Posts: 3453
Joined: Thu Jan 18, 2007 6:39 pm

Post » Mon Jan 11, 2010 5:16 pm

Does PCExpell "Faction_id" not work for you?

Wouldn't you just expell them via the script and add a dialogue line to refuse them entry again if that's what you wanted?
User avatar
Jerry Cox
 
Posts: 3409
Joined: Wed Oct 10, 2007 1:21 pm

Post » Mon Jan 11, 2010 2:32 pm

You need to append the standard bed script to your script. Putting it at the top should do it, though you will want to remove the MenuMode check. You might be able to put it at the bottom too, and leave the MenuMode check. Finally, you could probably add "else ShowRestMenu" at the end of the block that has OnActivate.

As nooby as I hate to be, i have no idea how to do that. Once I've finished this mod though I am going to learn MSFD until I murmur it while I sleep. I think i'll just do what manauser said though and attach the script to another item in the room, it will be much easier on me that way.

And to Illuminiel, It's not that i need them to do anything, its just at the end of the mod it kinda wraps itself up and disappears, and i want the faction to disappear with it. When you use the expel function, will it remove it from the list of factions your in?
User avatar
Klaire
 
Posts: 3405
Joined: Wed Sep 27, 2006 7:56 am

Post » Mon Jan 11, 2010 1:35 pm

As nooby as I hate to be, i have no idea how to do that. Once I've finished this mod though I am going to learn MSFD until I murmur it while I sleep. I think i'll just do what manauser said though and attach the script to another item in the room, it will be much easier on me that way.

And to Illuminiel, It's not that i need them to do anything, its just at the end of the mod it kinda wraps itself up and disappears, and i want the faction to disappear with it. When you use the expel function, will it remove it from the list of factions your in?

You would just copy the script that is normally on the bed, minus the "begin" and "end" lines, and paste it into your script. The "else" command is a little more elegant, but not really needed. But hey, do it however you feel works best for you.

As for the other question, no, the faction will always show up in your list, and you will still be considered a member from what I understand. There was some talk about actually allowing the removal of the PC from a faction with the MCP recently, though.
User avatar
NIloufar Emporio
 
Posts: 3366
Joined: Tue Dec 19, 2006 6:18 pm

Post » Mon Jan 11, 2010 6:03 pm

You would just copy the script that is normally on the bed, minus the "begin" and "end" lines, and paste it into your script. The "else" command is a little more elegant, but not really needed. But hey, do it however you feel works best for you.

As for the other question, no, the faction will always show up in your list, and you will still be considered a member from what I understand. There was some talk about actually allowing the removal of the PC from a faction with the MCP recently, though.

Thanks for the heads-up, i'lll probably just use the expel command for now, and when MCP comes out i'll update it. Thanks for the help everyone!
User avatar
Mike Plumley
 
Posts: 3392
Joined: Wed Sep 05, 2007 10:45 pm


Return to III - Morrowind