Jump to content

How to Count amount of creatures


Domi

Recommended Posts

What I am trying to do is to count how many ankhegs I kill on a certain map after the Ranger Gerde asks to kill no more than ten. So what I did was:

 

SetGlobal("AnkhegCount","FW4500",1) at the entry to the map (sets and is fine)

 

Then I appended the following block of script to all ankhegs in the area (they are special case of CRE and already have the following block:

 

IF

Die()

THEN

RESPONCE #100

SetGlobal("HelpGerde","GLOBAL",1)

END

 

 

IF

Global("AnkhegCount","FW4500",1)

GlobalGT("HelpGerde","GLOBAL",0)

Die()

THEN

RESPONCE #100

IncrementGlobal("AnkhegCount","FW4500",1)

END

 

Er... does not work. Any thoughts?

Link to comment

Also, I don't know if it's just how it was typed her, or if it's how it is in the actual script file, but will the engine accept "RESPONCE" instead of "RESPONSE"? Although, come to think of it, if it didn't, I guess the script wouldn't compile at all...

Link to comment
Also, wheer can I find info on SPRITE_IS_DEAD? I did a quick search of IESDP, but did not find it  :)

SPRITE_IS_DEAD# is a variable that is created for each DV. e.g. if Nalia has died then a check of Globals will show SPRITE_IS_DEADNALIA = 1. If you have multiple CREs with the same DV it will count them. So the obvious thing would be do would be Set the global of SPRITE_IS_DEADAREAANKHEGS to 0 when you start the quest (resetting the counter so it ignores any ankhegs killed before the quest begins).

Link to comment

FW4500 is Firewine Bridge area, while FW1400 is the one where Gerde is, but I suppose you would like to measure the number on FW4500 then.

 

Although your script extension block isn't correct:

 

IF
Global("AnkhegCount","FW4500",1)
GlobalGT("HelpGerde","GLOBAL",0)
Die()
THEN 
RESPONSE #100
IncrementGlobal("AnkhegCount","FW4500",1)
END

 

...because it will never trigger once AnkhegCount exceeds 1.

I don't see why you use AnkhegCount as a variable in SetGlobal("AnkhegCount","FW4500",1)

 

A possible solution with AnkhegInit, if I am interpreting your concept correctly:

SetGlobal("AnkhegInit","FW4500",1)

 

IF
Global("AnkhegInit","FW4500",1)
GlobalGT("HelpGerde","GLOBAL",0)
Die()
THEN 
RESPONSE #100
IncrementGlobal("AnkhegCount","FW4500",1)
END

Link to comment

I see what you are saying (and yep, the area was correct in the script, it's just me typing things by memory outsiude my modding den) it did not even increment to 2, just stayed on 1 (it should have) - so the script did not work at all.

 

Fortunately, Grim gave me a simpler solution than using Die(), I am going to test it tonight and see if it works :)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...