Results 1 to 10 of 10

Thread: Are character labels re-usable?

  1. #1

    Default Are character labels re-usable?

    I intended to spawn a certain class of characters that for further scripting purposes would be marked by a certain label. However I run into a problem that once the first guys is dead - killed by script, old age or battle - his successors are no longer spawned although the preceding part of the script within the same monitor clearly gets executed.

    So I suspect that whenever a particular label is given to a character, it becomes sort of "expended" and stuck to that particular guy and no further ones may appear with the same one. If it is indeed the case, then it would be the end to my project, so I would like to ask you whether anybody can in fact confirm this for a fact or if the error is likely elsewhere.

    ...................................................

  2. #2

    Default Re: Are character labels re-usable?

    Hello. Yes, labels are for a single character. The labels are not inherited, if that's what you meant.

  3. #3

    Default Re: Are character labels re-usable?

    I did not meant inherited, I meant assigned again by the script.

    Code:
    monitor_event BuildingCompleted SettlementBuildingFinished = alliedstate        and SettlementName sett_039
            
    		if I_CharacterExists client039
                kill_character client039
            end_if
    		
            if I_SettlementOwner sett_039 = f_rome
                spawn_army
                    faction f_rome
                    character	random_name, named character, age 36, x 130, y 177, label client039
                    traits	ClientRuler 1 , TurnsAlive 3 , PoliticsSkill 1 , EthnoDetermined 1 , FamilyNameGiven 1
                    unit		italic cavalry sabellian		exp 1 armour 0 weapon_lvl 0
    			end
    			move client039, 129, 177
            end_if
        end_monitor
    Once i build the required building for the first time, the character appears. However if I tear it down and build it again, the first character dies - as he should and thus confirming that the monitor is firing again - BUT the new character is NOT spawned.

    ...................................................

  4. #4

    Default Re: Are character labels re-usable?

    I'm testing, and it seems the label is stored in the registry.

    Code:
    01:00:02.778 [game.script] [error] Script execution error for <spawn_army>, at line 65, in mods/Bare_Geomod/data/world/maps/campaign/imperial_campaign/campaign_script.txt: 
    Character with label random_name could not be created, label alreay exists!
    Code:
    monitor_event BuildingCompleted SettlementBuildingFinished = port        
    	and SettlementName Leon
            
    	if I_CharacterExists client039
    		kill_character client039
            end_if
    
    
    	if I_SettlementOwner Leon = spain
    		spawn_army
    			faction spain
    			character	random_name, named character, age 36, x 83, y 86, label client039
    			traits	PoliticsSkill 1
    			unit		SE Bodyguard		exp 1 armour 0 weapon_lvl 0
    		end
    
    		;;move client039, 129, 177
            end_if
    end_monitor

  5. #5

    Default Re: Are character labels re-usable?

    I have a few labels for specific named characters but i never tried to use the same label twice. I think you are right in thinking that the label is link to only one character.

    Why do you need to use labels with random_character ? I am asking because i thought it was only useful for unique names?

  6. #6

    Default Re: Are character labels re-usable?

    It definitely seems that the label is stored in the registry

    Code:
    monitor_event FactionTurnStart FactionType spain
    	and I_CharacterExists client039
    	and I_TurnNumber > 3
    
    	kill_character client039
    	historic_event world_is_round
    
    	terminate_monitor
    end_monitor
    
    monitor_event BuildingCompleted SettlementBuildingFinished = port        
    	and SettlementName Leon
            
    	;if I_CharacterExists client039
    	;	kill_character client039
            ;end_if
    
    	log always READ
    	if I_SettlementOwner Leon = spain
    		spawn_army
    			faction spain
    			character	random_name, named character, age 36, x 82, y 93, label client039
    			traits	PoliticsSkill 1
    			unit		SE Bodyguard		exp 1 armour 0 weapon_lvl 0
    		end
    
            end_if
    end_monitor
    Code:
    01:14:27.415 [system.io] [warning] open: mods/Bare_Geomod/data/world/maps/base/water_surface.tga.dds is missing
    01:15:18.869 [game.script] [always] READ
    01:15:20.105 [data.missing] [warning] Cannot find the portrait path: data/ui/eastern_european/portraits/portraits/young/rogues/000.tga, using the default culture path if it exists
    Code:
    01:17:42.046 [system.io] [warning] open: mods/Bare_Geomod/data/world/maps/campaign/imperial_campaign/radar_map_background.tga is missing
    01:17:49.217 [game.script] [always] READ
    01:17:49.217 [game.script] [error] Script execution error for <spawn_army>, at line 67, in mods/Bare_Geomod/data/world/maps/campaign/imperial_campaign/campaign_script.txt: 
    Character with label random_name could not be created, label alreay exists!
    01:17:50.343 [data.missing] [warning] Cannot find the portrait path: data/ui/eastern_european/portraits/portraits/young/rogues/000.tga, using the default culture path if it exists
    Code:
    01:18:17.944 [data.missing] [warning] Cannot find the portrait path: data/ui/eastern_european/portraits/portraits/young/princesses/039.tga, using the default culture path if it exists
    01:18:22.730 [game.script] [always] READ
    01:18:22.730 [game.script] [error] Script execution error for <spawn_army>, at line 67, in mods/Bare_Geomod/data/world/maps/campaign/imperial_campaign/campaign_script.txt: 
    Character with label random_name could not be created, label alreay exists!
    01:18:35.524 [data.missing] [warning] Cannot find the portrait path: data/ui/eastern_european/portraits/portraits/young/rogues/000.tga, using the default culture path if it exists

  7. #7
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Are character labels re-usable?

    Quote Originally Posted by Miguel_80 View Post
    Code:
    01:00:02.778 [game.script] [error] Script execution error for <spawn_army>, at line 65, in mods/Bare_Geomod/data/world/maps/campaign/imperial_campaign/campaign_script.txt: 
    Character with label random_name could not be created, label alreay exists!
    The error message is a little misleading - would be nice if it said the label name instead of the character name ("random_name") - but yes, it is a sad fact that labels can't be reused for named characters.

    They can be reused for generals (captains). e.g. Spawn a general with a label, kill him, spawn another general with same label --> no problem. The label exists only as long as that character remains the commander of that army: until he enters something (ship, settlement, fort, another army) - at that point the character no longer exists and neither does his label, so the label may be reused.

    See: Unique Names.

  8. #8

    Default Re: Are character labels re-usable?

    Quote Originally Posted by Miguel_80 View Post
    It definitely seems that the label is stored in the registry
    Thank you for testing!

    Quote Originally Posted by selv View Post
    Why do you need to use labels with random_character ? I am asking because i thought it was only useful for unique names?
    Name does not matter, it is the character's function that's important to me and I hoped that combination of fixed labels with random names could provide for simple script that does not cause savegame bloat and other problems plaguing similar schemes in RTW.
    Sadly, it is not possible, time to devise new scheme...
    Last edited by V.T. Marvin; June 27, 2015 at 02:23 AM.

    ...................................................

  9. #9

    Default Re: Are character labels re-usable?

    Quote Originally Posted by V.T. Marvin View Post
    Thank you for testing!
    You're welcome. I don't know exactly what you want to do, or how many characters you need. But, this could be helpful? (with a duplicate entry in EDU)

    Code:
    monitor_event BuildingCompleted SettlementBuildingFinished = alliedstate        
        and SettlementName sett_039
    
        if I_CharacterExists client039
                kill_character client039
                destroy_units f_rome New Bodyguard
            end_if
            
            if I_SettlementOwner sett_039 = f_rome
                spawn_army
                    faction f_rome
                    character    random_name, named character, age 36, x 130, y 177, label client039
                    traits    ClientRuler 1 , TurnsAlive 3 , PoliticsSkill 1 , EthnoDetermined 1 , FamilyNameGiven 1
                    unit        New Bodyguard        exp 1 armour 0 weapon_lvl 0
                end
                move client039, 129, 177
            end_if
    end_monitor

  10. #10

    Default Re: Are character labels re-usable?

    Thanks for the suggestion, but that does not solve the problem. If we had dedicated units for the clients, we would made them recruitable and saved ourselves all the troubles with the script spawning/killing. It will probably end this way anyway I guess. But still, thanks for help!

    ...................................................

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •