Fox, on 03 October 2015 - 12:22 AM, said:
I did enquire about how to achieve what I'm trying to do in previous threads when I was at the planning stage, this so far has been the only way I've been able to move forward.
I have sprites grouped into functional groups as sprites within a group interact with each other, with one sprite within that group acting as a master. When I wrote that piece of code you need to bear in mind that I couldn't get an answer on whether EVENT_GAME would still get called for sleeping sprites so this was the only way I could see to absolutely gaurentee my sprites would get processed. A gaurentee that EVENT_GAME is _always_ called for every sprite will certainly make my life easier.
Fox, on 03 October 2015 - 12:22 AM, said:
appendevent EVENT_KILLIT ifactor RESPAWN { setvar RETURN -1 setactor[THISACTOR].extra 0 } endevent
If a RESPAWN has never respawned during a game then that should be counted as one enemy the player failed to kill. After the first respawn, it does _not_ count as a missed enemy unless it has actually spawned another enemy. I doubt that logic is built into the game.
Hello, what is the actor's 'extra' doing that requires it to be set to 0 ?
Fox, on 03 October 2015 - 12:22 AM, said:
Just to clarify, are you saying that:
getactor[THISACTOR].sectnum temp getsector[temp].somethingorother ....
can actually be done with
getsector[THISACTOR].somethingorother ...
That'd be useful.
Fox, on 03 October 2015 - 12:22 AM, said:
Indeed, I'm hoping that using extspritestat and specifying STAT_PLAYER will iterate through each player, though I'm not sure if the sprite values returned by that function will be valid in accessing the player-specifc sprite vars. Gonna just have to suck it and see.
Fox, on 03 October 2015 - 12:22 AM, said:
This was the vital answer that I hadn't been able to find stated explicitly. When I sketched out the game loop I posted I did not have that as a gaurentee, hence implementing things the way I did.
Fox, on 03 October 2015 - 12:22 AM, said:
onevent EVENT_GAME ifactor MYACTOR setactor[THISACTOR].httimetosleep 0 endevent
Ah, I'd been using this wiki page which didn't mention httimetosleep. After a search, it is listed in this page which shows even more interesting looking stuff. What's going on ? Is the first page a general sprite structure, and the second page adds gamevars that are also applicable to sprites defined as (user)actors? i.e. setactor[THISACTOR].httimetosleep will work for a (user)actor but blow up if I tried to use it on a regular every day decorative sprite ?
TTFN,
Jon
PS: I want 'ifsoundvar' but it doesn't exist. Is there an alternative ? Currently I've a 450 line monster func to attempt this functionality - yeuk! - IIRC, the first time I've used a spreadsheet to generate code !