I've been messing around with creating aggressive animals in Neolithic Mod. My current project is to get an invisible, invincible rider, who dies when his mount dies. However, this is my first time writing any real code in the Module System, and I'm getting some funny results. For some reason, the mounted troops will just stand where they spawn, but it might be because he doesn't have a weapon. If you kill his mount, he simply gets up, and attempts to punch you to death.
I meant for the code to check all the agents, see if its a human, get the horse he's on, see if its alive, and if its not, set the rider's hp to 0.
Just occurred to me that this might not be working since the mount is dead, so he's technically not mounted.
This bit of code is called just before common_battle_check_inventory in the "lead charge" mission type.
I don't really understand the trigger structure very well, so could someone give me a few pointers?
Code:
animal_death = (
1, 0, 0, [],
[
(try_for_agents,":rider"),
(agent_is_human,":rider"),
(agent_get_horse,":horse",":rider"),
(try_begin),
(agent_is_alive,":horse"),
(else_try),
(agent_set_hit_points,":rider",0,0),
(try_end),
(try_end),])
I meant for the code to check all the agents, see if its a human, get the horse he's on, see if its alive, and if its not, set the rider's hp to 0.
Just occurred to me that this might not be working since the mount is dead, so he's technically not mounted.
This bit of code is called just before common_battle_check_inventory in the "lead charge" mission type.
I don't really understand the trigger structure very well, so could someone give me a few pointers?