GetRefTypeAliveCount vs leveled actors...?

Post » Sun May 05, 2013 8:34 am

i'm trying to use http://www.creationkit.com/GetRefTypeAliveCount_-_Location to determine when all the critters, which are mostly leveled actors, are cleared out of some place.

problem is, i get back completely erratic values from this (tested by notifying count on every kill)

like, there's about 3 or 4 critters left, i kill one, it reports "73", next kill reports "67" etc (and it's custom critters and none other of them anywhere else that could mess this up in any way)

why is this so? does it have anything to do with the fact the critters are mostly leveled actor spawns? (GetRefTypeAliveCount runs OnDeath on ObjectReference)

User avatar
lauren cleaves
 
Posts: 3307
Joined: Tue Aug 15, 2006 8:35 am

Post » Sun May 05, 2013 2:14 pm

still got the same problem: a location full with leveled creatures, and i need to determine when they all have been killed.

i tried GetRefTypeAliveCount - still couldn't get it to report anything that makes sense (see previous post)

i tried HasRefType - never ever reports false.

w-h-y---?

my best hypothesis so far would be: because the spawn points are still there after kill...? (both above functions check for "alive and enabled" from what i get)

or would i need to have the script extend Actor instead of ObjectReference (at least worth a shot i guess) ----> edit: no difference

...

or are there any better ways for my all-dead check anyhow?

best i could think of so far (except the above) would be having my critters add themselves to a form list or some counter OnInit so i could counter-check that OnDeath, but this just seems hell inefficient (and not even sure it'd work, fires when spawn point (not spawned actor) is initialized after all)

User avatar
Sandeep Khatkar
 
Posts: 3364
Joined: Wed Jul 18, 2007 11:02 am

Post » Sun May 05, 2013 4:42 am

*bump*

sorry for my monologue thread :-),

but i'm still not sure how to detect if all my leveled creatures are killed,

still can't get the above to report anything useful,

and my alternative concepts so far are all awfully complicated and not too convincing... :-P

User avatar
Evaa
 
Posts: 3502
Joined: Mon Dec 18, 2006 9:11 am

Post » Sun May 05, 2013 7:37 am

Maybe something like this?

Substitute the "10" for total amount of critters. Then add the script to all of them.

Scriptname CritterKillScript extends ActorGlobalVariable Property critterCount  AutoEvent OnDeath(Actor akKiller)   critterCount.Mod(1)   If critterCount.GetValue() == 10      ; Do stuff (eg myQuest.SetStage(xx) )   EndIfEndEvent
This way basically is using a Global as a counter

- Hypno
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Sun May 05, 2013 6:34 pm

Can't quiet remember but I'm pretty sure there was an existing global or function which I used in the past that could get the number killed.

User avatar
stevie critchley
 
Posts: 3404
Joined: Sat Oct 28, 2006 4:36 pm

Post » Sun May 05, 2013 10:21 am

thx for answer :-)

my problem is though, the critter count is the one thing i want to GET.

if i KNEW it in the first place, i wouldn't have this issue at all :-)

thing is, the number of critter spawns depends on player level (at least that's what it's supposed to do if i got it all right, haven't done too much with leveled actors yet),

so i'd need to count them UP to that global first - but fire this on what?

i mean, one "M" ought to spawn more than one critter on higher levels (if i got that all right as said :-), but might at least be some explanation for the weird numbers GetRefTypeAliveCount reports),

so OnLoad or OnInit are out, as they'd fire for the M, not for the critters, or is that wrong?

(after everything i read about no putting scripts on leveled actors and all meanwhile, i wonder how i ever even got my OnDeath-stuff on them :-)

User avatar
Lindsay Dunn
 
Posts: 3247
Joined: Sun Sep 10, 2006 9:34 am

Post » Sun May 05, 2013 3:38 am

oooh, you mean that total-number-of-slaughtered-bunnies-stuff? never even thought of that.

hm...

still can't quite think of how that would get me the number of critters _spawned_

is there anything like a total-bunnies-BORN-global? THAT's what i'd need here :-))

edit: that's why i had high hopes in GetRefTypeAliveCount, as it's supposed to report n# alive in given location (if it would), so i'd neither need to know how many are spawned nor how many i killed. just if zero are alive.

User avatar
Lisa
 
Posts: 3473
Joined: Thu Jul 13, 2006 3:57 am

Post » Sun May 05, 2013 9:32 am

The function was this http://www.creationkit.com/GetDeadCount_-_ActorBase

Nothing like what you want but. :confused:

User avatar
Ludivine Poussineau
 
Posts: 3353
Joined: Fri Mar 30, 2007 2:49 pm

Post » Sun May 05, 2013 7:25 am

would be cool if it'd report % of all refs to this base dead. that way i'd just need to go for 100% for my custom critters :-)

edit: why isn't there any "species extinct" acchievement, THIS would come in handy :-)

User avatar
Far'ed K.G.h.m
 
Posts: 3464
Joined: Sat Jul 14, 2007 11:03 pm

Post » Sun May 05, 2013 6:31 am

hm, "isCleared" goes for "boss"-type, is that right?

how bad would it be to just make ALL of them "boss"? (or, could i anyhow for leveled spawns)

elegance certainly is different, but it shouldn't make the game implode, or would it...?

edit: or another one:

can i somehow get the total number of actors (or even better alive actors) in a faction?

this was actually my first approach, just check faction for 0 on death (or check number on start and then count down, depending on what could be done), but found as much for getting faction member count as for getting alive actors in cell or loc...

User avatar
I love YOu
 
Posts: 3505
Joined: Wed Aug 09, 2006 12:05 pm

