another scriipt question

Post » Thu May 26, 2011 10:28 pm

Begin FATScriptIf ( getjournalindex "SM_hotbartender" =< 48 )	if ( GetDisabled == 1 )	enable		endif	endifelseIf ( GetPCCell "Tel Aruhn, Plot and Plaster" == 0 )	If ( getjournalindex "SM_hotbartender" >= 49 )		if ( GetDisabled == 0 )			disable		endif	endifendifend


Havn't tested it yet, but i'm gong to. Do i need to put a do_once condition for all of this?

Ok, this is what i want to do. In a quest you talk to this certain npc. I did have a travel condition on them where they change cells once you left the current cell and you see them later. But for this situation they will be changing clases. So i duplicated this npc and now i want the old npc to be disabled and the new npc to be enabled. I'm going to attach this script to them so it will be a local script. Does this look good?

I put the
If ( GetPCCell "Tel Aruhn, Plot and Plaster" == 0 )


because once the journal updates the npc will vanish while they are in the same cell. that's not what i want. Only when they leave the player leaves the cell.
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm

Post » Thu May 26, 2011 11:30 pm

That works. Change your less-than sign to '<=' instead of '=<', and stop the script once you disable the first NPC.
User avatar
Austin Suggs
 
Posts: 3358
Joined: Sun Oct 07, 2007 5:35 pm

Post » Fri May 27, 2011 10:31 am

thanks.

Half of the script seems to work and the other half doesn't. For each script the

If ( GetPCCell "Tel Aruhn, Plot and Plaster" == 0 )


and everything beneath doesn't work. This is a local script and i'm thinking this might not work for a local script b/c doesn't the script stop working once i leave the cell? then if that happens how does it check to see if i'm NOT in the cell to do the following beneath it.

right? i'm pretty sure unless..i'm missing something else?
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Fri May 27, 2011 8:33 am

Ok i got it work as a global script, but in order for it work ALL the time i had to use the edit startscripts under the gameplay tag in the CS. Is this ok to do? If you have to many startscripts in a game can it slow the game down??
User avatar
luis dejesus
 
Posts: 3451
Joined: Sun Aug 19, 2007 7:40 am

Post » Fri May 27, 2011 7:26 am

You're fine, just put it as a startscript.
User avatar
Anna Beattie
 
Posts: 3512
Joined: Sat Nov 11, 2006 4:59 am

Post » Fri May 27, 2011 1:24 am

Yup, will do thanks.

I got another script question. This one is....not a common one and i'm not sure if it's even possible.

Here is what I want to do. An npc is going to say something and say let me prove myself so they "spare" meaning they go into combat. But i want it so that if either the player's or the npc's health drop bellow 50 percent then the combat will stop. Is this possible? Then right away the dialogue screen will pop up.

I was looking around and was wondering if it would go something like this.

Begin sparringscriptIf ( player->gethealthgetratio <= 0.5 )	stopcombat	setfight 0	setdisposition 50endifif ( "hrundi"->gethealthgetratio <=0.5 )	stopcombat	setfight 0	setdisposition 50endifend


Does this look good?
User avatar
ashleigh bryden
 
Posts: 3446
Joined: Thu Jun 29, 2006 5:43 am

Post » Fri May 27, 2011 10:21 am

In the dialogue result box, use the startScript, "sparringscript", Goodbye and startcombat, "Player". If you want the NPC to immediately talk to the player, use ForceGreeting after you stop combat.
User avatar
Blackdrak
 
Posts: 3451
Joined: Thu May 17, 2007 11:40 pm

Post » Fri May 27, 2011 7:46 am

Yes, thank you! I just tested it and it worked! LOL

I just think it's really funny b/c i literally spent like 10 second creating that script. Damn....it feels good when things work out that well. Took me 5 hours to a simple ai follow script to work.


**EDIT**
Begin sparringscriptIf ( player->gethealthgetratio <= 0.5 )		stopcombat		setfight 0		setdisposition 50		journal "SM_recruitshaman" 55		"sm_ORCSHAMAN"->forcegreeting		return				eLSEif ( "SM_orcshaman"->gethealthgetratio <=0.5 )		stopcombat		setfight 0		setdisposition 50		journal "SM_recruitshaman" 50		"sm_ORCSHAMAN"->forcegreeting		return				stopscript sparringscript			endifend


I can't figurreout why the forcegreeting keeps poping up. Any help? I putin the the return.
User avatar
Wanda Maximoff
 
Posts: 3493
Joined: Mon Jun 12, 2006 7:05 am

Post » Fri May 27, 2011 4:30 am

Try using state variables to ensure that certain actions are done only once. Try this and let me know if it works (untested):

Begin sparringscriptshort stateif ( state == 0 )	if ( player->GetHealthGetRatio <= 0.5 )		set state to 1	elseif ( "SM_orcshaman"->GetHealthGetRatio <= 0.5 )		set state to 1	endifelseif ( state == 1 )	"SM_orcshaman"->StopCombat	"SM_orcshaman"->SetFight 0	"SM_orcshaman"->SetDisposition 50	Journal, "SM_recruitshaman", 50		set state to 2	"SM_orcshaman"->ForceGreetingelseif ( state == 2 )	stopscript, "sparringscript"endifEnd


Also, you're going to want to make sure you stay consistent. If you're going to specify the fix (caller of the function) in one part of the script, do it in all parts. Keep your capitalization consistent: is it "sm_ORCSHAMAN" or "SM_orcshaman"?
User avatar
Scared humanity
 
Posts: 3470
Joined: Tue Oct 16, 2007 3:41 am

Post » Fri May 27, 2011 2:44 am

"SM_orcshaman"

Yeah thanks that worked. Yea i was working on a function like that except i did the do_once thingy and it didn't work. Not to familar with those variable commands. Thanks! Works like a charm.
User avatar
Tai Scott
 
Posts: 3446
Joined: Sat Jan 20, 2007 6:58 pm


Return to III - Morrowind