Jump to content
Sign in to follow this  
Wobbleyheadedbob

Non-linear convoy Escort

Recommended Posts

Hi all, I've been browsing and searching the forums to see if I can find a solution to my problem. The only thread I could find was one from 2002(http://forums.bistudio.com/showthread.php?t=19616&highlight=Waypoint+decision) which has now gone very cold... So starting a new one.

I'm trying to do a convoy/escort mission, but having a bit of trouble.

1. When the convoy reaches a junction the waypoint calls a script. - WORKING

2. My script outputs a sidechat from the convoy leader saying something along the lines of "We are here, where should we go now?" - WORKING

3. The script also creates 3 Radio triggers (Hotel, Juliet, India) - WORKING

4. I then use the setTriggersStatements on each radio trigger to call a route1 - 3 script that creates the waypoints for the particular route chosen. - NOT WORKING

_triggerRoute0=createTrigger["EmptyDetector",getPos player]; 
_triggerRoute0 setTriggerActivation ["HOTEL", "WEST D", true];
_triggerRoute0 setTriggerStatements["this", "[_convoyLead] execVM 'Routes\route1.sqf'", "hint 'trigger off'"]; 

_convoyLead is the group leader for the convoy.

I'm thinking the issue might be that the variable I use to call the convoy lead is outside the scope of the "setTriggerStatements", if so how should I go about assigning the convoy leader or group to be a global variable?

Can anyone tell me how to get this working? or if perhaps there is an easier way to accomplish this?

Thanks for reading and any help would be greatly appreciated. (and yes I am new to this but have non-game programming experience so am familiar with OO programming concepts)

Cheers

Share this post


Link to post
Share on other sites

By not working do you mean that route1.sqf is not executing or it executes but does not do what it is supposed to?

if you are not sure which problem it is, just try have the trigger execute a simple script (nothing more than a hint maybe) and see if it executes. If it does you know its the mechanics of the script...if it doesn't you know it's because the script is not being executed properly.

If it is not executing, something that jumped out at me was the lack of a script handle in front of the execVM. So try this:

triggerRoute0=createTrigger["EmptyDetector",getPos player]; 
_triggerRoute0 setTriggerActivation ["HOTEL", "WEST D", true];
_triggerRoute0 setTriggerStatements["this", "nul = [_convoyLead] execVM 'Routes\route1.sqf'", "hint 'trigger off'"];

If that still doesn't work, this may not matter, but try double quotes """...""" instead of double inside single '"..."' or try the single quotes inside the doubles instead of doubles in singles (if that makes sense)

_triggerRoute0 setTriggerStatements["this", "nul = [_convoyLead] execVM ""Routes\route1.sqf""", "hint ""trigger off"""];

if you worried about scope, use private to make it available throughout the whole script (it's a good practice regardless). You can use a global but if you don't need to you shouldn't.

Good Luck!

Edited by Loyalguard

Share this post


Link to post
Share on other sites

Geez I'm an idiot,

yeah... I had a "hint" in the route 1 script to confirm it was firing properly. I just turned on debugging and realised I'd forgotten to terminate the "hint" with a ";" - shows what happens when staring at code for too long.Thanks for your reply though!

Now to get him to move to the new waypoints :yay:

Ok well now that I know the Script is being called correctly I've noticed _convoyLead isn't being passed through to the route script correctly.

The 1st 2 lines of route1.sqf read:

_convoyLead = this select 0;
hintSilent format ["Convoy Leader: %1",_convoyLead];

When I run it it's saying "Any" :Oo:

Can anyone help me out here? (or explain it to me)

Edited by Wobbleyheadedbob

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×