Bullet Code? - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: SOMA (https://www.frictionalgames.com/forum/forum-55.html) +--- Forum: User created content (https://www.frictionalgames.com/forum/forum-79.html) +---- Forum: Development (https://www.frictionalgames.com/forum/forum-82.html) +---- Thread: Bullet Code? (/thread-48792.html) |
Bullet Code? - A.M Team - 06-01-2016 Would you be able to get the stun rod tool to shoot out bullets that when hitting a specific object it can create a piece of code for the object and bullet (ex: Play a death animation and the bullet getting destroyed)? Over the last week, me, Abion and Romulator have been trying to get the stun rod to shoot projectiles to the point of madness. We tried a number of systems which have been unsuccessful for the following reasons: My way: - Can shoot enemies through walls - Does produce effects (like bullet holes) - We don't know if we can add areas to a HUD object yet Abion's way: PHP Code: // On gun firing - Hard to code - Too easy to mess up code Any suggestions on different ways on solving this issue? This post is sort of a last resort at the moment. RE: Bullet Code? - Abion47 - 06-02-2016 Try this in the OnAction function of the map script: Code: void OnAction(int alAction, bool abPressed) Rather than fire an actual object (i.e. my previous suggestion), this should simplify the solution by just doing a simple ray trace to see which entity would be in the way of the gun. RE: Bullet Code? - A.M Team - 06-02-2016 How would you declare mpCamera, mfGunRange and mbHoldingGun respectively (bool, const tString, const int, const float)? RE: Bullet Code? - Abion47 - 06-02-2016 mpCamera => cCamera @mpCamera = cLux_GetPlayer().GetCamera(); mfGunRange => float mfGunRange = whatever_gun_range_float_value_you_want; mbHoldingGun => bool mbHoldingGun = false; RE: Bullet Code? - A.M Team - 06-02-2016 Good news, the unaltered script with the declarations loads without errors! But when I test it I don't see any effects in Dev Mode. You said the script scans the entity the ray trace hits, correct? Is there an option in the Debug Toolbar that lets me see the line or when it identifies an area? |