Jump to content


Problem with Scripting - BFME2


  • Please log in to reply
7 replies to this topic

#1 Guest_Andre_*

Guest_Andre_*
  • Guests

Posted 14 April 2006 - 03:44 AM

Hi

This is probably an easy question but i'm brand new to the map making/modding world.

Anyway, to put the problem in very simple terms: I want to spawn unit X on team Z in location Y and attack the Human player.

For two steps where rather easy. Problem being, they dont move. I've tried everything i could logically think of. Now yeah, i went overkill with the scripts, but i just tried different ones to see if one worked. But they still dont move. They just stand there. Here is what i tried:

*** IF ***
	True.
*** THEN ***
   Team 'Player_3/teamPlayer_3' change their attitude to Aggressive
   Team 'Player_3/teamPlayer_3' attack anything in  area 'Goodside'
   Team 'PlyrCreeps/teamPlyrCreeps' begins guarding  area 'Goodside'


*** IF ***
	True.
*** THEN ***
  Null operation. (Does nothing.)
  Have Team 'Player_3/teamPlayer_3' AttackMove follow Waypoint Path 'Mordorpath 1' , as a team is FALSE , in formation is FALSE

*** IF ***
	True.
*** THEN ***
   Player 'Player_3' begins hunting.
   Team 'Player_3/teamPlayer_3' begin attack on Team 'Player_1/teamPlayer_1'
  AttackMove Team 'PlyrCreeps/teamPlyrCreeps' to Waypoint 'Waypoint 25'.

It says player 3, but that was because i tried changing between different players to see if there where any difference. Its all suppose to be on the PlyrCreeps team.

In addition to just 'If true', i tried 'if timer expired', but no difference.

Its probably noobish, but i'm trying and trying here :(

#2 Gumby22don

Gumby22don
  • Project Team
  • 144 posts
  •  AWD Development Team
  • Division:BFME
  • Job:Co-Designer: RoR 1 and 2

Posted 20 April 2006 - 02:03 PM

That's wierd. I could have sworn the script for ___ begins hunting was team related, not player related.

That aside, can you check that you've defined the player 3 and player creeps to be enemies in the map players settings? If that's not it, I'll try to give more detailed help tomorrow - i'm off to get some sleep now.

Don
have a great day
Posted Image

#3 Guest_Andre_*

Guest_Andre_*
  • Guests

Posted 23 April 2006 - 12:40 PM

'player 3' and 'player creeps' was just me trying two different ones to see if there where any difference. In any case yes they are set as enemies towards player 1 and player 2 (which are the other players on the map).

The units spawn and i can go attack them. When i get really close they will attack me. But they will not follow. They kinda just stand there.

Maybe i somehow have to set team playr creeps to begin hunting *after* the units spawn? Not sure, but wont move thats for sure :p

Thanks for the reply btw

#4 Gumby22don

Gumby22don
  • Project Team
  • 144 posts
  •  AWD Development Team
  • Division:BFME
  • Job:Co-Designer: RoR 1 and 2

Posted 24 April 2006 - 01:29 AM

I've always called a team x begins hunting after spawning units on that team, if i want them to go looking. I'm having some trouble with the last unit on the team (spider riders) not following, but the 4-8 goblin inf. hordes i spawn do definately pick a target and run it down.

Don
have a great day
Posted Image

#5 Guest_Andre_*

Guest_Andre_*
  • Guests

Posted 24 April 2006 - 12:00 PM

Thanks Don, i'll try out with some counters.

#6 xnode

xnode
  • Members
  • 23 posts

Posted 01 May 2006 - 12:22 PM

TO WAYPOINT, halve of the time dosn't work and actually this statment is even said "not recommended" meaning un-reliable. If you want your team or unit or even player for that matter (which u control by teams) to attack or move_attack etc, all you need to do is use a hunt command or what I love to do is change conditions on the fly to allow the ai more variations use areas to enact, however don't put area's within areas, if you need to do something like this, make the area like an inner tube, make two sides of the area then stretch them out to form a hexegon or whatever, think of making a river.... See below for my excample of how i make the ai attack upon spawn units i creat...

*** IF ***
	 Player 'Player_1' has units in  area 'inner ring'.
  *** OR ***
	 Player 'Player_2' has units in  area 'inner ring'.
  *** OR ***
	 Player 'Player_3' has units in  area 'inner ring'.
  *** OR ***
	 Player 'Player_4' has units in  area 'inner ring'.
*** THEN ***
  Enable Script 'Move_Armies'.
  Spawn an instance of Team 'enforcments2' at Waypoint 'Renforcment2a'.
  Spawn an instance of Team 'enforcments4' at Waypoint 'Renforcment4a'.
  Disable Script 'activate'.


*** IF ***
	True.
*** THEN ***
  Have Team 'enforcments1' AttackMove follow Waypoint Path 'pathing1' , as a team is TRUE , in formation is FALSE
  Have Team 'enforcments4' AttackMove follow Waypoint Path 'pathing4' , as a team is TRUE , in formation is FALSE
  Disable Script 'moveit'.
  Enable Script 'gotit'.


*** IF ***
	 Team 'Player_1/teamPlayer_1' has Object Status is 'HOLDING_THE_RING'
*** THEN ***
  Spawn an instance of Team 'enforcments1' at Waypoint 'Renforcment1a'.
   Team 'enforcments1' begin attack on Team 'Player_1/teamPlayer_1'
   Team 'enforcments2' begin attack on Team 'Player_1/teamPlayer_1'
   Team 'enforcments4' begin attack on Team 'Player_1/teamPlayer_1'
  Disable Script 'gotit'.

