Home   Help Search Login Register  

Author Topic: Need a script  (Read 669 times)

0 Members and 2 Guests are viewing this topic.

mclane23

  • Guest
Need a script
« 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

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Need a script
« Reply #1 on: 21 Mar 2005, 00:20:48 »
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
;-----------------------------------
Code: [Select]
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
I like your approach, lets see your departure.
Download the New Flashlight Script!

mclane23

  • Guest
Re:Need a script
« Reply #2 on: 21 Mar 2005, 10:36:46 »
Doesn't work. The script gets activated, but nobody joins me. :(

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Need a script
« Reply #3 on: 21 Mar 2005, 10:54:28 »
do you have a group named whoever?

whoever has to be replaced with the name of whichever group you want to join you...

mclane23

  • Guest
Re:Need a script
« Reply #4 on: 21 Mar 2005, 16:39:25 »
But i don't need a specific group. I need any of the freelance soldiers, as long as they're "west" sided

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Need a script
« Reply #5 on: 21 Mar 2005, 18:02:16 »
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.
« Last Edit: 21 Mar 2005, 18:31:43 by bedges »

mclane23

  • Guest
Re:Need a script
« Reply #6 on: 21 Mar 2005, 23:02:09 »
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

Code: [Select]
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