OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: mclane23 on 20 Mar 2005, 19:28:20
-
Can anyone give me a script that makes other AI troops join me after i "challenge" ( simply shout and call them over) them. If you played invasion'44, and ww2ec's pathfinders mission you know what i mean.
Thanks
-
pretty simple, assuming you know basic scripting, if not I'll type it so even you can understand!
Simply do player addaction ["Call Troops","Call.sqs"]
;Call.sqs
;-----------------------------------
titletext ["Hey you bums comere'!","Plain Down",0.5]
?(player distance Whoever < 50):{[_x] join player} foreach units group Whoever;exit
~1
hint"nobody is close enough to hear you..."
exit
-
Doesn't work. The script gets activated, but nobody joins me. :(
-
do you have a group named whoever?
whoever has to be replaced with the name of whichever group you want to join you...
-
But i don't need a specific group. I need any of the freelance soldiers, as long as they're "west" sided
-
well the script above will work just fine if you know the names of the group/single loons that are likely to be in the vicinity.
if you want this to be truly independant of names, you need a little heavier scripting. one way would be to create triggers for each loon which could join the player. the triggers would need names, and would be grouped with the player. you'd have to create a looping script which centres each trigger on its respective loon. in the 'on activation' field of each trigger, you'd put the addaction command, calling a script which would display the "hey you, join my squad!" message and join the loon in question to the player, delete/remove the trigger and remove the action from the player's menu.
if you're new to scripting, i'd also heartily recommend the tutorials in the editor's depot. they're pretty easy to understand, and will have you on your way in no time.
good luck :)
EDIT - i'm in a helpful mood today - even though the bastard bus-driver wouldn't stop - so attached is a sample mission for you to look at, containing exactly what you need.
-
Well, the first script works now, but how can i add multiple names to the unit list (find here in the code). Or do i need 50 different scripts
titletext ["Hey you bums comere'!","Plain Down",0.5]
?(player distance [b]HERE[/b] < 50):{[_x] join player} foreach units group [b]HERE[/b];exit
~1
hint"nobody is close enough to hear you..."
exit