I want to get my character to spawn and activate my counter, but the character doesn't spawn. I am transferring him from a spawnpool faction. Copy of my script:
Click to view content:
I want to get my character to spawn and activate my counter, but the character doesn't spawn. I am transferring him from a spawnpool faction. Copy of my script:
Click to view content:
A missing = perhaps?
The log might be telling you about that error.Code:and if I_CompareCounter ImmortalRecruited = 0
Remove the 'if' - it's not needed and there is no 'end_if'
Counters are always zero when they are declared, no need to do that.
The counters are not needed at all if you are not resetting them back to zero, simply terminate the monitor.
monitor_event FactionTurnEnd FactionIsLocal
; add more conditions here, eg turn number
spawn_army
faction spawnpool
character Immortal, named character, age 18, x 96, y 145
unit Peasants exp 0 armour 0 weapon_lvl 0
end
give_everything_to_faction spawnpool england false
terminate_monitor
end_monitor
I changed my script to put a use to the counter. New script:
Click to view content:
Error log:
Click to view content:
The correct syntax would be either:
or:Code:monitor_event FactionTurnEnd FactionIsLocal and I_CompareCounter EnglandImmortalRecruited = 0 ; <-- no IF spawn_army faction spawnpool character Immortal, named character, age 18, x 96, y 145 unit Peasants exp 0 armour 0 weapon_lvl 0 end give_everything_to_faction spawnpool england false inc_counter ImmortalRecruited 1 ;no END_IF because there is no IF end_monitor
Code:monitor_event FactionTurnEnd FactionIsLocal if I_CompareCounter EnglandImmortalRecruited = 0 spawn_army faction spawnpool character Immortal, named character, age 18, x 96, y 145 unit Peasants exp 0 armour 0 weapon_lvl 0 end give_everything_to_faction spawnpool england false inc_counter ImmortalRecruited 1 end_if end_monitor
I changed my script so there is only 'if' in the first monitor and only one 'if' in the second. It still gives me an error. New script:
Click to view content:
Error log:
Click to view content:
Also, check your "unit" lines. There should be a tab between "Peasants" and "exp", not spaces. That might be the cause of the error.Code:if I_compareCounter EnglandImmortalRecruited = 1 and not I_CharacterExists Immortal
I added the 'and' in the second monitor and fixed the spacing. Now it says:
17:48:53.752 [game.script] [error] Condition parsing error in mods/Bare_Geomod/data/world/maps/campaign/imperial_campaign/campaign_script.txt, at line 16, column 5
Condition parser doesn't recognise this token: I_compareCounter
Edit:I should have noticed the lowercase. That part is fixed now, but the script still doesn't work. There is no error in the log.
Last edited by Firey the Unorthodox; September 01, 2012 at 09:59 PM.
I decided to make my script simpler to at least make the character spawn. I used the files from the Unique names tutorial. I tried it with England and France but it didn't work. It doesn't give me an error in the log either. The spacing is correct in my script. Copy of script:
Spoiler Alert, click show to read:
As a side note, my English spy had some portrait problems. It would start out with no portrait in the unit selection and a black background where a portrait would normally be. Whenever I clicked a unit then went back to the spy, the spy would have that unit card picture and portrait.
Last edited by Firey the Unorthodox; September 02, 2012 at 05:37 PM.
I forgot to add 'script' and 'end_script.' It still doesn't work, but at least it gives me an error.
Full script:
Spoiler Alert, click show to read:
Error:
Spoiler Alert, click show to read:
spawn_army
faction spawnpool
If you let me join your thread i would like to ask about my very weird problem. I made very simply script which should add an army at start of a game:
Log sayd:PHP Code:monitor_event FactionTurnStart FactionIsLocal
and I_TurnNumber = 0
spawn_army
faction egypt
character Jobst Friedrich Steffen, named character, age 16, x 256, y 265
traits GoodCommander 2 , Drink 1
unit European bodyguard exp 1, armour 0, weapon_lvl 0
unit Musketerare exp 1, armour 0, weapon_lvl 0
unit Musketerare exp 1, armour 0, weapon_lvl 0
unit Musketerare exp 1, armour 0, weapon_lvl 0
unit Musketerare exp 1, armour 0, weapon_lvl 0
unit Swedish pikemen exp 1, armour 0, weapon_lvl 0
unit Swedish pikemen exp 1, armour 0, weapon_lvl 0
unit Swedish pikemen exp 1, armour 0, weapon_lvl 0
unit Kirasjerzy exp 1, armour 0, weapon_lvl 0
unit Kirasjerzy exp 1, armour 0, weapon_lvl 0
end
terminate_monitor
end_monitor
I thought i don't need line with the number of turn, so i erased this line. Unfortunately, script still doesn't work. This time log says:PHP Code:don't recognise this token: and
I'm completly confused. I made hundreds of scripts similar to this and it allways worked, but i have no idea what's wrong now.don't recognise this token: end_monitor
As usually. Making from scratch was very helpfull![]()