A script question

Post » Sun Aug 09, 2009 7:13 am

OK, i already had some people help me create some teleporting scripts before. My question: Is there a way to have a teleport spell effect on an npc once they teleport? Like if i were to give an npc a recall scroll they use it then teleport while you are in the same cell as the npc but i want to where the spell effect happens on the npc so you see that they used the scroll and they teleport instead of them just disappearing.
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Sun Aug 09, 2009 8:25 am

OK, i already had some people help me create some teleporting scripts before. My question: Is there a way to have a teleport spell effect on an npc once they teleport? Like if i were to give an npc a recall scroll they use it then teleport while you are in the same cell as the npc but i want to where the spell effect happens on the npc so you see that they used the scroll and they teleport instead of them just disappearing.


Yes to all....

All that is possible with one script mate. Just use different events to call different parts of the script.
User avatar
Sebrina Johnstone
 
Posts: 3456
Joined: Sat Jun 24, 2006 12:58 pm

Post » Sun Aug 09, 2009 4:24 am

Thanks! I'll just ask another question instead of starting a new topic. I'm doing this one script where i'm going to have a sparring tournament between npc's NOT involving the player. Is there any need to set disposition to initiate the fight or all i need to do is startcombat and set fight 100?
User avatar
Ryan Lutz
 
Posts: 3465
Joined: Sun Sep 09, 2007 12:39 pm

Post » Sun Aug 09, 2009 2:56 am

Thanks! I'll just ask another question instead of starting a new topic. I'm doing this one script where i'm going to have a sparring tournament between npc's NOT involving the player. Is there any need to set disposition to initiate the fight or all i need to do is startcombat and set fight 100?

IIRC Disposition is only between an NPC and the PC. Ergo all you need to do is use startcombat
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm

Post » Sun Aug 09, 2009 3:32 am

Sweet yea just figured that out thanks. Shouldn't I set fight to 0 so the npc doesn't try to attack the player? Or if their standard set fight is like at 30 is that OK for me not to worry about it?
User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Sat Aug 08, 2009 9:19 pm

Yes, 30 fight is ok if you don't want them to attack the player.
User avatar
naana
 
Posts: 3362
Joined: Fri Dec 08, 2006 2:00 pm

Post » Sun Aug 09, 2009 12:26 am

Ok, i seem to be headed in the right direction. I'm trying to figure out how to set the npc's health back to a health ratio of 1.0 after the sparring fight is over. Am i suppose to do use the "currenthealthratio" function to set a npc's health ratio back to 1.0 or 100%? I also, don't want them to die. Here this is the first script for the first fight. I'm using the global variable "SMTourney" to start this script. SMTourney will get set to 1 after a day has passed. Then SMTourney will be set to 3 via dialogue to start the fight.


Begin SM_tourneyScript        short state        if ( state == 0 )        if ( SMTourney == 1 )            set state to 1                    endif            elseif ( state == 1 )        "SM_ilden mirel"->positioncell, 4945.83, 3534.95, 15170.00, 0, "Sadrith Mora, Guild of Fighters"        "Sondryn SM_Irathi"->positioncell, 4585.85, 3534.94, 15170.00, 0 "Sadrith Mora, Guild of Fighters"        "SM_daglin selarar"->positioncell, 5288.38, 3309.33, 15170.00, 0 "Sadrith Mora, Guild of Fighters"        "Hrundi"->positioncell, 4386.50, 3849.92, 15170.00, 0 "Sadrith Mora, Guild of Fighters"        "SM_2orcshaman"->positioncell, 5221.71, 3952.97, 15170.00, 0 "Sadrith Mora, Guild of Fighters"        "Hasell"->positioncell, 4223.53, 3293.14, 15170.00, 0 "sadrith Mora, guild of fighters"        set SMTourney to 2        set state to 2            elseif ( state == 2 )        if ( SMTourney == 3 )            "SM_ilden mirel"->equip, "Dwarven war axe"            "SM_ilden mirel"->startcombat, "Sondryn Irathi"            "Sondryn SM_Irathi"->startcombat, "SM_ilden mirel"            set state to 3        endif    elseif ( state == 3 )                if ( "SM_ilden mirel"->GetHealthGetRatio <= 0.5 )            set state to 4            set prone to 1        elseif ( "sondryn SM_Irathi"->gethealthgetratio <= 0.5 )            set prone to 2            set state to 4        endif            elseif ( state == 4 )        "SM_ilden mirel"->StopCombat        "sondryn SM_Irathi"->stopcombat        set state to 5            elseif ( state == 5 )        If ( getpcCell "Sadrith Mora, Guild of Fighters" == 0 )            "hrundi"->positioncell, 4174.11, 4610.41, 15170.00, 0 "Sadrith Mora, Guild of Fighters"            "Hasell"->positioncell, 4747.93, 3354.42, 15170.00, 0 "Sadrith Mora, Guild of Fighters"            "SM_2Orcshaman"->positioncell, 4825.67, 3264.14, 15682.00, 0 "Sadrith Mora, Guild of Fighters"            "SM_Daglin Selarar"->positioncell, 5436.42, 4303.79, 14786.00, 0 "Sadrith Mora, Guild of Fighters"            "SM_Ilden Mirel"->positioncell, 5557.41, 3483.18, 15170.00, 0 "Sadrith Mora, Guild of Fighters"            "Sondryn SM_Irathi"->positioncell, 5691.06, 4803.49, 14786.00, 0 "Sadrith mora, guild of fighters"            stopscript, SM_tourneyScript        endif    endif    end


