Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting help
03-19-2007, 12:03 AM,
#1
Scripting help
Ok, i can't believe i have to ask for help on this one, but HOW do you kill a creature through scripting? Cause i can't seem to get it to work. I've tried setting health to 0, using the KILL function, ect.

What is the best way to do it, or more simply, what is wrong with the statement

StSeUndead2.Kill

Cause it isn't working. At all. Maybe cause it's a creature? What do i do then?

I'm almost ashamed i have to ask how to kill something, but i've been trying for the better part of an hour, and the only thing the scripting has successfully killed is myself.

note- before anyone asks, yes i know that the scripting block it was in was being executed. in the same block i included a message command, which appeared on my screen when i tested. So why don't it work?
Leader of the Morag Tong
Hail Mephala
I do work sometimes - I swear!
Reply
03-19-2007, 01:30 AM,
#2
 
Is the reference you set to kill an actual editor reference? Or a whole creature entry in the CS? Should be a specific reference you're killing.

Is the reference marked as persistent?
Reply
03-19-2007, 01:40 AM,
#3
 
Yes, it is a persistant reference. Specifically, there are 4 leveled undead creatures i need to kill off at a certain point in a quest. Their reference editor IDs are StSeUndead1, StSeUndead2, ect. The entry on the "Kill" command on the Elder Scrolls Construction Wiki was very vague, so i'm not quite sure if i used the correct script syntax (of course the script didn't yell at me when i saved, but then again it didn't exactly WORK either)

What i'm not sure of is if the kill function will even work on creatures, or how to do it exactly. There definitely SHOULD be some way to do this...

If there's any way i can do it that would kill every creature in the game, it still wouldn't be a problem, because i created a new leveled list, so the only creatures it would kill are the ones i want dead.
Leader of the Morag Tong
Hail Mephala
I do work sometimes - I swear!
Reply
03-19-2007, 02:02 AM,
#4
 
Instead of using a leveled list, try doing it to an ordinary creature first (no M marker). If that works, then I'd suggest to just make one creature entry that has a level offset to the player. Or you could try to mimic a script that does everything a leveled list does (and enable/disable as the player levels up), but that might take a while.
Reply
03-19-2007, 02:06 AM,
#5
 
Yeah, one creature with a level offset sounds like it might work, but if that doesn't work, i might just give up and force the player to kill all the creatures instead of using scripts

I can also attatch a script to a custom creature, so i KNOW that the reference can't be wrong.

[Edit] Finally it works! I think making each a creature (no levelled lists) did the trick. Quest gets to 70, they all fall down. Thanks for the idea.
Leader of the Morag Tong
Hail Mephala
I do work sometimes - I swear!
Reply
04-27-2007, 06:46 AM,
#6
 
I've got a simple script that is giving me problems. I'd rather not have to do trial-and-error to figure out exactly what the problem is, waiting for the things to load over and over... Plus the fact that I'm going to bed right now... so if someone sees a problem with it, could you please post so?

I do know that timer never reaches 0 (from rearranging the script and playtesting).

Code:
scn [SCRIPTNAME]

float timer
short DoOnce

Begin Gamemode

If ( DoOnce == 0 )
  Set timer to 1
  Set DoOnce to 1
Endif

If ( timer <= 0 )
  Set timer to 1
  Set DoOnce to 0
  Stopquest [Questname]
Else
  set timer to timer - getsecondspassed
Endif

End

It's a quest script, and I've tried the obvious stuff already (unless the problem is super-obvious, in which case I've been overlooking something).
Reply
04-27-2007, 07:51 AM,
#7
 
Why have you set DoOnce to 1 then to 0 afterwards, it should be DoONce 0 as in not done yet then 1 as in done.
[color="#9ACD32"]How do you Skyrim? Show Us in TES Alliance's [url="http://tesalliance.org/forums/index.php?/forum/112-official-skyrim-contest/"]Salute to Skyrim Contest[/url]![/color]
Reply
04-27-2007, 08:09 AM,
#8
 
Code:
If ( DoOnce == 0 )
  Set timer to 1
  Set DoOnce to 1
Endif

He has set DoOne to Done before he has stated to end the quest, Also why is he using a timer on it? just curious.

Also i will have to play test the scipt and modify as i go, but i'm sure it just needs some tweaking for it to work.
[color="#9ACD32"]How do you Skyrim? Show Us in TES Alliance's [url="http://tesalliance.org/forums/index.php?/forum/112-official-skyrim-contest/"]Salute to Skyrim Contest[/url]![/color]
Reply
04-27-2007, 08:17 AM,
#9
 
Code:
scn [SCRIPTNAME]

float timer
short DoOnce

Begin Gamemode

If ( DoOnce == 0 )
  Set timer to 1
  Set DoOnce to 1
Endif

If ( timer > 0 ) && ( DoOnce == 1)
  set timer to timer - GetSecondsPassed

else

  Stopquest [Questname]
  Set DoOnce to 2

Endif

End
I assume you want to stop the quest once.

The problem with this script.
GetSecondsPassed is frame based and you attached it to a quest (processed every 5 seconds (not every frame). So the "timer" will not reach 0.

This script would work with a container, and when the player is near (cell loaded) the script will be processed every frame.

If you want to use it with a quest, I suggest you use the following.

Code:
scn [SCRIPTNAME]

float TimeStamp
short DoOnce

Begin Gamemode

If ( DoOnce == 0 )
  Set DoOnce to 1
  Set timeStamp to getCurrentTime
Endif

If  ( getCurrentTime - timeStamp > 1 ) && ( DoOnce == 1 )
  Stopquest [Questname]
  Set DoOnce to 2
Endif

End
The time that passes can be changed, easily.
Dum loquor, hora fugitĀ  - While I speak the time flies



Ovid 43 BC - 17 AD
Reply
04-27-2007, 08:42 AM,
#10
 
If it is attached to a quest then it would not need to be set at every frame, I still wonder why you would need a timer for a quest, if you want it to player once do something like this:

Example

Code:
scriptname [What Ever it Is]

short DoOnce

Begin Gamemode ; This is used for quests mainly

If DoOnce == 0

StopQuest [Quest Name]

endif

set DoOnce to 1

end
[color="#9ACD32"]How do you Skyrim? Show Us in TES Alliance's [url="http://tesalliance.org/forums/index.php?/forum/112-official-skyrim-contest/"]Salute to Skyrim Contest[/url]![/color]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)