Start Script Combat

Post » Fri May 27, 2011 11:00 am

i'm trying to make a script that, when it's run, makes all the guards in a city come after me (i built the city myself) but i have an issue. because of a quest i made the guards come charging in for a questioning by having them start combat. by forcegreet they stop combat and ask their question. when you answer wrong they SHOULD attack you but... you guessed it.. they don't. i could only make 1 attack you through dialog but the others just don't seem to notice and start wandering around again. i want to make a start script i can run through the dialog that makes all the guards (they all have the same ID) attack "player". but how do i formulate it? because simply typing startcombat "payer" doesnt work ofcourse. is there some kind of command that specifies the action to a specific ID?

thanks!

(if anyone wants to make one for me the ID is Dun Bardall Guard)
User avatar
Andrew
 
Posts: 3521
Joined: Tue May 08, 2007 1:44 am

Post » Fri May 27, 2011 8:31 am

i'm trying to make a script that, when it's run, makes all the guards in a city come after me (i built the city myself) but i have an issue. because of a quest i made the guards come charging in for a questioning by having them start combat. by forcegreet they stop combat and ask their question. when you answer wrong they SHOULD attack you but... you guessed it.. they don't. i could only make 1 attack you through dialog but the others just don't seem to notice and start wandering around again. i want to make a start script i can run through the dialog that makes all the guards (they all have the same ID) attack "player". but how do i formulate it? because simply typing startcombat "payer" doesnt work ofcourse. is there some kind of command that specifies the action to a specific ID?

thanks!

(if anyone wants to make one for me the ID is Dun Bardall Guard)


Post the script.

"StartCombat" will take a fix : Actor_ID-> StartCombat, Player

I'm not sure if this will work for multiple references on the same ID. If not you could set local scripts to each gaurd with a short variable and set the variable in dialogue.

Begin MadModeShort readyif (MenuMode == 1)   returnendifIf (Ready == 0)   return   elseif (Ready == 1)             StartCombat, player   endifendifend



The guard initiating dialogue would set the variable in the results box linked to the "wrong answer". Such as;

Set "Dun Bardall Guard".Ready to 1

Been some time since I have written code, so bear with me here. :hehe:
User avatar
Liii BLATES
 
Posts: 3423
Joined: Tue Aug 22, 2006 10:41 am

Post » Fri May 27, 2011 1:07 pm

You're on the right track Miles, but I think that will still only work on one guard. What you said about the dialogue only initiating combat for one NPC was right; the game looks for the first reference of that NPC and acts on that, then stops looking. But suggesting setting a local variable will achieve the same effect- after it's set the local variable for that first NPC, why would it keep looking for another NPC to set its local? Instead of thinking in a one-action-changes-all fashion, think in a all-looks-for-change-in-one-action way.

Basically, make Ready a global variable with a unique name and you'll be good to go.
User avatar
Jah Allen
 
Posts: 3444
Joined: Wed Jan 24, 2007 2:09 am

Post » Fri May 27, 2011 10:44 am

i feel so stupid right now! i've done this over a hundred times yet i was thinking too complicated over such a simple matter >.<
thanks for waking me up people :P
User avatar
victoria johnstone
 
Posts: 3424
Joined: Sat Oct 14, 2006 9:56 am

Post » Fri May 27, 2011 12:55 pm

i'm trying to make a script that, when it's run, makes all the guards in a city come after me (i built the city myself) but i have an issue. because of a quest i made the guards come charging in for a questioning by having them start combat. by forcegreet they stop combat and ask their question. when you answer wrong they SHOULD attack you but... you guessed it.. they don't. i could only make 1 attack you through dialog but the others just don't seem to notice and start wandering around again. i want to make a start script i can run through the dialog that makes all the guards (they all have the same ID) attack "player". but how do i formulate it? because simply typing startcombat "payer" doesnt work ofcourse. is there some kind of command that specifies the action to a specific ID?

thanks!

You need to set the class of the guard for NPC. Also you can SetFight 100 in the dialogue (alternatively).
P.S. Just a theory. :)
User avatar
Benito Martinez
 
Posts: 3470
Joined: Thu Aug 30, 2007 6:33 am

Post » Fri May 27, 2011 6:09 pm

I've done a similar thing using a global variable that is checked for in each NPCs script. This means the NPCs can't just be generic guards, but you can make one new "generic" guard NPC and attach the script to it, and each instance of the guard that you place will call the local script separately. When you trigger the event, and you can set the global via dialogue and don't even need a script to do it, set the global variable to 1. Then make a check for that variable in their local script. If the variable is 1, setfight to 100 and startcombat player in the local script, and each NPC will react accordingly.
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Fri May 27, 2011 12:16 pm

i got it to work! just make a line seperated by spaces (to make it more accesible)

if ( *variable* == 1 )
SetFight 100
StartCombat "Player"
endif

a wrong answer sets that variable to one, and you're kinda doomed so i don't need a script to make them stop again. so it was actually really easy... o_o
User avatar
michael flanigan
 
Posts: 3449
Joined: Thu Jun 14, 2007 2:33 pm

Post » Fri May 27, 2011 5:50 am

Yep! :) I've found that in some cases, setting a single global variable makes things a million times easier than trying to contain everything in local variables. Local variables are a little unstable for some purposes. I originally tried doing exactly as you had done all with local variables, and I had to make all the npcs unique, even each guard, and then the script checked a long list of local variables being set for each npc. Every npc had the same local variable, and if it was set for one, I had to check for it in every other script, for each npc, and set each of their local variables to match.

It worked fine until I added stuff completely unrelated to the same cell, and then it suddenly started causing CTDs for no apparent reason. So I switched over to a simple global check just like above, and all the problems were gone. :)
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Fri May 27, 2011 2:39 pm

I know I'm chiming in late here since it's working and all, but I have a question... Since it's guards that you wan to attack, why not just set your crime level to 5000 or more?
User avatar
Kim Bradley
 
Posts: 3427
Joined: Sat Aug 18, 2007 6:00 am

Post » Fri May 27, 2011 2:59 pm

because then they come up for crime stuff and dialog me again, wich is already happening. it is about you get framed for something and they come and "arrest" you. then you get the chance to either explain or lie about the stolen goods. when you lie, you die. if i make crime level 5000 they'll go "your crimes blah blah goodbye" but they just said that ;)
User avatar
JD bernal
 
Posts: 3450
Joined: Sun Sep 02, 2007 8:10 am


Return to III - Morrowind

cron