Jump to content
Sign in to follow this  
polkaboy

Bon's AI Recruit Script Respawn Help

Recommended Posts

I have using Bon's excellent ai recruit script for a long time and I decided it would be great if the player could activate the script instead of assigning the script to an object. For those that don't know, this is a script that brings up a menu for the player to click on to recruit new units. I have changed the script so that the player can call up the Recruit menu and call in soldiers at his location that come in parachutes. The problem I have is that I cannot get the script to work when the player dies and respawns. I have spent hours researching the forums and I cannot come up with a working solution. Here are my init lines:

init.sqf:

[] execVM "bon_recruit_units\init.sqf";

player's init line:

this addAction ["Recruit Units", "bon_recruit_units\open_dialog.sqf"]; this addEventHandler ["killed", {this execVM "bon_recruit_units\open_dialog.sqf"}];

I have modified the "this" in addeventhandler to read: this, _this, (this, 0), (_this, 0), and nothing seems to work. When my player respawns, there is no Recruit Units menu. If I move my mouse cursor over the original player's dead body, I do see the Recruit Units menu. Any suggestions?

Robert W

Share this post


Link to post
Share on other sites
I have using Bon's excellent ai recruit script for a long time and I decided it would be great if the player could activate the script instead of assigning the script to an object. For those that don't know, this is a script that brings up a menu for the player to click on to recruit new units. I have changed the script so that the player can call up the Recruit menu and call in soldiers at his location that come in parachutes. The problem I have is that I cannot get the script to work when the player dies and respawns. I have spent hours researching the forums and I cannot come up with a working solution. Here are my init lines:

init.sqf:

[] execVM "bon_recruit_units\init.sqf";

player's init line:

this addAction ["Recruit Units", "bon_recruit_units\open_dialog.sqf"]; this addEventHandler ["killed", {this execVM "bon_recruit_units\open_dialog.sqf"}];

I have modified the "this" in addeventhandler to read: this, _this, (this, 0), (_this, 0), and nothing seems to work. When my player respawns, there is no Recruit Units menu. If I move my mouse cursor over the original player's dead body, I do see the Recruit Units menu. Any suggestions?

Robert W

look at this page : https://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#Respawn

try this:

this addAction ["Recruit Units", "bon_recruit_units\open_dialog.sqf"]; this addEventHandler ["Respawn", {(_this select 0) addaction ["Recruit Units","bon_recruit_units\open_dialog.sqf"]};];

first param passed to Respawn event handler is you new body, and second is the corpse.

first param can be access with _this select 0

second param with _this select 1

Edited by holo89
corrected the code

Share this post


Link to post
Share on other sites
anyone know how to get ai not to die when player gets killed?

Hey Mr. Death,

I think you have to edit the FSM module within the "bon recruits" folder. Its fairly easy with the FSM editor.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×