Is there a way to respawn Unidus's orbs?

Status
Not open for further replies.

clairebun

Community Noise Maker
Sonic Team Junior
Basically I want Unidus to throw all of its orbs at the player and then regenerate them back so it can do it again. What's the cleanest way to do this through lua, if there is one?
 
I believe a clean way to do it would be to remove the Unidus and spawn a new one at the exact same coordinates, since I don't think there is any option to make its spikeballs reappear.
 
There's a bit of the spawning code that handles things in hardcode, so if you're willing to wait a few hours whilst I wake up I could help give you a Lua-ported starting point to work off of.
 
This is where the Unidus's orbs are actually spawned in the C code: https://github.com/STJr/SRB2/blob/SRB2_release_2.1.17/src/p_mobj.c#L7740

Using the "MobjSpawn" hook you can recreate everything in Lua.

Some notes though:
* The P_SetTarget function is automatically used when you assign a value to mobj.target, so you don't need it.
* Unlike C, ball.state in Lua gives you the state NUMBER not the state_t structure, so use states[ball.state].action(ball) to call the action for the Unidus's spikeballs. The action call IS needed to make sure the spikeball's position is corrected so I'm aware.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top