PRiME 1 Posted March 14, 2003 So a long time has past and I was wondering if anyone figure out how to addaction to a newlycreated vehicle which WORKS on dedicated server mode? I know allot will no doubt reply saying add it into the init or something silly like that.. Please only reply if you have a good responce, I have tried all too many methods to solve this issue it just seems to be not possible to add a action to a newvehicle in real time. O' how I have tried.. Thanks for any input non the less.. PS.. scripts like the Nitro and Turbo things btw.. Share this post Link to post Share on other sites
Pennywise 0 Posted March 14, 2003 Try calling it from an event handler. Add this to the init field. Keep in mind you wont be calling add action from the init. Instead, when a player gets in the vehicle your action will be added to the menu. Here is an example: yourVehicle addEventHandler ["getin",{yourVehicle addAction ["Hello", "hello.sqs"]}] Change '_yourVehicle' to the name of your vehicle or 'this'. It should do the job fine. Goodluck! Share this post Link to post Share on other sites
PRiME 1 Posted March 15, 2003 and will still work in the vehicle respawn script? like each time a vehicle is recreated will this show for any player? Does not appear to work for some reasons Share this post Link to post Share on other sites
PRiME 1 Posted March 15, 2003 This is what I been using in my script _vcl addEventHandler ["GETIN",{_vcl addAction ["Enhance fuel mixture", "CBR_turbo.sqs"]}] it appears to work but has no effect. The addaction part is just not happening. I tried making the vehicle a publicvariable with no go. Is there a way I can add this action to the init of the vehicle apon creation? or can that only be done with createunit? Share this post Link to post Share on other sites
Pennywise 0 Posted March 21, 2003 hmm, is the respawn script running on the server only? You will probably have to make it run on the client as well to get it to show in the action menu. Share this post Link to post Share on other sites
Guest jacobaby Posted March 21, 2003 Things get tricky when you have to start meesing about with local and server scripts. A point to bear in mind is that when a player gets in a vehicle, it becomes local. Anyway, in your respawn script have you tried; </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _car = "jeep" createvehicle getpos BLAH _car exec "script.sqs"<span id='postcolor'> To have it work on client PC's only and not the deddy you could try; </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ?! local player:exit<span id='postcolor'> At the start of the script. Dont proclaim each car as a publicvariable, no need. Without seeing your whole mission set up its kind of hard to see whats up. TJ Share this post Link to post Share on other sites
nierop 0 Posted April 1, 2003 But... the car is created on the server side and therefore is preceeded (in my respawnscript) by ?!(local server): exit After this command I cannot pass theaddeventhandler (of the vehicel ) to the client side anymore, or can I. Ok Ok Im a noob but I hope you are willing to explain. Thnx, Pimmelorus Share this post Link to post Share on other sites
dinger 1 Posted April 1, 2003 to work across mp, you need to have a script on each client monitoring for new vehicles and adding actions. Something like this: (server side) NewVehicle = "BMP" Createvehicle [x,y,z] publicvariable "NewVehicle" (all clients -- exec this off the init.sqs script): _OldVehicle = "Logic" Camcreate [0,0,0] #Top NewVehicle = _OldVehicle #Loop ~1 ?NewVehicle != _OldVehicle:NewVehicle addaction ["Enjoy Beverage", "pivoBudvar.sqs"]; goto "Top" goto "Loop" That otta do it Share this post Link to post Share on other sites
nierop 0 Posted April 3, 2003 Ok, thnx for the reply. I am wondering about this for some days now but it is difficult. I do not get what you mean by the line _OldVehicle = "Logic" Camcreate [0,0,0] ? What does this do and why is it needed? The rest of the reasoning I can follow. Thnx, Pimmelorus Share this post Link to post Share on other sites
bn880 5 Posted April 3, 2003 The NewVehicle object parameter is used like a boolean flag and it's parameters are true: "BMP" false: "LOGIC" therefore when you detect that NewVehicle is no longer "LOGIC" (false) and perform your actions. The detection happens here: ?NewVehicle != _OldVehicle: You could maybe get by with using objNull, but it will be more work, trust me. Share this post Link to post Share on other sites
nierop 0 Posted April 4, 2003 Ok, i got this thing going; i succeeded in making scripts activated on client side in MP games on freshly respawned vehicles (in my case rotodust script). Thanks to Dinger for setting me in the right direction. I did not use the "logic" thing and feel that I used less effective routines (that work nevertheless ). So currently I am thinking of refining this stuff and then releasing it to OFPEC as a tutorial as I have seen many people with this problem and only getting half answers. For newby scripters like me that is not sufficient and that tutorial would help. If anyone of you (bn880? *hint* *hint* ) would help out with streamlining let me know and i send a example mission to you that has this feature. It is very little code to work your way through. Thnx for so far with the great help. Pimmelorus P.S. I am reluctant to put the sample mission up here as I want to get one final and well thought over tutorial before people will start to use my (possibly) inefficient scripts. Share this post Link to post Share on other sites
KaRRiLLioN 0 Posted April 4, 2003 What I do is rather simple. Â For example I have a script that adds an Ammo Cam action to certain vehicles. Â In that AmmoCam script, I have a portion of it exec on all clients in the init.sqs, and all that it does is this: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">#AmmoCamVclInit AmmoCamVcl = ObjNull @!IsNull AmmoCamVcl AmmoCamVcl AddAction ["Ammo Cam","AmmoCam.sqs"] Goto "AmmoCamVclInit"<span id='postcolor'> The vehicle respawn script for its part has this info in it: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE"> ?!(local Server): Goto "end" _vcl = _this select 0 _respawndelay = 10 _dir=Getdir _vcl _position=Getpos _vcl _Vehicles=[] _type = typeOf _vcl Goto "CustomArming" #start _wait = 150 ~2 @!(CanMove _vcl) OR (Count Crew _vcl) > 0 ?!(CanMove _vcl) AND (Count Crew _vcl) > 0 : Goto "Wait" ?(CanMove _vcl) AND (Count Crew _vcl) > 0 : Goto "Wait" Goto "Dead" #Wait @(Count Crew _vcl) <= 0 OR !(Alive _vcl) ?!(CanMove _vcl) : Goto "Dead" ?(Count Crew _vcl) <= 0 : Goto "DriverWait" Goto "start" #Dead ~_respawndelay ?(CanMove _vcl) AND (Count Crew _vcl) > 0 : Goto "start" ?!(CanMove _vcl) AND (Count Crew _vcl) > 0 : Goto "start" #Respawn deleteVehicle _vcl _vcl = _type createVehicle _position _vcl setdir _dir Goto "Skip" #DriverWait ~1 ?(Count Crew _vcl) <= 0 AND (_wait == 0) : Goto "Respawn" ?(Count Crew _vcl) > 0 : Goto "start" ?!(CanMove _vcl) : Goto "Respawn" _wait = _wait - 1 Goto "DriverWait" #Skip #CustomArming _num = Random 10 ~_num _ammoCamArray = ["M109","2s19_msta","2s19_mstac","f15eMk82"," Rad_Hornet_Mk83G" ,"Rad_Hornet_CBU87G"] ?(_type in _ammoCamArray) : AmmoCamVcl = _vcl; PublicVariable "AmmoCamVcl" <span id='postcolor'> The random Number is so that when the mission starts, not every vehicle is declared as the ammocamvcl together so the scripts can properly assign the actions. Â With lag this method can suffer simply because some clients may not receive the public var declaration. Â I use this method in a lot of scripts and it works great for the most part. Â In RTS-3 it is used a great deal because of all of the MP stuff to keep straight. Share this post Link to post Share on other sites
Doolittle 0 Posted April 6, 2003 Yes, it's all the same idea....(right??) Doolittle Share this post Link to post Share on other sites