Hi,
I've made an enemy-spawning sprite, but I want it to spawn the actor defined in the sprite's lotag.
I mean that if the sprite's lotag is 1680, it spawns a Lizard trooper.
How do I do this?
Page 1 of 1
How to get lotag and hitag from sprite?
#1 Posted 17 February 2012 - 09:51 AM
#2 Posted 17 February 2012 - 09:57 AM
Superthijs, on 17 February 2012 - 09:51 AM, said:
Hi,
I've made an enemy-spawning sprite, but I want it to spawn the actor defined in the sprite's lotag.
I mean that if the sprite's lotag is 1680, it spawns a Lizard trooper.
How do I do this?
I've made an enemy-spawning sprite, but I want it to spawn the actor defined in the sprite's lotag.
I mean that if the sprite's lotag is 1680, it spawns a Lizard trooper.
How do I do this?
At the risk of sounding trite, is there a reason why a RESPAWN sprite would not work just as well?
#3 Posted 17 February 2012 - 10:32 AM
Superthijs, on 17 February 2012 - 09:51 AM, said:
Hi,
I've made an enemy-spawning sprite, but I want it to spawn the actor defined in the sprite's lotag.
I mean that if the sprite's lotag is 1680, it spawns a Lizard trooper.
How do I do this?
I've made an enemy-spawning sprite, but I want it to spawn the actor defined in the sprite's lotag.
I mean that if the sprite's lotag is 1680, it spawns a Lizard trooper.
How do I do this?
To get the actor's lotag, you have to run an eventloadactor block on it, grab its lotag value and put it into a temporary var, then set the lotag to zero. Then in the actor's actual code, you can grab the lotag by using getactorvar (rather than just getactor). After that either espawnvar or eqspawnvar will spawn whatever's specified in the lotag in mapster.
The Mighty Bison, on 17 February 2012 - 09:57 AM, said:
At the risk of sounding trite, is there a reason why a RESPAWN sprite would not work just as well?
Sometimes an actor's ai may not jive with RESPAWN since whatever it spawns will automatically be awake. Also, I might be wrong, but IIRC you can't spawn anything with a nonzero palette either.
#4 Posted 17 February 2012 - 10:54 AM
The functionality could easily be added to propagate the palette of the RESPAWN sprite to whatever it spawns, but it would change gameplay. It was clearly intended to work that way at some point however as there are a few RESPAWN sprites with pal 21 that spawn LIZTROOPS. For example, the LIZTROOP that spawns in the theater in E1L1 was actually supposed to be an assault captain de-cloaking, not just a regular trooper materializing out of nowhere.
#5 Posted 17 February 2012 - 11:03 AM
Doesn't it works that way with the Battlelord? Or it has something to do with Assault Trooper code to automatically change the palette to 22?
#6 Posted 17 February 2012 - 01:03 PM
Fox, on 17 February 2012 - 11:03 AM, said:
Doesn't it works that way with the Battlelord? Or it has something to do with Assault Trooper code to automatically change the palette to 22?
It works with battlelord pal 21, but it doesn't work in general.
I can be easily fixed with the following CON code, however:
gamevar temp 0 0 onevent EVENT_EGS ifspawnedby RESPAWN { getactor[THISACTOR].owner temp setactor[THISACTOR].pal sprite[temp].pal } endevent
#7 Posted 18 February 2012 - 05:05 AM
The Mighty Bison, on 17 February 2012 - 09:57 AM, said:
At the risk of sounding trite, is there a reason why a RESPAWN sprite would not work just as well?
It needs to spawn an enemy each couple of seconds.
#8 Posted 24 February 2012 - 03:42 PM
Superthijs, on 18 February 2012 - 05:05 AM, said:
It needs to spawn an enemy each couple of seconds.
I've made a spawner actor as one of my first actors as well. It's very effective, you can add a lot of cool things with an actor like this. If you want some ideas or some code examples, just pm me.
Share this topic:
Page 1 of 1