Post » Sun May 05, 2013 12:10 pm

Scriptname CritterKillScript extends ActorGlobalVariable Property aliveCount  AutoGlobalVariable Property deadCount  AutoEvent OnInit()   aliveCount.Mod(1)EndEventEvent OnDeath(Actor akKiller)   deadCount.Mod(1)   Int dead = deadCount.GetValueInt()   Int alive = aliveCount.GetValueInt()   If (alive - dead) == 0      ; Do stuff (eg myQuest.SetStage(xx) )   EndIfEndEvent
How about that? Add it to the base object

- Hypno
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Sun May 05, 2013 7:14 am

thx lots, out 4 trying, gonna be reporting back :-)

User avatar
Emily Jones
 
Posts: 3425
Joined: Mon Jul 17, 2006 3:33 pm

Post » Sun May 05, 2013 9:37 am

well - nooooo... :-|

just does the same as HasRefType (or several other OnInit-counting approaches i'd tried) - never ever reports zero

(yet need to retest it with having notify the actual numbers instead of just zero or non-zero like now though to be absolutely sure no creature slipped under some rock or stuff - but pretty sure not, cuz the peace-and-cake-music takes over (the game's way of telling me "ha ha, i KNOW you killed them all, but i won't ever tell your script..." :-)

i really think there's a problem with OnInit about this. likely cuz the spawn tier is ALWAYS there, so ALWAYS onInits, but it does not always spawn a creature i'd want counted (if level too low).

so i'd just always get the number of tiers

(edit: still wouldn't explain the odd GetRefTypeAliveCount-results though),

not actual creatures. (or there's something i got awfully wrong about lev.actors, but couldn't think of anything currently)

ah yes might be a good idea to actually _count_ the tiers in my cell and have your script report me the numbers to compare

User avatar
maddison
 
Posts: 3498
Joined: Sat Mar 10, 2007 9:22 pm

Post » Sun May 05, 2013 10:47 am

this is getting more and more odd...

so, i now have hypno's glob counter, GetRefTypeAliveCount & -DeadCount and HasRefType all in one script and have them report anything they do, numbers included.

result of this is:

OnInit doesn't seem to do _anything_. (i'd have expected it to at least count up the spawn markers or something). also not from a save that's most certainly clean.

OnDeath does do stuff though:

.) HasRefType never ceases to report true

.) GetRefTypeAliveCount starts counting down from 79iirc, incrementing 2* (but always staying on odd numbers ("odd" here meaning like 1,3,5,7..., oppositve of "even" i think? not sure if these words are right in this context)

.) the glob counter counts up incrementing 2* for every kill.

* there's 30 leveled spawns in there (each of which should produce 0-2 critters depending on level, if i got that part right), plus one unique boss-creature (which itself is based on a template that's also used by leveled critters though)

so what do i learn from this? that all my critters appear to be split personalities for one thing.

so, i could live with "it counts 2 for every critter", but

.) the glob counter is rendered useless as it never gets correct numbers OnInit,

.) HasRefType keeps saying true true true for eternity

.) and GetRefTypeAliveCount counts down from somewhere that's in no relation i can see to anything

(or how does 30 spawns and 1 unique get 79? and on last try, i had 11 critters actually spawned, still counted from 79 -

AND i could go with "2 for spawn, 1 for unique, hence odd total", but unique one ALSO increments 2, both for glob counter as well as GetRefTypetc...

i think i'm just gonna go sit in the corner and cry now... :-P

User avatar
Kim Bradley
 
Posts: 3427
Joined: Sat Aug 18, 2007 6:00 am

Post » Sun May 05, 2013 4:06 pm

I had trepidations when typing in the OnInit() and it seems those gut feelings turned out correct. Maybe OnCellAttach() might work instead?

Also, regarding the death count counting two for every death. Maybe you could get away with adding 1 then dividing by 2? :shrug:

Scriptname CritterKillScript extends ActorGlobalVariable Property aliveCount  AutoGlobalVariable Property deadCount  AutoEvent OnCellAttach()   aliveCount.Mod(1)EndEventEvent OnDeath(Actor akKiller)   deadCount.Mod(1)   Int dead = (deadCount.GetValueInt() + 1) / 2   Int alive = aliveCount.GetValueInt()   If (alive - dead) == 0      ; Do stuff (eg myQuest.SetStage(xx) )   EndIfEndEvent
- Hypno
User avatar
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Sun May 05, 2013 3:27 am

thx a lot, just tested this.

another thing that doesn't work though :-)

first, counting up the global still doesn't work on cell attach - this

Event OnCellAttach ()    AliveCount.Mod (1)    Debug.Notification ("GLOB AliveCount" + AliveCount)endEvent

...notifies "GLOB AliveCount [globalvariable]" (yes, it actually says "globalvariable" in the notification, property's definitely set, filled and all)

and it only notifies once (like i see it, it should actually notify me once for every single critter?) -

probably because of the script now extending Actor (my earlier versions extending ObjectReference didn't do either anyhow)

at least it DOES notify OnCellAttach, which is more than i could say of OnInit :-)

(yet i'd also have to reset the whole thing OnCellDetach - if it worked like that in the first place)

also tried different variations of who and if inherits script from who or has it's own.

all in all, one of the above got me GetRefTypeAliveCount now starting from 85

both GetRefTypeDeadCount as well as global counter count up from zero incrementing 2 (this at least seems more or less reliable)

and i don't see how i should put this in any relation to the initially reported numbers (85 etc by GetRefTypeAlive..., none at all by counter),

i mean i could script them in, but they don't exactly look reliable and/or reproducable :-)

...going back to crying corner... :-)

User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm


Return to V - Skyrim