Page 1 of 2 12 LastLast
Results 1 to 20 of 32

Thread: Possible to script the death of characters

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Possible to script the death of characters

    Is it possible to script the death of a character? In particular trigger the death because of contracting a trait - i.e illness?

    Say for example, a character is injured in battle (suffers 50% damage), and get's a leg wound. That leg wound then has a chance of healing normally, or should that fail, it has a chance of getting worse - becoming gangrenous. Is there then anything which can "remove" that character from the game?

    What does it look like on the family tree, if that's possible?

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  2. #2
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    The only way I know of to kill a character or send him off the map, is by selecting him.
    Since the e_select_character command is at least flawed and can be outruled either by the player himself or the AI, it is not the command of choice to do so.
    Hence the only really reliable way is to know either the name or the label of the character.
    At least, that's my impression of it, which means I can be wrong of course.


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  3. #3

    Default Re: Possible to script the death of characters

    What happens if you do it after the player has clicked "End Turn", but before the next computer's turn? Or something along those lines?

    i.e "End Turn", Check if any character has "gangrenous wound" trait, if so, e_select_character, "kill" command, AI faction turn, etc

    I'm sorry, I don't yet know the full technical terms of it, but that's the basic plan.

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  4. #4
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    Hm.

    What may be worth a shot is try to label the character when he acquired the anc or trait, something like this:
    edct
    Code:
    Trait wounded
        Characters family
        AntiTraits recuperating
    
        Level slightly_wounded
            Description slightly_wounded_desc
            EffectsDescription slightly_wounded_effects_desc
            Threshold  1 
    
            Effect MovementPoints  -1 
    
        Level moderate_wound
            Description moderate_wound_desc
            EffectsDescription moderate_wound_effects_desc
    		Threshold  2 
    
            Effect MovementPoints  -2 
    
        Level heavily_wounded
            Description heavily_wounded_desc
            EffectsDescription heavily_wounded_effects_desc
    		Threshold  4 
    
            Effect MovementPoints  -3 
    
        Level severely_wounded
            Description severely_wounded_desc
            EffectsDescription severely_wounded_effects_desc
            Threshold  8 
    
            Effect MovementPoints  -4 
    
        Level near_death
            Description near_death_desc
            EffectsDescription near_death_effects_desc
            Threshold  16 
    
            Effect MovementPoints  -5 
    
    
    
    ;------------------------------------------
    Trait recuperating
        Characters family
        AntiTraits wounded
    
        Level wounds_treated
            Description wounds_treated_desc
            EffectsDescription wounds_treated_effects_desc
            Threshold  2 
    
            Effect MovementPoints 1 
    
        Level in_field_hospital
            Description in_field_hospital_desc
            EffectsDescription in_field_hospital_effects_desc
            Threshold  4 
    
            Effect MovementPoints 2 
    
        Level treated_by_surgeon
            Description treated_by_surgeon_desc
            EffectsDescription treated_by_surgeon_effects_desc
            Threshold  6 
    
            Effect MovementPoints 3 
    
        Level in_recreation_centre
            Description in_recreation_centre_desc
            EffectsDescription in_recreation_centre_effects_desc
            Threshold  8 
    
            Effect MovementPoints 5
    
    Trigger wounded01
    WhenToTest PostBattle
    Condition	CharacterIsLocal
    and IsGeneral
    and	GeneralHPLostRatioinBattle	<=	20
    
    Affects	wounded	1	chance	100
    
    Trigger	wounded02
    WhenToTest	PostBattle
    Condition	CharacterIsLocal
    and	IsGeneral
    and	GeneralHPLostRatioinBattle	<=	45
    
    Affects	wounded	2	chance	100
    
    Trigger	wounded03
    WhenToTest	PostBattle
    Condition	CharacterIsLocal
    and	IsGeneral
    and	GeneralHPLostRatioinBattle	<=	60
    
    Affects	wounded	3	chance	100
    
    Trigger	wounded04
    WhenToTest	PostBattle
    Condition	CharacterIsLocal
    and	IsGeneral
    and	GeneralHPLostRatioinBattle	<=	75
    
    Affects	wounded	4	chance	100
    
    Trigger	wounded05
    WhenToTest	PostBattle
    Condition	CharacterIsLocal
    and	IsGeneral
    and	GeneralHPLostRatioinBattle	<=	95
    
    Trigger	recuperating01
    WhenToTest	CharacterTurnEnd
    Condition	CharacterIsLocal
    and	IsGeneral
    and	Trait	wounded	>=	1
    and	EndedInSettlement
    and	RemainingMPPercentage	>=	75
    
    Affects	recuperating	1	chance	100
    
    Trigger	recuperating02
    WhenToTest	CharacterTurnEnd
    Condition	CharacterIsLocal
    and	IsGeneral
    and	Trait	wounded	>=	1
    and	EndedInSettlement
    and	RemainingMPPercentage	==	100
    
    Affects	recuperating	2	chance	100
    
    Trigger	recuperating03
    WhenToTest	CharacterTurnEnd
    Condition	CharacterIsLocal
    and	IsGeneral
    and	Trait	wounded	>=	1
    and	EndedInSettlement
    and	NoActionThisTurn
    
    Affects	recuperating	3	chance	100


    Campaign_script
    Code:
    monitor_event	CharacterTurnEnd	CharacterIsLocal
    	and IsGeneral
    	and	Trait	wounded	>=	3
    	if	I_RemainingMPPercentage	==	01
    		label	wounded01
    	end_if
    	if	I_RemainingMPPercentage	==	02
    		label	wounded02
    	end_if
    	if	I_RemainingMPPercentage	==	03
    		label	wounded03
    	end_if
    	if	I_RemainingMPPercentage	==	04
    		label	wounded04
    	end_if
    	if	I_RemainingMPPercentage	==	05
    		label	wounded05
    	end_if
    	if	I_RemainingMPPercentage	==	06
    		label	wounded06
    	end_if
    	if	I_RemainingMPPercentage	==	07
    		label	wounded07      ;do this till 100 percent
    	end_if
    	if	I_RemainingMPPercentage	==	100
    		label	wounded100
    	end_if
    end_monitor
    
    monitor_event	CharacterTurnStart	ChracterIsLocal
    	and	Trait	wounded	>=	3
    	and RandomPercent	>=	60
    	
    	send_character_off_map	wounded01           ;by using send_character_off_map the character remains in the family tree as dead.
    	send_character_off_map	wounded02	;continue till wounded100
    	send_character_off_map	wounded100
    end_monitor

    This is just a rough thought and since it would require hundreds of lines of code, it probably would be better to just code it for all names for all factions. You could expand it by whatever thought you might have or reduce the labels of course to say 5%, 10%, 15% and so forth, but the possibility exists, that two characters would get labeled the same, and I actually do not know, if this will end in an CTD.

    Edit:

    Quote Originally Posted by Vaz View Post
    What happens if you do it after the player has clicked "End Turn", but before the next computer's turn? Or something along those lines?

    i.e "End Turn", Check if any character has "gangrenous wound" trait, if so, e_select_character, "kill" command, AI faction turn, etc

    I'm sorry, I don't yet know the full technical terms of it, but that's the basic plan.
    Do you mean like this:
    Campaign_script
    Code:
    monitor_event	CharacterTurnEnd	IsGeneral
    	and	Trait	wounded	>=	3
    	
    	e_select_character
    	send_character_off_map	this
    end_monitor 
    
    monitor_event	CharacterTurnEnd	IsGeneral
    	and	Trait	wounded	>=	3
    	
    	e_select_character	this
    	send_character_off_map	this
    end_monitor

    I doubt that this would work, since the send_character_off_map command needs the name of the character. And if it might work with "this", I actually don't know if all characters would get selected who meet the conditions. I highly doubt that this would work.

    Since I'm working on a siege-script, I've experimented a lot with the e_select_character command and found it to be highly insufficient at best.
    Last edited by Aikanár; March 28, 2010 at 02:16 PM.


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  5. #5
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Possible to script the death of characters

    Quote Originally Posted by Aikanár View Post
    Campaign_script
    Code:
    monitor_event	CharacterTurnEnd	CharacterIsLocal
    	and IsGeneral
    	and	Trait	wounded	>=	3
    	if	I_RemainingMPPercentage	==	01
    		label	wounded01
    	end_if
    The only problem with this is that you can't use 'label' to label characters. As far as I know either they're labeled from start or do not have any labels at all.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  6. #6

    Default Re: Possible to script the death of characters

    Hm... Interesting. I'll certainly pass it on to the main scripter.

    Thinking on, could this be the route to a possible multiple different deaths. For example, Immortal Elves, but dying humans?

    Say for example, this bit -

    Code:
    monitor_event    CharacterTurnStart    ChracterIsLocal
        and    Trait    wounded    >=    3
        and RandomPercent    >=    60
        
        send_character_off_map    wounded01           ;by using send_character_off_map the character remains in the family tree as dead.
        send_character_off_map    wounded02    ;continue till wounded100
        send_character_off_map    wounded100
    end_monitor
    Create "OldHuman", "OldDwarf" etc traits, and tie that trait to occuring to a specific culture/faction?

    So, it looks like

    Code:
    monitor_event     CharacterTurnStart     CharacterIsLocal
         and     Trait     oldhuman     =     1     ;40 y o
         and RandomPercent     >=     20
    
         send_character_off_map     oldhuman01      ;continue to 20
    end monitor
    
    monitor_event     CharacterTurnStart     CharacterIsLocal
         and     Trait     oldhuman     =     2     ;50 y o
         and RandomPercent     >= 40
    
         send_character_off_map     oldhuman20    ;continue to 40
    end monitor ;continue until 90 y o, and then have a 95% chance of dieing every turn
    I hope that makes sense? This could be a major break, I think.

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  7. #7
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    You would have to label the character who possesses the trait as well. You don't get around the labeling or knowing the name though.
    So basically it would be a very huge script, not that complicated though, but huge.


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  8. #8

    Default Re: Possible to script the death of characters

    And I assume hitting on turn over performance... Ah well, I reckon it's worth it. +Rep.

    Might be worth presenting that to KK?

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  9. #9
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    Quote Originally Posted by Vaz View Post
    And I assume hitting on turn over performance... Ah well, I reckon it's worth it. +Rep.

    Might be worth presenting that to KK?


    I suggest to first get it working without flaws. Then test it concerning performance slow down of the game. And after that, you might suggest it to KK if you might like to do so


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  10. #10

    Default Re: Possible to script the death of characters

    Okay. Well, this is your work, and it's still put a brightener on my day. Once again, my thanks.

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  11. #11
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Possible to script the death of characters

    I'd say testing that label works as it seems to be used in the context of this script is the first order of business. Labels for characters were introduced in Kingdoms, but I'm fairly certain the label 'command' existed before that. The extent of its entry in the DocuDemons is worthless:
    Code:
    Identifier:         label
    Parameters:         label
    Description:        Label
    Sample use:         label crap
    Class:              LABEL
    Implemented:        Yes
    Author:
    I'm guessing it won't do what you want it to do. The reason I say this is that, to my knowledge, commands don't take any data from events or conditions which require them to run. A command requires all its arguments be specified with the command, so it wouldn't know when you say 'label cheese' that you want whatever character returns from the events and conditions to be labeled with cheese, it would presumably just create a label cheese and attach it to nothing, which is probably why the command documentation is so shoddy.

    It's worth a try, but test that basic functionality of the command before doing anything more complex. If you can't label a character with that command, then the rest of the script depending on the label doesn't do much good.

  12. #12
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    You're absolutely right on that one AL.
    As I wrote, it's just a rough thought written down without testing.
    All of the code above was just written off-hand without any testing, just to give an example of the rough thought though


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  13. #13

    Icon1 Re: Possible to script the death of characters

    Just tried it. It doesn’t work. Maybe if the ‘e_select_character’ command is used in the script that could work.

    One:
    Code:
    	monitor_event CharacterSelected CharacterIsLocal
    		and Trait wounded = 5
    		e_select_character
    		label death_wounded
    	end_monitor
    
    	monitor_event CharacterTurnEnd CharacterIsLocal
    		and Trait wounded = 5
    		kill_character death_wounded
    	end_monitor
    Two:
    Code:
    	monitor_event CharacterSelected CharacterIsLocal
    		and Trait wounded = 5
    		e_select_character
    		label this death_wounded
    	end_monitor
    
    	monitor_event CharacterTurnEnd CharacterIsLocal
    		and Trait wounded = 5
    		kill_character death_wounded
    	end_monitor
    Last edited by TNZ; March 28, 2010 at 08:55 PM.

  14. #14
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    Nope, just tested it extensively. Sadly the "label" command just seems to work while spawning characters via script.
    Interesting is, that it gives no error-messages whatsoever if used and not working, meaning the monitors will be executed without a problem and without any notice in the system.log set on trace, but to no result.


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  15. #15

    Default Re: Possible to script the death of characters

    Okay, thanks for all your help guys, I'll keep with the trial and error. I've dled the docudemons, so I'll see what I can come up with there.

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,679
    Blog Entries
    35

    Default Re: Possible to script the death of characters

    Nope, just tested it extensively. Sadly the "label" command just seems to work while spawning characters via script.
    Works in the descr_strat just as well (character line).

    Maybe one should think of it as :"name tag" - a noun










  17. #17
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: Possible to script the death of characters

    Quote Originally Posted by gigantus View Post
    Works in the descr_strat just as well (character line).

    Maybe one should think of it as :"name tag" - a noun
    Ah I did not express myself right I meant regarding the context of using it in the campaign_script.txt.
    Of course you're right concerning the descr_strat.
    Yep, I see it the same way, it's another name for a character to which one can refer to.


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  18. #18

    Default Re: Possible to script the death of characters

    Sorry, I'm being a little slow today - what does that mean then?

    Script a trait, the effect of which gives the listed character that tag. The script then searches for characters with that tag, and remove them from the map? Would anyone be able to confirm that works or not? I'm a bit snowed under with 2D work recently.

    [ Cry Havoc:: ] - [ link ] - [ An Expanded World Submod for Call of Warhammer ]
    My turban brings all the muslims to the yard and they're like العنصرية ش

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,679
    Blog Entries
    35

    Default Re: Possible to script the death of characters

    To remove or kill a character you have to know his name. The "label" is basically another form of name and can only be given at the creation of that character, be it spawn or in the descr_strat.
    Basically your idea failed because you cannot determine the name through a script and then use it. You can only test whether a name exists.










  20. #20

    Default Re: Possible to script the death of characters

    Quote Originally Posted by gigantus View Post
    To remove or kill a character you have to know his name. The "label" is basically another form of name and can only be given at the creation of that character, be it spawn or in the descr_strat.
    Basically your idea failed because you cannot determine the name through a script and then use it. You can only test whether a name exists.
    You could make some 'undying' factions therefore, if you'd set the death age of all characters very high like 10000 and then script the spawn of all 'dying' factions' generals (maybe even via a settlement number counter - win a settlement -> a new character spawns.) These scripted guys then should be labeled and killed at a certain point of time. At best the killing script would include some random chance so they don't die every time in the same turn.
    Only problem now would be the normally acquired characters for 'dying' factions via adoption, marriage and birth. As recently discussed adoption, birth and so on is also connected to settlement number.
    Maybe you could script that a 'dying factions' characters death in battle spawns again a scripted other character to keep track of your settlement/generals-ratio.
    Okay, negative side of the coin is that would be a lot of work and take out the random fun effect for these factions.

    Can one somehow completely turn off adoption for specific factions?
    And the same with marriages and birth, keeping a family tree the same time? (The family memebers then would just not be fighters, but mere show.)

    Ah, sorry, been a little confused lately....
    The point is you needed to switch off character spawn for 'dying factions' via adoption, marriage and birth and at best keep a nice looking family tree with no characters to appear out of it and keep the possibility of "accepting a heroic character into your family tree" (what's the word for this - you now what I mean, do you?).
    Then you should script characters for 'dying factions' with the above mention triggers or likewise and also script their deaths within a certain period of time if possible.

    ?
    cg
    Last edited by confused german; April 08, 2010 at 04:23 PM.
    "Do you want Total War?"

Page 1 of 2 12 LastLast

Posting Permissions

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