Page 1 of 1

factions (RPG)

Posted: October 21st, 2011, 1:29 am
by wildflower
I know how to make an otherwise friendly npc attack the player, but is it possible to have an entire city become hostile if the player attack a friendly npc?

Re: factions (RPG)

Posted: October 21st, 2011, 4:22 am
by Hirato
nothing like this is being done yet, but it should be fully possible with the current framework.

At present, if you give something an attack directive, it will attack regardless of faction allegiances.
But essentially you'll have to do what I was planning to go anyway, place an update script of sorts for all critters that checks for all visible critters and their faction relationships, your code will be something like this

Code: Select all

r_select_faction (r_get_faction self) [
    r_loop_ents curmap ent [
        if (&& (r_cansee ent) (<= (r_faction_get_relation (r_get_faction actor)) 0)) [
           //attack here
        ]
    ]
]
I haven't entirely finalized everything regarding factions yet, so there will probably be some oddities, eg, creatures being friendly to others who are hostile towards them

Re: factions (RPG)

Posted: October 21st, 2011, 7:03 am
by wildflower
@Hirato
Thanks, this is exactly what I was looking for :D

btw. I haven't had any oddities so far.