The onProjectileHit(self,what,entity) hook is what you're after.
So everytime a fireball is spawned in, add a connector:
Code: Select all
spawn("fire_ball", ...........).projectile:addConnector("onProjectileHit","myScript","myFunction")
I imagine the "what" value that the hook passes to the function is important, I'm not exactly sure what it gives if it hits a player or whatever. So just have it print out the "what" value and experiment a bit. Also, I don't think there's much of a way to add connectors to objects that are spawned in using an actual spawner object, so you might have to handle pretty much everything via script.
So it would be something like.
Code: Select all
hit_player == false
function spawnFireball() -- trigger this via timer
if hit_player == false then
spawn ("fire_ball", ...........................).projectile:addConnector("onProjectileHit","myScript","fireballHit")
else
spawn ("blob", ...........................)
end
end
function fireballHit(self, what, entity)
print (what) --just to see what it outputs if it hits the player
if what == "whatever this ends up being if it hits a player" then
hit_player = true
end
end