It works perfectly other than the fact that it is possible for an npc to kill another npc like if one of them scored a critical hit when the other npc's health is at like 55 percent or something. Plus i want their health to go back to 100 percent if they advance to the next round.

*edit* i saw the one command named "modcurrenthealth" it says that you can alter the current health even if you set it to a crazy number it will only go the npc's or player's max health. So i just put in the command

"NpcID"->modcurrenthealth, 1000

and as long as their health isn't over 1000 that should do the trick. Is this what is usually done? I never used this command before.
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Sun Aug 09, 2009 4:04 am

I figured out the above. Pretty simple. Ok, everything i got working correctly. I'm doing this tournament where the tournament will occure once a month. I'm going to re-use the scripts so any local variables that I use have to be reset to 0 in those scripts for these scripts to work correctly. This script works correctly.

Begin SM_tourneyScriptshort stateif ( state == 6 )set state to 0endifif ( state == 0 )	if ( SMTourney == 2 )		set state to 1endifelseif ( state == 1 )	"SM_daglin selarar"->positioncell, 4945.83, 3534.95, 15170.00, 0, "Sadrith Mora, Guild of Fighters"	"Hrundi"->positioncell, 4585.85, 3534.94, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"SM_Ilden Mirel"->positioncell, 5288.38, 3309.33, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"Sondryn Irathi"->positioncell, 4386.50, 3849.92, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"Sondryn SM_Irathi"->positioncell, 4386.50, 3849.92, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"SM_2orcshaman"->positioncell, 5221.71, 3952.97, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"Hasell"->positioncell, 4223.53, 3293.14, 15170.00, 0 "sadrith Mora, guild of fighters"	set SMTourney to 3	set state to 2elseif ( state == 2 )	if ( SMTourney == 4 )	"SM_Daglin Selarar"->equip, "Icicle"	"SM_Daglin Selarar"->startcombat, "Hrundi"	"Hrundi"->startcombat, "SM_Daglin selarar"	set state to 3endifelseif ( state == 3 )	if ( "SM_Daglin Selarar"->GetHealthGetRatio <= 0.5 )		set state to 4		set prone to 1	elseif ( "Hrundi"->gethealthgetratio <= 0.5 )		set prone to 2		set state to 4	endifelseif ( state == 4 )	"SM_Daglin Selarar"->StopCombat	"Hrundi"->stopcombat	"SM_Daglin Selarar"->modcurrenthealth, 1000	"Hrundi"->modcurrenthealth 1000	set state to 5elseif ( state == 5 )	If ( getpcCell "Sadrith Mora, Guild of Fighters" == 0 )	"hrundi"->positioncell, 4174.11, 4610.41, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"Hasell"->positioncell, 4747.93, 3354.42, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"SM_2Orcshaman"->positioncell, 4825.67, 3264.14, 15682.00, 0 "Sadrith Mora, Guild of Fighters"	"SM_Daglin Selarar"->positioncell, 5436.42, 4303.79, 14786.00, 0 "Sadrith Mora, Guild of Fighters"	"SM_Ilden Mirel"->positioncell, 5557.41, 3483.18, 15170.00, 0 "Sadrith Mora, Guild of Fighters"	"Sondryn SM_Irathi"->positioncell, 5675.06, 4101.49, 14786.00, 0 "Sadrith mora, guild of fighters""Sondryn Irathi"->positioncell, 5646.06, 4564.49, 14786.00, 0 "Sadrith mora, guild of fighters"	set state to 6	stopscript, SM_tourneyScriptendifendifend


I set state to 6 at the end b/c when the script wil get restarted it will not be stuck on state 5 and just do the last command it will set state to 0 then actually do the whole script again. The problem is i can't get this script to do the same. I'm not not very familar on these local variables. Any help?

begin SM_Tourney_dayScriptshort daysPassedshort myDay;stop once enough time has passed.if ( Prone == 3 )Journal "SM_Tourney" 30set dayspassed to 0set myday to 0startscript, "SM_TourneyScript"StopScript SM_Tourney_dayscriptendif;when stronghold starts building, store the current dayif ( daysPassed == 0 )set myDay to Dayset daysPassed to 1endif;if we've already set a day, count the daysif ( myDay != Day );presumably it went up...set daysPassed to daysPassed + 1set myDay to Dayendif;wait x days for the stronghold to be built, give journal, set global;make sure player is NOT in the cell while the stuff goes "poof"if ( daysPassed > 1 )set Prone to 3set SMTourney to 2endifEnd


I thought maybe if i set dayspassed to 0 and myday to 0 that would work but it didn't :(

*edit* I got it to work. I just got rid of this bottom script and re worded the other script
User avatar
LijLuva
 
Posts: 3347
Joined: Wed Sep 20, 2006 1:59 am

Post » Sun Aug 09, 2009 7:39 am

Lol well done mate it sounds interesting
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm


Return to III - Morrowind