kronzky 5 Posted May 19, 2006 I got a script where the player is carrying around a box. Obviously, for realism reasons, I don't want him to also have any weapons in his hand at the same time. Is there a way to make him 'empty handed' temporarily? I guess I could try to figure out which weapons he was carrying originally, remember them all, remove them, and then, when he's done carrying, give'em back to him. But that seems an awful lot of work... Is there perhaps an easier way? I tried removing just his primary weapon, which sort of looks ok if his secondary is a handgrenade. But if his secondary is a handgun or a grenade launcher, then I'm out of luck again... Share this post Link to post Share on other sites
pazuzu 21 Posted May 19, 2006 If you have your guy setbehaviour "careless", doesn't he put his weapon on his back? I mean, can't you just make the unit <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">setbehaviour "careless"for the time he's carrying the box? Share this post Link to post Share on other sites
kronzky 5 Posted May 19, 2006 Damn! That seemed like a really great idea! Until I realized that you can't change the players 'behaviour' while in a game. (It works in the init field, before he does anything, but not once he's taken control.) Back to square one... Share this post Link to post Share on other sites
XCess 0 Posted May 19, 2006 _weaponList = weapons player _weaponCount = count _weaponList _i = 0 removeAllWeapons player @condition #loop _x = _weaponList select _i player addWeapon "_x" _i = _i + 1 ~0.1 ?(_i < weaponCount) : goto "loop" exit ----------------------------------------- Should work.. if not, switch the " " around the _x to the -x on the previous line ("_x" = _weaponList select _i Share this post Link to post Share on other sites
pazuzu 21 Posted May 19, 2006 Quote[/b] ]Until I realized that you can't change the players 'behaviour' while in a game. You can change behaviour in game. Just put new behaviour command in a trigger or script. Share this post Link to post Share on other sites
kronzky 5 Posted May 19, 2006 Quote[/b] ]_x = _weaponList select _i player addWeapon "_x" ... ----------------------------------------- Should work.. if not, switch the " " around the _x to the -x on the previous line ("_x" = _weaponList select _i You actually need only 'player addWeapon _x'. No quotes at all... But that's just for the weapons. Re-equipping him with the ammo - that's the hard part... Quote[/b] ]You can change behaviour in game. Just put new behaviour command in a trigger or script. For normal units, yes. But not for the player. Not via script or trigger. You can only do it once, in the init field. Or did you get it to work somehow? Share this post Link to post Share on other sites
XCess 0 Posted May 20, 2006 that script shouldn't remove ammo.. but ofp being ofp...... Share this post Link to post Share on other sites
Guest Posted May 20, 2006 From my topic just below, this works for putting players weapon on back: Player Action ["weapononback"] But its up to you, the remove weapon thing may be more what you need, because once the script forces this weapononback action the player can just select weapon in hand and mess it up... Only other thing I could think of was adding new action to player, like 'carry box', then execute script that makes him sling weapon and carry box, but then you would have either know if the player has selected weapon in hand action, or if you could temporarily remove the weapon in hand action, which I doubt you can, but this is just for your info. Share this post Link to post Share on other sites
kronzky 5 Posted May 20, 2006 Quote[/b] ]Player Action ["weapononback"] Hey, thanks! This works perfectly. Guess my 'Action' list wasn't complete after all... Of course, as you said, the player could still mess things up by re-selecting his weapon via the action menu, but I think I can live with that. If there were a way to determine whether he actually has a weapon in his hand or not, I could just make him drop the box at that moment. (Since I'm starting a loop the moment he begins carrying, I could easily react to that.) But I guess that'd be the subject for a different thread to find out his active weapon... Share this post Link to post Share on other sites