OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: Monkels on 07 Jun 2007, 15:59:33
-
Afternoon fella's, 2 parta for you
Was up till 5am last night searching ofpec and bi forums with no luck :-[
1st part
So bassicly I've got the artillery script to only execute when the player has battery's for the Custom Radio
I tried using the "hasweapon" command but the radio i have is classed as a Binocular in the config.cpp and the trigger wont execute at all
Cond:
(vehicle player) in thisList && (""RadioBattery"" In (Magazines player))Act:
[] exec "artillery1.sqs"
Now once the player has requested artillery, ive got it to decrease the battery magazine, Only problem is that it removes a battery from all players carrying a battery. Preferably id like it to only remove a battery from the player that issued the artillery request. Is this possible?
cmd im using is
player removeMagazine "RadioBattery"
I know its going to remove them from all players just didnt know if i could remove it from specific players
2nd Part
Ties into the 1st part as in when the player has run out of batteries then the "artillery_disable.sqs" will run "just null's all the radio commands"
Only problem is i need some sort of check to see if the player has less than 1 battery, this trigger can excute on all players
eg
(vehicle player) in thisList && (""RadioBattery"" count (Magazines player) <1)
im unsure bout this as its my first real attempt at scripting, still aint found any decent tutroials on Evenhandlers and how to pass the innit line to the script
Cheers for any help
-
there's a very good tutorial on eventhandlers right here (http://www.ofpec.com/ed_depot/admin_details.php?res=39).
-
Um... what does a radio battery have to do with artillery? ???
I am a little confused. You have a custom radio addon that takes a battery object as its ammo? Does the custom radio actually "fire"? More specifics please on the radio.
-
its a custom clan addon
For the Radio operator to be able to access the Artillery they need batterys to use the radio
Edit*
Its not a custom radio as such, it still uses the regular 0-0-1 radio that everyone see's, but for the player to be able to use it they must be carrying a Battery
the battery is a custom addon, but it could as well be a "m16" mag or a "laserbattery"
-
The problem is your trigger condition, which can fire on multiple clients if more than one player with batteries is inside the trigger. What you should do instead is add a trigger that enables the radio for each player separately(assuming Radio Alpha used):
Trigger: None,Repeatedly with Condition:
not ("RadioBattery"" In (Magazines player))
OnActivation:
1 setRadioMsg "NULL"
OnDeactivation:
1 setRadioMsg "Fire Artillery"
Now a player will only see the radio if they have battery. You do not need any extra conditions in your radio trigger other than the default this. When a player calls the artillery the script will only run on that player's machine so the battery will be removed properly.
Edit: Actually, your original code would also have removed the battery for just one player because radio triggers are only activated on the machine of the player who used it. The trigger I have provided is still, I think, a better way to do it.
-
Why are you using thisList? I thought the artillery was supposed to be activated via radio? Do players need to be in a certain area?
-
Aye inside a certain area, tis all fixed now
Instead of nulling the radiomsg's ive just got it to turn off when the player runs out of batteries, looks much better and runs better to
Cheers for the help peanut