Jump to content

Ninjaisfast

Member
  • Content Count

    19
  • Joined

  • Last visited

  • Medals

Everything posted by Ninjaisfast

  1. So the example for BIS_fnc_fadeEffect on the wiki works, but gives me a Generic eror in expression. Is this something I need to worry about? I'm running it from a trigger in the activation field. I get the same nature when I remoteExec it - it works but gives an error. From the wiki: [1, "WHITE", 5, 1] call BIS_fnc_fadeEffect; Thanks in advance ❤️
  2. So I'm trying to make small scene where an AI driver gets in a boat, waits for the two other players to board the boat, then drives away. But when I test things out on a dedicated server, I get varying results without even changing the code. Hoping someone can enlighten me. Code might be a bit of a mess because I've been trying different things to see if they would help. Trigger 1: [Intro_BoatSaviour,[1,"Where the fuck are the other two?"]] remoteExec ["customChat", 0, false]; deleteVehicle thisTrigger; Trigger 2: [Intro_BoatSaviour,[1,"Quick, get in."]] remoteExec ["customChat", 0, false]; _Intro_BoatScript = execVM "Intro_BoatScript.sqf"; deleteVehicle thisTrigger; Intro_BoatScript.sqf: (hints are just for debugging) if !(isServer) exitWith {}; "waiting for enter boat" remoteExec ["Hint",0,false]; waitUntil {(vehicle Escapee1 == Intro_boat) && (vehicle Escapee2 == Intro_boat)}; "STEP 1" remoteExec ["Hint",0,false]; Intro_BoatSaviour moveInDriver Intro_boat; Intro_boat lockDriver true; Escapee1 moveInCargo [Intro_boat,1]; Escapee2 moveInCargo [Intro_boat,2]; Intro_boat lockCargo true; Intro_boat lock 2; "should be locked" remoteExec ["Hint",0,false]; I should only be getting each customChat message once, but sometimes they happen twice. Sometimes the boat locks correctly, sometimes it doesn't, but still shows the 'should be locked' hint. I'm really stumped here. I don't understand why I'm getting different results when I do the exact same thing during testing.
  3. From some other threads it looks like I need to limiting things to the server side more? I have some confusion about triggers that I think is causing this - if a trigger is activated, is the code in the activation field run on everyone's machine, including the server? If the 'Server Only' checkbox is ticked, does that mean the CONDITION is only evaluated on the server, but the on activation field is still run on everyones end? Or is it both condition and activation? Thanks in advance. Multiplayer scripting is confusing as heck to noobie.
  4. That makes a lot more sense now, thanks everyone.
  5. Me again. I'm trying to execute a script from an addAction. I simply want to cancel an active script (which is started from an action) by starting another script from an action, but that requires the script I want to cancel to have a script handle, which as far as I can tell, a script from an addAction doesn't have. All actions are on the same object. (and run from init field) How I am starting the script that runs, which I want to cancel (runs and passes argument fine): this addAction ["Yellow","script.sqf",yellow,1,false,true,"","",2]; What I've tried: this addAction ["Green",{_scriptHandle = []execVM "script.sqf"},green,1,false,true,"","",2]; And putting things in the [ ] before execVM. But I can't work out how to correctly pass the arguments. In the script.sqf, the destination (green in this case) is selected through: _destinationName = _this select 3 ; But this doesn't work properly if I try to execVM it. script_cancel.sqf will just terminate the script handle. this addAction ["CANCEL","script_cancel.sqf",nil,1,false,true,"","",2]; How do I pass the arguments correctly if I'm running the script from execVM, or can I just put something in the start of my script.sqf to give it a handle? Thanks in advance ❤️
  6. You knew exactly the problems I would run into before I ran into them. What I hard worked fine if I did things exactly as I wanted a person to, but once I started behaving more randomly, errors snuck in due to terminate not working how I wanted it to. I ended up doing things pretty similar to how you recommended. My new cancel action sets a global variable tripCancelled to true, which is checked in every loop of the other script. If its true, it cancels things gracefully. The cancel action also resets the tripCancelled variable back to false a few seconds later, to stop issues if someone were to try to cancel before running the actual script. On another note, terminate seems really weird. If a player runs the same looping script twice (lets just say a countdown from 100), then terminates the script handle, it seems to only terminate the last instance of it being run, and even scriptDone shows that the script is complete, even though the first instance is still running (visibly still counting down). Does a script handle change if its used twice, or something that I'm not grasping?
  7. Worked it out, posting solution in case anyone has similar troubles. this addAction ["Green",{ScriptHandle = [_this select 0, _this select 1, _this select 2, green] execVM "script.sqf"},nil,1,false,true,"","",2]; Cancel via terminate ScriptHandle .
  8. I'm trying to get my head around how to loop a script with dynamic steps. I want to have the script do 1 thing on the first loop, another on the next 4 loops, then another on the last 5. I've tried looking at the examples in the 'for' wiki but can't quite understand it without some laymans terms and explaining. The wiki shows: _xy = [1,2,3,4,5,6,7,8,9,10]; for [{_i=1},{_i<=(count _xy - 1)},{_i=_i+1}] do { if ( _xy select _i == 3 ) then { _xy deleteAt _i; _i = _i - 1; }; }; I'm pretty sure it would look similar to this with steps for the other loops, but I don't understand how the second line actually works.
  9. Ninjaisfast

    from from to looping help

    I think this will work for what I need, thanks. I've been having some trouble with (I think) incorrectly redifining a variable. I'm going to give it a new try using your template and update here if I have trouble. There's something with the use of 'private' that I'm getting confused with. Basically in the first step, I want my local variable to be the first item in an array, then afterward that variable to be any OTHER random item in that array. I'm confusing myself and probably anyone reading this, I'll give things a try and be back with an update.
  10. Ninjaisfast

    from from to looping help

    Also is this something that would be easier to use the while command instead?
  11. Hi, I'm trying to use an event handler to terminate a script when an AI dies. The script will be manipulating items on an AI and making them use custom chat, etc. What I have works, but not for multiple AI. The script starts from an action selected on those AI. From what I can tell, if two of the several of the same script are running, the terminate script function will terminate the most recent of those scripts to have started. Here's my code (this is changed a little from when I last tested, so there may be a small error with the syntax): rob1.sqf (run from an action on AI) Essentially I want the script to run and affect an AI, but if that AI it to terminate. This script must be able to be run from multiple AI. Sorry if this is hard to follow, I'm guessing my terminology is terrible. Thanks for any help.
  12. Ninjaisfast

    Terminating a script midway through

    Damn, I was hoping there was something I was missing to make it neater, I'll do it the dirty way. Thanks to everyone for the replies.
  13. Ninjaisfast

    Terminating a script midway through

    startrob.sqf: rob1.sqf This works fine on one person, but gets weird when two people are 'robbed', and one of them is killed. Say I started robbing person 1, ran to person 2 and started robbing them, then killed person 1 before they finished their actions, it terminates person 2's script (leaving them on their ambient animation), and continues giving person 1 items and having them talk. Is this the sort of thing where I just need to add if Alive _target to every single action I want to complete, else terminate the script?
  14. Ninjaisfast

    Terminating a script midway through

    This wouldn't work if I'm wanting to check if the unit dies mid instruction though right? If I wanted to have them say one thing, wait 10 seconds, then say another, it would still do these instructions if they died during the wait 10 seconds part?
  15. Ninjaisfast

    Terminating a script midway through

    Yep, I've got more code underneath for what the AI should do and adding items to them etc. But it runs regardless of if the AI is dead unless I add an event handler.
  16. Ninjaisfast

    Terminating a script midway through

    Sorry for the confusion, I think that might be what I was trying the first time. The action actually runs a different script, which runs the next one. Action starts this: _target=_this select 0; _caller=_this select 1; _id= _this select 2; rob1 = [_target,_caller,_id] execVM "rob1.sqf"; rob1.sqf uses: _target addEventHandler ["Killed", {hint "he dead" ; terminate rob1;}];
  17. Hi, correct me if I use any of the incorrect terminology, I'm very new to this. I'm trying to add an array of units to a created radio channel, but can't seem to get it to work when I want to access that array in the units selection. This works (run from one of the units init boxes): But this doesn't, where I've defined clerkArray = [greg, dom] in my init.sqf. I think my array is correctly defined, as clerkArray select 0 setdamage 1; works fine, and kills greg. I feel like I'm doing something wrong with actually selecting from that array when that selection will itself be part of an array. Ideally, I would like to be able to add whatever unit names I want to my definition in my init.sqf, not the unit init box.
  18. Yep, putting it in the init.sqf worked instead. And if I put it in a radio trigger it works as well. The object init fields must be called before the init.sqf ?
  19. That's my confusion. I'm not sure what to put there to make that happen. [clerkArray select 0, dom] doesn't work either.
×