How come my background scripts won't run?

Jake_2257

New member
Joined
Jun 22, 2012
Messages
5
Hey all, I know this may seem like a dumb question but I have been working on some scripts for a custom map and I seem to be getting the hang of it...but for some reason any script I try to run as a background script doesn't seem to work. I am not a pro when it comes to scripting, but I have been able to do pretty much anything else I have tried to using the Lionhead script documentation but the only scripts that work are the ones I run normally (ie. run script script_name). I've tried everything I can think of and I'm still not sure what I'm doing wrong, so if anyone knows of any reason why this might be happening, any help would be much appreciated. I've included my main script below....

p.s. I have also tried some of the pre-made scripts on here such as the enemy build, God AI, etc. and anything involving background scripts won't run. Also, I know my land number is not registered, just a temp until I can finish.

-------------------------------------------------------------------------------------------------------------------------

run script Land12Script
run script playercreature
run script ResearchStandardBuildings
run script CreatePlatoon

begin script Land12Script

GateHouse0 = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE_F at {793.88,1314.03} radius 10
GateHouse1 = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE_F at {1233.08,1767.98} radius 10

start

disable load screen
set fade in time 1
enable gate GateHouse0 can open for platoons
enable gate GateHouse1 can open for platoons
run background script EnemyPlatoon
wait until 1 != 1

end script Land12Script
 
//usually we run the scripts like this.

define script Land12Script
define script playercreature
define script ResearchStandardBuildings
define script CreatePlatoon

run script Land12Script
begin script Land12Script

start
  disable load screen
  set fade in time 1
  enable gate GateHouse0 can open for platoons
  enable gate GateHouse1 can open for platoons
  run background script EnemyPlatoon
  run background script playercreature
  run background script ResearchStandardBuildings
  wait until 1 != 1

end script Land12Script
 
Thanks Willy, I made the changes and the pre-made scripts seem to be working. The problem appears to be in my other script and I've made some progress now. I appreciate the help.
 
So I can't seem to get this script to work...It opens the gates off the start but never closes. could someone see what I'm doing wrong? Everything compiles fine, also how do you move a unit onto a wall in a script? I could only come up with...
""add action PLATOON_AGENDA_ACTION_GET_ON_WALL using WallSpot1 to front of Platoon3 action queue""

(this is not mine but I can't seem to get it to work)

begin script GateHouseControl

GateHouse[2]
GateTown[2]
TestPlatoon = 0
TestSiege = 0
TestCreature = 0
Cnt = 0
oCreature = get player 1 creature
Town0 = get town with id 0
Town1 = get town with id 1

start

GateHouse[0] = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE_F at {806, 1313} radius 15
GateHouse[1] = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE_F at {1233, 1781} radius 15


GateTown[0] = get town with id 1
GateTown[1] = get town with id 1

begin loop
if Cnt == 2
Cnt = 0
end if

TestPlatoon = get platoon of player 1 nearest {GateHouse[Cnt]} radius 100
TestSiege = get siege weapon of player 1 nearest {GateHouse[Cnt]} radius 100
TestCreature = get distance from {GateHouse[Cnt]} to {oCreature}

if TestPlatoon exists or TestSiege exists or TestCreature < 100
set gate GateHouse[Cnt] close
else
set gate GateHouse[Cnt] open
end if

Cnt++
until get Town0 player == get Town1 player
end loop

end script GateHouseControl
 
Here is your problem:

TestPlatoon = get platoon of player 1 nearest {GateHouse[Cnt]} radius 100
TestSiege = get siege weapon of player 1 nearest {GateHouse[Cnt]} radius 100
TestCreature = get distance from {GateHouse[Cnt]} to {oCreature}

The player should be:

TestPlatoon = get platoon of player 0 nearest {GateHouse[Cnt]} radius 100
TestSiege = get siege weapon of player 0 nearest {GateHouse[Cnt]} radius 100
TestCreature = get distance from {GateHouse[Cnt]} to {oCreature}

Also For the army command I used

add action PLATOON_AGENDA_ACTION_GET_ON_WALL using wall0 to APlatoon[0] action queue
your command
add action PLATOON_AGENDA_ACTION_GET_ON_WALL using WallSpot1 to front of Platoon3 action queue

See the diffenece?
 
If you just want to move the platoon to the wall use

add action PLATOON_AGENDA_ACTION_MOVE_TO_POS using {Location near wall} to Platoon3 action queue
 
Thanks again Willy, you've been more than helpful and now all my scripts seem to function properly...The issue as you pointed out seems to be the player id, in the .bwe file it refers to me as player one, so I assumed in the scripts it would be the same.
 
You welcome
If you incounter any more problems just ask. I will be more then happy to help :D
 
Back
Top