Jump to content

WIPz Stealth Wars


lonewolfkai

Recommended Posts

Nope. You cannot do it like that.

 

You would need to have a reference variable for the total amount you want to manipulate at one time.

 

Example:

 

Set MyNPCa = Assas1

Set MyNPCb = Assas2

Set MyNPCc = Assas3

 

But again, it completely depends on how you use it. You can still get away with just one reference variable but you need to use it one at a time.

 

Set MyNPC = Assas1

MyNPC.MoveTo Player 100,100,0

MyNPC.enable

Set MyNPC = Assas2

MyNPC.MoveTo Player 100,100,0

MyNPC.enable

Set MyNPC = Assas3

MyNPC.MoveTo Player 100,100,0

MyNPC.enable

 

 

In that case, it may not even be necessary to use a ref, correct?

Link to comment
Share on other sites

You can reference them directly but the beauty of the variables is that you might have 20 lines of code but most are identical and less likely to be goofed up by a typo. When calling them directly, each and every line of code will be unique...thus, each code block will need to reference that individual reference.

 

There are many ways to do this, it is up to you how and really depends on how easy it is for you to keep up with it.

 

LHammonds

Link to comment
Share on other sites

You can reference them directly but the beauty of the variables is that you might have 20 lines of code but most are identical and less likely to be goofed up by a typo. When calling them directly, each and every line of code will be unique...thus, each code block will need to reference that individual reference.

 

There are many ways to do this, it is up to you how and really depends on how easy it is for you to keep up with it.

 

LHammonds

 

 

Hmm. It might be easier for me to keep up with it without ref. at first. I may try to implement them after the code is written.

 

Another thing I thought about is in part of the script, I'm going to have it where you can detect the NPC before they detect you and attack. What if the NPC appears behind you and you don't see him? He is still there and gets left behind even when you leave the cell. I guess the script would still pull him to your location if the chance for him to appear again is called even though he isn't in his holding cell. Would that be right? He would already be enabled because he is wandering around in the cell. What about the part of the script that tries to enable him again. Would that command just be ignored since he already is enabled?

Link to comment
Share on other sites

It completely depends on how you have your script setup and NPCs configured. If the NPCs are not hostile to you, then yes, that scenario could occur where they appear behind you (and they do not attack)...but if the NPC is defined as being hostile towards you, they "should" attack immediately being that close.

 

As for leaving the area with the NPC still there, it completely depends on your script. If you script ONLY pulls inactive NPCs from the cage, that NPC will never get touched again unless he happens to die at the hands of a spawned creature. You might want to include a separate location check to see if any active NPCs are "too far away" from the player and can be disabled and placed back into the cage to be spawned in your main script.

 

LHammonds

Link to comment
Share on other sites

It completely depends on how you have your script setup and NPCs configured. If the NPCs are not hostile to you, then yes, that scenario could occur where they appear behind you (and they do not attack)...but if the NPC is defined as being hostile towards you, they "should" attack immediately being that close.

 

As for leaving the area with the NPC still there, it completely depends on your script. If you script ONLY pulls inactive NPCs from the cage, that NPC will never get touched again unless he happens to die at the hands of a spawned creature. You might want to include a separate location check to see if any active NPCs are "too far away" from the player and can be disabled and placed back into the cage to be spawned in your main script.

 

LHammonds

 

 

I'm hoping to make it a chance to where the NPC won't be able to see you since you'll be in sneak mode. I don't think the script is specific to only pull inactive npcs. It's almost identical to the ones above:

If a = 1 assas1.moveto player x,y,z

assas1.enable

 

Talking about using references again, could I mix both using ref and not using them? For example, single NPCs could use the MyNPC ref, but when the script calls for multiple NPCs, just don't use them?

such as:

If a == 1

MyNPC.moveto player x,y,z

MyNPC.enable

endif

 

If a == 2

assas1.moveto player x,y,z

assas2.moveto player x,y,z

assas1.enable

assas2.enable

endif

 

Oh and Alithelord on bethsoft suggested that I use a float command for my random chance variables.

Like: Float A

Float B

 

What the heck is that?

 

Sorry for all these questions. I'll eventually get to a point where I've finally got it.

Link to comment
Share on other sites

If you are not checking the state of the NPC, I would suggest your move code covers all states of the NPC. (enabled/disabled, live/dead, here/there)

 

So each command would start with disabling them, resurrecting (health to 100%), then move them and finally enable.

 

LHammonds

Link to comment
Share on other sites

If you are not checking the state of the NPC, I would suggest your move code covers all states of the NPC. (enabled/disabled, live/dead, here/there)

 

So each command would start with disabling them, resurrecting (health to 100%), then move them and finally enable.

 

LHammonds

 

I am having an OnDeath script added to each NPC so that when they die, they go back to the holding cell, get resurrected and disabled. But, I don't have a check for enabled/dis.

 

Nevermind about the Float function. I finally found the info about it on cs.elderscrolls. I still don't really understand why I need to use short or float for the random factor of the script. I think I know why, but aren't really sure.

Link to comment
Share on other sites

  • 2 weeks later...

I finally got around to testing this script, but I have a big problem.... it won't work.

 

I couldn't get the script to even save in the construction set. First it kept telling me there had to be a begin/end for all scripts. After putting in a Begin Gamemode/end block, it keeps telling me that Line 10 has a syntax error: Undefined function Set. Line 10 is the If OnControlDown 9 Set A to Rand 1 4.

 

Here's how I structured the test script:

 

ScriptName AAAStealthWarBook

;This activates the random stealther chance

 

Begin Gamemode

 

Short Doonce

float A

float B

 

If OnControlDown 9 Set A to Rand 1 4

If A <= 2 Set B to Rand 1 2

Endif

If B == 1 Assas1.MoveTo Player 100,100,0

Assas1.enable

Endif

If B == 2 Assas2.MoveTo Player -100,100,0

Assas2.enable

Endif

Endif

End

 

I didn't really want to do a Begin Gamemode block because it runs all the time. I just wanted the script to start when you went into sneak mode.

Link to comment
Share on other sites

Okay, got the problem fixed, sort of. I needed to use ( ) for agrument type structures, and change the variables a little so they would be short rather than float so that I can use whole numbers rather than < > type stuff. CS would NOT let me save the script without using a ref command for each of the NPCs for some reason. It kept telling me I HAD to use a ref command for them. Fixed that, saved it, attached it to a scroll, buuuuut, it crashes the game immediately upon taking the scroll.

 

Back to square one. I think I'm going to go the quest route, and attach a similar script to a quest script to do the functions I'm wanting. I think this will be easier in the long run anyways.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...