![]() |
onWeaponFired() in a custome movement
Hey there,
I found this movement in the Code Gallery and I was messing around with it. While that I realized, that you can´t use onWeaponFired(). Is it generally when using disabledefaultmovement() or is there something in this script (couldn´t find anything)? And what can I do to fix this so I can fire weapons? |
When you disable default movement you also disable the ability to use the weaponfired call. To fix this you could make your own trigger script:
PHP Code:
|
After using your method it didn´t work:
PHP Code:
But the script got me into some ideas so I came up to this: PHP Code:
|
I believe its an adequate way of using it. However you would be better off getting clarification from Chris or someone else who knows what there talking about :)
|
If you use GraalControl.onKeyDown() and GraalControl.onKeyUp(), you don't have to rely on that while loop.
|
In addition to what Crow said, you'd also ideally want to replace
PHP Code:
PHP Code:
|
PHP Code:
|
One thing I rarely see brought with this type of thing, which may not be entirely necessary but can be convenient down the line, is that it would be much better to create a single system for detecting your various key presses so that you can both more easily prevent them from interfering with eachother and process them in an intended order.
If you have different instances of "function onKeyPressed" within a lot of weapons it becomes harder to keep track of everything going on. |
ok thx guys ;)
just to make sure I understood correctly: PHP Code:
|
Use keydown(4) instead so it uses Graal's key-mappings.
onWeaponFired doesn't need to be public either. |
You should probably be using the keydown value instead of keydown2 to not force players with different control schemes to have to use the D key.
Also, that would only change player's chat to test if that were the selected weapon, player.weapon.trigger will execute on whatever weapon you have selected. You only need the GraalControl.onKeyDown in one place. |
| All times are GMT +2. The time now is 02:55 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.