weaponcommand - how gety accuraty weapon?
Moderator: Moderators
weaponcommand - how gety accuraty weapon?
I want get actual ai/player weapon accuracy, and set id to 50% of default value. Its possible? Then "after some time" set it to 25%, and back to 100. Is it possible? I never used weap'com' before, so im a bit inexperienced.......
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
I'm afraid weaponcommand can only set values and not return any 
If a player hasn't edited his weapon tik files then the accuracy of all weapons remains the same. For AI weapons (they're the same as player weapons), their accuracy stays the same no matter what skill is set. However the AI's accuracy can be different according to the skill or script-set accuracy setting.
If a player hasn't edited his weapon tik files then the accuracy of all weapons remains the same. For AI weapons (they're the same as player weapons), their accuracy stays the same no matter what skill is set. However the AI's accuracy can be different according to the skill or script-set accuracy setting.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
No, I meant if no one has messed with the accuracy, the accuracy of example: the springfield will be the same in every server and in LAN.
Getting the name through the statefiles is easy but through scripting is a bit harder but I think you'll understand. We must firstly need to cast commands to the weapon therefor we need the targetname:
So $wX is the name of our weapon. X is a variable depending on the entnum of your player. We don't need to know X since the entnum doesn't change in the same server.
Now to check if he is holding a weapon and if so then give that weapon's model a variable of the player:
Check for the .weapon variable on the player. That will hold the model of the weapon the player is using. It's the full model name in a string. Example:
And not the way of assigning models to spawn script_models:
Getting the name through the statefiles is easy but through scripting is a bit harder but I think you'll understand. We must firstly need to cast commands to the weapon therefor we need the targetname:
Code: Select all
<player_alias> weaponcommand dual targetname ("w" + self.entnum)Now to check if he is holding a weapon and if so then give that weapon's model a variable of the player:
Code: Select all
// simplify
local.weapon = $("w" + self.entnum )
// if the player is holding a weapon:
if(local.weapon != NULL)
{
// the model of the current weapon is being assigned to an entity variable
// now you can retrieve this in other scripts
<player_alias>.weapon = local.weapon.model
// to prevent errors
local.weapon targetname ""
}
// else give him an unarmed.tik model because he isn't holding anything
else
{
<player_alias>.weapon = "models/weapons/unarmed.tik"
}Code: Select all
"models/weapons/kar98sniper.tik"Code: Select all
"weapons/kar98sniper.tik"Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.