(this one repeats per player just saving spam here)


** IF ***
	 Team 'enforcments1' has Object Status is 'HOLDING_THE_RING'
  *** OR ***
	 Team 'enforcments2' has Object Status is 'HOLDING_THE_RING'
  *** OR ***
	 Team 'enforcments3' has Object Status is 'HOLDING_THE_RING'
  *** OR ***
	 Team 'enforcments4' has Object Status is 'HOLDING_THE_RING'
*** THEN ***
  Have Team 'enforcments1' AttackMove follow Waypoint Path 'leavingwithring' , as a team is TRUE , in formation is FALSE
  Have Team 'enforcments2' AttackMove follow Waypoint Path 'leavingwithring' , as a team is TRUE , in formation is FALSE
  Have Team 'enforcments3' AttackMove follow Waypoint Path 'leavingwithring' , as a team is TRUE , in formation is FALSE
  Have Team 'enforcments4' AttackMove follow Waypoint Path 'leavingwithring' , as a team is TRUE , in formation is FALSE
  Disable Script 'gotit'.
  Enable Script 'disbandring'.



*** IF ***
	One unit from Team 'enforcments4' enters  area 'exitarea1a' (Surfaces Allowed: GROUND).
	*AND*  Team 'enforcments4' has Object Status is 'HOLDING_THE_RING'
*** THEN ***
  Set Flag named 'ringmain' to FALSE
   Team 'enforcments4' is removed from the world.
  Spawn an instance of Team 'enforcments6' at Waypoint 'Renforcment1a'.
  Have Team 'enforcments6' AttackMove follow Waypoint Path 'pathing1' , as a team is TRUE , in formation is FALSE
   Team Team 'enforcments1' begins guarding Team Team 'enforcments6'
   Team Team 'enforcments2' begins guarding Team Team 'enforcments6'
   Team Team 'enforcments3' begins guarding Team Team 'enforcments6'

*** IF ***
	One unit from Team 'enforcments6' enters  area 'inner ring' (Surfaces Allowed: GROUND).
*** THEN ***
   Team 'enforcments6' begins hunting.
  Disable Script 'bossattack'.



this goes on forever, to much to put here but it gives you a good idea of how my scripts go in the particular instance. PS take out the null statements unless you don't want it to do anything in that particular instance, that is purly for passing by that section, so if you put something anywere within that line that statment forces the script not to be read.

Edited by xnode, 01 May 2006 - 12:27 PM.


#7 Gumby22don

Gumby22don
  • Project Team
  • 144 posts
  •  AWD Development Team
  • Division:BFME
  • Job:Co-Designer: RoR 1 and 2

Posted 02 May 2006 - 01:54 AM

xnode - nice work getting working scripts for the ai. I was just wondering if you could post what sort of team setups you have? (as in 1-3 of unit xxx, 2 to 2 of yyy, etc.)
When I first tried scripting bfme2 maps, I tried using a range and spawning teams, and found i always got the max number of each unit spawning - no randomness like i had had in bfme1.

Don
have a great day
Posted Image

#8 xnode

xnode
  • Members
  • 23 posts

Posted 05 May 2006 - 02:53 PM

xnode - nice work getting working scripts for the ai. I was just wondering if you could post what sort of team setups you have? (as in 1-3 of unit xxx, 2 to 2 of yyy, etc.)
When I first tried scripting bfme2 maps, I tried using a range and spawning teams, and found i always got the max number of each unit spawning - no randomness like i had had in bfme1.

Don
have a great day



well randomness is done by the max and min, also if you want varity make a gazzilion sub teams, then in the script, use one script as to aim to the team selectable, IE use the excample here of spawning Golem, but instead of spawnpoints, use team refereances..

*** IF ***
	 Is String: 'ringheroes' game mode active
*** THEN ***
  Set Counter 'SkirmishGollum_SpawnPoint#' randomly between  1  and  8 .
  Enable Script 'SkirmishGollum_Spawn_Spawnpoints'.
*** ELSE ***
  Disable Script 'SkirmishGollum_PickSpawnPoint'.


*** IF ***
	 Unit 'RingHero_Gollum' has been created.
*** THEN ***
  Enable Script 'SkirmishGollum_Cleanup'.
  Disable Script 'SkirmishGollum_Spawn_Spawnpoints'.
*** ELSE ***
  Enable Script 'SkirmishGollum_PickSpawnPoint'.


*** IF ***
	True.
*** THEN ***
  Disable Script 'SkirmishGollum_Spawn_Spawnpoints'.
  Disable Script 'SkirmishGollum_Spawn'.


*** IF ***
	Counter 'SkirmishGollum_SpawnPoint#' IS Equal To  1 
*** THEN ***
  Spawn Unit 'RingHero_Gollum' of type 'NeutralGollum_RingHero' on Team 'teamPlyrCreeps' at waypoint Waypoint 'SpawnPoint_SkirmishGollum_1'
  Enable Script 'SkirmishGollum_GollumExists?'.


*** IF ***
	Counter 'SkirmishGollum_SpawnPoint#' IS Equal To  2 
*** THEN ***
  Spawn Unit 'RingHero_Gollum' of type 'NeutralGollum_RingHero' on Team 'teamPlyrCreeps' at waypoint Waypoint 'SpawnPoint_SkirmishGollum_2'
  Enable Script 'SkirmishGollum_GollumExists?'.


etc etc


note: the counter where the = too is a subfolder , being it's technically always on its best to have this checked off as active till u need it.

Edited by xnode, 05 May 2006 - 02:55 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users