Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: easily placed extra civilians
New feature: easily placed extra civilians[message #344843] Sun, 03 April 2016 17:20 Go to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
At least in the stock 1.13 maps, sectors are very empty and devoid of civilians. They also don't have to say that much.
This is rather sad. Unfortunately, adding civilians to maps requires the use of the map editor. For someone not used to the editor, this is not a simple task.

For this reason, I've decided to add a new functionality that allows us to create civilians on any map we want much more easily. And while I am known to rant against the usage of LUA more than often (jsut ask the guy's in IRC ;) ), in this case, LUA scripts are the best place to do this (xml being to inflexible in this case).

There is now a new function used in Scripts/strategicmap.lua in HandleSectorTacticalEntry():
...
-- Flugente: if this sector has not yet been liberated by the player, there might be some civilian enemy personnel here
-- the idea is that these people are government employed, and won't stay around once you take the sector
-- parameters of CreateCivilian:
-- - tile where person should be created on the map
-- - civilian group they should belong to (see also CivGroupNames.xml)
-- - bodytype
-- - vest colour (-1 for random)
-- - pants colour (-1 for random)
-- - hair colour (-1 for random)
-- - skin colour (-1 for random)
-- - optional item 1 (-1 for nothing)
-- - optional item 2 (-1 for nothing)
-- - optional item 3 (-1 for nothing)
-- - optional item 4 (-1 for nothing)
	
if ( fHasEverBeenPlayerControlled == false ) then
	-- surface sectors
	if ( bSectorZ == 0 ) then
		-- central SAM
		if ( sSectorX == 8 and sSectorY == SectorY.MAP_ROW_I ) then
			CreateCivilian(16081, CivGroup.RADAR_TECHNICIAN_GROUP, Bodytype.MANCIV, Vest.GREYVEST, Pants.GREENPANTS, -1, -1, 210, 635, -1, -1)
			CreateCivilian(15443, CivGroup.RADAR_TECHNICIAN_GROUP, Bodytype.REGFEMALE, Vest.GREYVEST, Pants.GREENPANTS, -1, -1, 210, 635, -1, -1)
			CreateCivilian(10944, CivGroup.RADAR_TECHNICIAN_GROUP, Bodytype.REGMALE, Vest.GREYVEST, Pants.GREENPANTS, -1, -1, 210, 8, -1, -1)
		-- Drassen SAM
		elseif ( sSectorX == 15 and sSectorY == SectorY.MAP_ROW_D ) then
			CreateCivilian(11297, CivGroup.RADAR_TECHNICIAN_GROUP, Bodytype.MANCIV, Vest.GREYVEST, Pants.GREENPANTS, -1, -1, 210, 8, -1, -1)
...

This function allows creating a custom civilian with user-defined visuals and a few items. In my examples, I've used the idea I had here and added

  • http://i.imgur.com/BkqOotC.png
    radar technicians to SAM sites and airports
  • prison wardens to prisons (complete with gasmask, nightstick and handcuffs)
  • airport staff to airports
  • barrack staff to the Alma barracks
  • scientists to Orta
  • factory workers to factories
  • outspoken civilian supporters of the regime to Balime (you can't tell me they've all fled to Meduna)
  • http://i.imgur.com/GaDuVJg.png
    secretaries to places that seem like they'd have some.
This also includes dialogue. These new civilian groups so far don't do anything unusual (I nevertheless list them in the code, in case we later want special code for them).

In the above example, the civilians are only created when the player has never liberated this sector before - whether you use that is up to you.

This feature can be turned on and off via ALLOW_EXTRA_CIVILIANS in Ja2_Options.ini and is set to be off by default.

This is savegame compatible.

This has been added to the trunk in r8132 & GameDir r2311. Using the new exe without the new GameDir does not cause anything dangerous, for once. It just makes me sad.

[Updated on: Sun, 03 April 2016 17:26]




I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #344844 is a reply to message #344843] Sun, 03 April 2016 17:59 Go to previous messageGo to next message
smeagol is currently offline smeagol

 
Messages:2705
Registered:June 2008
Location: Bremen, Germany
Nice!

Report message to a moderator

Lieutenant

Re: New feature: easily placed extra civilians[message #344845 is a reply to message #344843] Sun, 03 April 2016 19:27 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Sometimes I hate you (J/K cheeky ). Just when I had settled on 8131 as the release to upgrade Arulco Revisited to, you come up with this extremely useful feature...

One question: when you write "won't stay around once you take the sector", that means that the civilians will disappear once the current sector is unloaded?



Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344847 is a reply to message #344845] Sun, 03 April 2016 19:45 Go to previous messageGo to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
This is purely because of
...
if ( fHasEverBeenPlayerControlled == false ) then
...

which is a new variable I added to the script. For these civilian types I added here, it seemed reasonable to only have them spawn if the player has never taken this sector. It would make no sense if prison wardens would still appear in the prison if the player has long taken it, no? In the above case, they will not spawn again if we take the sector.

You can, of course, use the functions without that particular check (or add any lua checks you like). HandleSectorTacticalEntry is called every time we enter a sector.

[Updated on: Sun, 03 April 2016 19:46]




I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #344848 is a reply to message #344845] Sun, 03 April 2016 19:50 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Quote:
Sometimes I hate you (J/K cheeky ). Just when I had settled on 8131 as the release to upgrade Arulco Revisited to, you come up with this extremely useful feature...


It's futile to try and keep a mod at the newest feature release because of this. Stable releases may be a pain to get together, but modders need a stable platform to build on or they will be forever changing and re-changing their modifications to incorporate new features. Every time I figure it's safe to bring AV up to the newest release . . . a new, untested feature comes along that makes a major change.

Report message to a moderator

Sergeant Major
Re: New feature: easily placed extra civilians[message #344849 is a reply to message #344848] Sun, 03 April 2016 22:04 Go to previous messageGo to next message
tais

 
Messages:656
Registered:February 2008
Location: NL
you dont HAVE to jump on the newest features once they're released..
even though they might be cool and all you should just keep your own schedule, it's not that often that something mod breaking is introduced
Just pick a version that you want the mod to work on and continue from there, all that could happen in newer versions is some red lines during startup.



Discord

Report message to a moderator

First Sergeant

Re: New feature: easily placed extra civilians[message #344850 is a reply to message #344847] Sun, 03 April 2016 22:30 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Flugente wrote on Sun, 03 April 2016 18:45
This is purely because of
...
if ( fHasEverBeenPlayerControlled == false ) then
...

which is a new variable I added to the script. For these civilian types I added here, it seemed reasonable to only have them spawn if the player has never taken this sector. It would make no sense if prison wardens would still appear in the prison if the player has long taken it, no? In the above case, they will not spawn again if we take the sector.

You can, of course, use the functions without that particular check (or add any lua checks you like). HandleSectorTacticalEntry is called every time we enter a sector.


I haven't dug into spawning of civilians, so this might be a dumb question. If so, I apologize in advance. Is "spawning" of civilians

1) a unique occurrence per sector, happening exactly once when we first enter it. From then on, numbers, appearance, equipment etc. are stored, and when we reenter the sector, the same civs as before are there.
For example, when I get into a fight with 20 of KingPin's goons, kill 10 of them before I retreat, only those 10 I didn't kill are present when I reenter the sector

or

2) occurring whenever we enter a sector (subject to any hard-coded/scripted limits like ), and once we leave the sector, all civilians are forgotten, to be created anew from scratch when we reenter the sector? So in the example above, when I reenter the sector, there a 20 goons again.


After some thinking about the new possibilities this feature opens up, a couple of additional questions popped up in my head.


When setting civilians with the map editor, we can either select relative attribute levels (bad/poor/average/good/great) or - with detailed placement - select exact attributes. Would it be possible to add something like that to your feature?

Could you extend the tile value to a list of tiles, one of which is selected randomly? Just to enhance replayability...

Would it be possible to set a civgroup to hostile via script (something analogous to KingPin alarm, but without needing a trigger)?

Is it possible to query the game facts listed in quests.h via LUA?

Background to these questions: with the newly given possibility to place civilians dynamically, some consequences similar to those talked about here could be scripted. Some examples: once the player has taken over the first mine, Ricci Mining might decide to hire some guards to protect their remaining assets. When the Riccis at Balime are harmed, more direct measures could be taken. When the Chalice is stolen, Kingpin could place some of his gang at Yanni's hut to hedge his bets, when the Bloodcat quest is done, a PETA strike team might come calling...




Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344853 is a reply to message #344850] Sun, 03 April 2016 22:46 Go to previous messageGo to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
It's behaviour 2, actually. If you don't want these guys to respawn, you have to decide that by altering the lua script (like checking for a face etc.).

If you want random locations, you can simply choose one at random, the lua script can roll a dice:
from GameInit.lua:

function InitNPCs()

	-- Add the pilot at a random location!
	if is_networked == 0 then
		o = math.random(1, 4)
		if o == 1 then


Attribute levels are only really relevant for hostiles. Take a look at the same function in HandleSectorTacticalEntry(), a few lines above I use CreateArmedCivilain(..), which creates goons:
...
CreateArmedCivilain(CivGroup.BOUNTYHUNTER_CIV_GROUP, SoldierClass.SOLDIER_CLASS_ARMY, 			13032, hostile)
...

In this case, it is used to set up (possibly) hostile bounty hunters I added for a new quest where I tried to externalize as much of that quest as possible.

As for making a group hostile, that might already be in lua, not sure.

You can check game facts like this:
...
if ( (CheckFact( Facts.FACT_BOUNTYHUNTER_KILLED_1, 0 ) == true)  ) then
...

[Updated on: Sun, 03 April 2016 22:51]




I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #344855 is a reply to message #344849] Sun, 03 April 2016 23:36 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Quote:
you dont HAVE to jump on the newest features once they're released..
even though they might be cool and all you should just keep your own schedule, it's not that often that something mod breaking is introduced
Just pick a version that you want the mod to work on and continue from there, all that could happen in newer versions is some red lines during startup.


Yes, I realize I don't have to jump to the newest features . . . unfortunately, not all that can happen is inconsequential error messages on startup -- though that is highly amateurish to have happen. There have been new executables since AV has started, and many XML tags have been moved about. While AV works on the early 2015 versions of 1.13, it doesn't work on newer versions. I'm not going to spend my time every other month re-working and playing catch-up. Just sayin'.

I love what Flugente is doing, but I am very grateful to Sevenfm for bringing a lot of the fixes to 7609, and for improving the AI tremendously in 7609.

Report message to a moderator

Sergeant Major
Re: New feature: easily placed extra civilians[message #344856 is a reply to message #344853] Sun, 03 April 2016 23:56 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Extremely useful information re: spawning behaviour, random locations, attributes, creating armed civilians and and checking game facts. Thanks a lot!

Edit: since later edits don't show up as unread and tend not to be seen, I'll rather write an additional post

Flugente wrote on Sun, 03 April 2016 21:46

As for making a group hostile, that might already be in lua, not sure.


I looked a bit more deeply, and it seems like that's true

from ExplosionControl.lua:
SetCivGroupHostile( Group.KINGPIN_CIV_GROUP , Civ_status.CIV_GROUP_HOSTILE )
		
for iLoop = GetTacticalStatusFirstID(Team.CIV_TEAM),GetTacticalStatusLastID(Team.CIV_TEAM) do
	if ( CheckMercPtrsInSector (iLoop) == true and CheckMercPtrsInActive(iLoop) == true and CheckMercPtrsInCivilianGroup (iLoop) ==
           Group.KINGPIN_CIV_GROUP ) then
		for aimLoop=GetTacticalStatusFirstID(Team.OUR_TEAM),GetTacticalStatusLastID(Team.OUR_TEAM) do
			if ( CheckMercPtrsID1SeenID2(iLoop,aimLoop) == SEEN_CURRENTLY ) then
				MakeMercPtrsHostile( iLoop )
			end
		end	
	end	
end
 
if ( CheckCombatMode == false ) then
	EnterTeamCombatMode(Team.CIV_TEAM)
end	



[Updated on: Tue, 05 April 2016 09:51]




Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344871 is a reply to message #344853] Tue, 05 April 2016 09:53 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Flugente wrote on Sun, 03 April 2016 21:46

Attribute levels are only really relevant for hostiles. Take a look at the same function in HandleSectorTacticalEntry(), a few lines above I use CreateArmedCivilain(..), which creates goons:
...
CreateArmedCivilain(CivGroup.BOUNTYHUNTER_CIV_GROUP, SoldierClass.SOLDIER_CLASS_ARMY, 			13032, hostile)
...

In this case, it is used to set up (possibly) hostile bounty hunters I added for a new quest where I tried to externalize as much of that quest as possible.


After thinking about it a bit more, in my opinion it could be useful to combine elements of CreateArmedCivilain(..) and CreateCivilian(..). The one gives us control over equipment and attribute levels and hostility, but the other gives us much finer control over appearance and specific items.
I would love to be able to create a hostile armed civilian with red hair, pink skin, wearing blue pants and a red shirt that definitely carries an NVG and a sniper rifle, for example.

Don't think I'm ungrateful, it's just that any of your additions opens up so many more possibilities ;)



Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344872 is a reply to message #344871] Tue, 05 April 2016 14:07 Go to previous messageGo to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
Hmm. I guess I could expand both functions. Items are somewhat of a problem though - I currently create armed civilian as soldiers, which takes care of their equipment. Having custom items override that requires a lot of additional stuff (deleting preset items depending on what custom items are set,taking care of ammo, attachments, all this with regard to the progress values...).

Additionally, it seems to me that huge problem any modder would have with lua is that they cannot store any state variables. There are the games facts, which we access with CheckFact() and SetFact(), but these are hardcoded, and modders only know those that coders deemed intersting enough to put them into the script. Theoretically, a modder can store things (like whether they spawned someone somewhere) in there, but as you don't know without code knowledge wwhich facts exist and what they are used for, that's a recipe for disaster.

Perhaps it would be an idea to create, say, an array of 1000 integers that are solely used as a modder-administered 'memory' for lua purposes? That way, you could, say, remember whether you spawned, say, a custom armed civilian bounty hunter. You would then know whether to spawn him again or not somewhere...
...though the drawback is that currently, you have no way in lua to know whether a specific enemy dies (you also have no way to get the specific ID of someone). All requires additional code interfaces.

Hmpf.

I guess what I try to say is: I am aware that modders would like to be able to have better interaction with lua, but this requires a lot more work on the coding site of things, as you have to create interfaces for every function. Additionally, as we cannot debug lua, any stuff a modder does in there becomes so much harder to test and check for errors.



I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #344874 is a reply to message #344872] Tue, 05 April 2016 17:02 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Thanks for looking into this.

- Items: I'm not sure how intelligent the AI actually is. When we just add an item w/o deleting preset stuff, would the AI make use of it? E.g., when an ArmedCivilain is equipped with an MP5 (from being created as a type of soldier) , and gets an additional G3 allocated via the same process as in CreateCivilian(), would the AI use the G3 if a target is outside MP5 range? Then we could just stuff up to 4 additional items into the civilians inventory. Of course the modder will have to take care of any needed ammo etc.

- state variables: all very true, and such an array as you mentioned would indeed be a valuable addition for a couple of mini-quests. I would flat-out refuse to store my own custom facts somewhere in "game-owned" variables, way to many ways to screw up the game... Though I could also write some state info to a text file via LUA, IIRC.
Not knowing if a certain civilian is dead/was already encountered/etc or not might indeed make some quest ideas impossible, but I still have a couple in mind I think I could do without. For example, accept that certain civilians spawn only once (controlled via your array idea), and the player gets just this one chance to kill^h^h^h^h interact with them. Or have one "trigger" named NPC, and as long as he lives, his henchmen re-spawn.

- debugging: that will indeed be a problem, creating false bug reports. At the moment I have no idea to get around that






Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344889 is a reply to message #344874] Tue, 05 April 2016 23:50 Go to previous messageGo to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
The AI would sometimes use it. It does check whether it has several guns which one to use (afaik), but this would not work on armour. Additionally, a modder might want to explicitly have an enemy use a specific item (like, say, the leader of a criminal gang using a custom-set golden desert eagle). Without controlling the entire inventory, this might not happen (so on, say, higher progress values, the enemy might get spawned with a MG3 and use that, which is reasonable gamewise but not what the modder intended).

If I recall, the trigger NPC issue was (still is?) used in many mods. Modders found out that all civs respawned in a map if all had been killed. That's why on a few maps where you are supposed to battle enemy civilians, there is a cow stashed away at the side lines - cows are on the civilian team, and nobody is likely to harm them. So only when you killed the cow did the enemies rise again ;)



I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #344905 is a reply to message #344889] Wed, 06 April 2016 16:16 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Flugente wrote on Tue, 05 April 2016 22:50
The AI would sometimes use it. It does check whether it has several guns which one to use (afaik), but this would not work on armour. Additionally, a modder might want to explicitly have an enemy use a specific item (like, say, the leader of a criminal gang using a custom-set golden desert eagle). Without controlling the entire inventory, this might not happen (so on, say, higher progress values, the enemy might get spawned with a MG3 and use that, which is reasonable gamewise but not what the modder intended).


Well, controlling the entire inventory would be the luxury version, but also slight overkill, IMHO. I would be more than satisfied by CreateArmedCivilain(..) extended by appearance (hair, skin, dress) and possibility to add some items without replacing auto-generated ones, and on the other hand, CreateCivilian(..) extended by the hostility setting and maybe a relative skill level.

A modder-administered array of integers would be icing on the cake. My original idea of writing to/reading from an external text file via LUA creates a nightmare of synchronization if save/reload is taken into account.


Quote:
So only when you killed the cow did the enemies rise again ;)
So cows are responsible for holding back the zombie apocalypse? cheeky



Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344915 is a reply to message #344905] Thu, 07 April 2016 01:06 Go to previous messageGo to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
Yeah, I was wondering how your idea of external text files was going to work with savegames ;)

Yep, the cows are holding back the undead. Any civilian would do, but apparently, cows worked best. I assume this is because the average gamer is less likely to shoot a cow than kids/cripples in wheelchairs/women in miniskirts. suprised



I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #344924 is a reply to message #344915] Thu, 07 April 2016 14:44 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
Flugente wrote on Thu, 07 April 2016 00:06
Yeah, I was wondering how your idea of external text files was going to work with savegames ;)


Simple: Extreme Ironman mode. Saving is completely disabled ;)


Quote:
Yep, the cows are holding back the undead. Any civilian would do, but apparently, cows worked best. I assume this is because the average gamer is less likely to shoot a cow than kids/cripples in wheelchairs/women in miniskirts. suprised


Aren't we a happy, mentally healthy bunch of people?

Actually, I've found that placing a civilian inside a cliff -where available- works best. Even the worst serial killer type of gamer simply can't kill him.



Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #344930 is a reply to message #344924] Thu, 07 April 2016 19:34 Go to previous messageGo to next message
RunAwayScientist is currently offline RunAwayScientist

 
Messages:84
Registered:September 2001
CVB wrote on Thu, 07 April 2016 11:44

Actually, I've found that placing a civilian inside a cliff -where available- works best. Even the worst serial killer type of gamer simply can't kill him.




Mortars. Lots of mortars. On-map mortar teams. Off-map mortar teams. No civy is safe. We're going to do the village, the whole freakin' village.

Report message to a moderator

Corporal 1st Class
Re: New feature: easily placed extra civilians[message #344931 is a reply to message #344889] Thu, 07 April 2016 19:49 Go to previous messageGo to next message
Wil473

 
Messages:2815
Registered:September 2004
Location: Canada
Flugente wrote on Tue, 05 April 2016 15:50
If I recall, the trigger NPC issue was (still is?) used in many mods. Modders found out that all civs respawned in a map if all had been killed. That's why on a few maps where you are supposed to battle enemy civilians, there is a cow stashed away at the side lines - cows are on the civilian team, and nobody is likely to harm them. So only when you killed the cow did the enemies rise again ;)


Yup, a few of the old UC maps had to be edited solely for the purpose of adding a cow...



More weapon features and upgrade options, via (mis)use of v1.13 for vanilla Arulco, Dedrianna Lives! and Urban Chaos campaigns.

Report message to a moderator

Lieutenant

Re: New feature: easily placed extra civilians[message #345013 is a reply to message #344931] Mon, 11 April 2016 21:02 Go to previous messageGo to next message
CVB is currently offline CVB

 
Messages:129
Registered:September 2014
Location: Berlin
@Flugente: is it correct that the new groups (Secretaries, Radar technicians etc.) are not listed in CivGroupNames.xml?


Peace is a purely theoretical state of affairs whose existence we deduce because there have been intervals between wars.
J. Pournelle

Report message to a moderator

Sergeant
Re: New feature: easily placed extra civilians[message #345014 is a reply to message #345013] Mon, 11 April 2016 21:13 Go to previous messageGo to next message
Flugente

 
Messages:3507
Registered:April 2009
Location: Germany
Eh? No, they have their own entries, just like all other groups.

Edit: Or should have, if I had committed them. And hadn't overwritten the changes later on in my xml-editor adventures. Hmpf.

Edit2: Proper file committed in GameDir r2313. For the record, these are the currently hardcoded civ groups:
NON_CIV_GROUP = 0,
REBEL_CIV_GROUP,
KINGPIN_CIV_GROUP,
SANMONA_ARMS_GROUP,
ANGELS_GROUP,
BEGGARS_CIV_GROUP,
TOURISTS_CIV_GROUP,
ALMA_MILITARY_CIV_GROUP,
DOCTORS_CIV_GROUP,
COUPLE1_CIV_GROUP,
HICKS_CIV_GROUP,
WARDEN_CIV_GROUP,
JUNKYARD_CIV_GROUP,
FACTORY_KIDS_GROUP,
QUEENS_CIV_GROUP,
UNNAMED_CIV_GROUP_15,
UNNAMED_CIV_GROUP_16,
UNNAMED_CIV_GROUP_17,
UNNAMED_CIV_GROUP_18,
UNNAMED_CIV_GROUP_19,
ASSASSIN_CIV_GROUP,	// Flugente: enemy assassins belong to this group
POW_PRISON_CIV_GROUP,	// Flugente: prisoners of war the player caught are in this group
UNNAMED_CIV_GROUP_22,
UNNAMED_CIV_GROUP_23,
VOLUNTEER_CIV_GROUP,	// Flugente: civilians that the player recruited
BOUNTYHUNTER_CIV_GROUP,	// Flugente: hostile bounty hunters
DOWNEDPILOT_CIV_GROUP,	// Flugente: downed pilots
SCIENTIST_GROUP,	// Flugente: enemy civilian personnel
RADAR_TECHNICIAN_GROUP,
AIRPORT_STAFF_GROUP,
BARRACK_STAFF_GROUP,
FACTORY_GROUP,
ADMINISTRATIVE_STAFF_GROUP,
LOYAL_CIV_GROUP,		// civil population deeply loyal to the queen
UNNAMED_CIV_GROUP_34,
UNNAMED_CIV_GROUP_35,
...
UNNAMED_CIV_GROUP_254,
NUM_CIV_GROUPS
There are a few holes in there (like UNNAMED_CIV_GROUP_22) which are mostly for civ groups in important mods. I think at some point I asked a few modders whether I should leave some open, which I did there, so they didn't have to reorder all civvies.

Nevertheless it is a very smart idea to not use groups near those I recently introduced, but to go for higher numbers. I never know when I add might add some more civ groups ;)

[Updated on: Mon, 11 April 2016 21:39]




I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.

Report message to a moderator

Captain

Re: New feature: easily placed extra civilians[message #345527 is a reply to message #345014] Sun, 15 May 2016 20:17 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Marvelous!

EDIT: This was supposed to be for the new merchants (Marvelous!) . . . but somehow the forum put it here . . .

[Updated on: Sun, 15 May 2016 20:20]

Report message to a moderator

Sergeant Major
Re: New feature: easily placed extra civilians[message #345528 is a reply to message #345527] Sun, 15 May 2016 21:35 Go to previous messageGo to next message
Slax is currently offline Slax

 
Messages:1410
Registered:July 2006
Location: People riding polar bears...
Wonderful indeed! Less need to wait for Mr. snack vendor to replenish his supplies.
Now I'm wondering if town influence/morale is going to come into play.

Town hates you =

Town's okay with you = Plain ol' inventory.

Town loves you = You get the good stuff.

Something like that.



1.13: Install JA2, unpack latest, play.
AIMNAS: Complete 1.13 installation, Download ZIP and unpack, play.

Report message to a moderator

Sergeant Major
Re: New feature: easily placed extra civilians[message #357342 is a reply to message #344843] Sun, 05 May 2019 18:56 Go to previous messageGo to next message
Kitty

 
Messages:473
Registered:October 2017
Location: Germany
Is there a way to place Zombies via scripts? createzombie instead of createcivilian or createarmedcivilian?

Since we have Zombie Raids, thought this might be possible.

I'm thinking about something like an abandoned army basement with Zombies roaming arround. Or adding two in cells in Orta, hinting on army experiments that gone wrong. Gory furniture and terrain is allready there, so setting should be possible. And since we have PCs and FileCabinets it also should be possible to write a story on them that give an explanation even for those not playing with Zombies. I don't intend to do a outright zombie-invasion, but giving a little explanation where they actually come from.

So, is this possible at all? And if so, what will be the command to create them? Or is it just the bodytype to change? If the later, what is the number of zombie bodytype?

Thanks.

[Updated on: Sun, 05 May 2019 19:01]




How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: New feature: easily placed extra civilians[message #357343 is a reply to message #344856] Sun, 05 May 2019 19:11 Go to previous messageGo to next message
Kitty

 
Messages:473
Registered:October 2017
Location: Germany
CVB wrote on Sun, 03 April 2016 23:56
...

SetCivGroupHostile( Group.KINGPIN_CIV_GROUP , Civ_status.CIV_GROUP_HOSTILE )

...
Made a new action item triggering this (changed group name) and put them arround Omerta landing zone with trap-level 20. Until now this seems to work, but needs more testing on my side.

Another way was to create an armed and hostile civilian via script that belongs to the same group and this one will start the battle. Afterwards the rest went hostile too. But not sure if this will last. I remember having attacked smugglers in AR in one sector and all was cool when I met the next ones a few sectors away.


Edit: Ok, meanwhile I read and faced they will spawn endless this way alone. Added a cow as suggested elsewhere to fix this.

[Updated on: Mon, 03 June 2019 00:49]




How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: New feature: easily placed extra civilians[message #357453 is a reply to message #344853] Wed, 29 May 2019 18:04 Go to previous messageGo to next message
netrunner is currently offline netrunner

 
Messages:15
Registered:March 2019
Flugente wrote on Sun, 03 April 2016 22:46
It's behaviour 2, actually. If you don't want these guys to respawn, you have to decide that by altering the lua script (like checking for a face etc.).

If you want random locations, you can simply choose one at random, the lua script can roll a dice:
from GameInit.lua:

function InitNPCs()

	-- Add the pilot at a random location!
	if is_networked == 0 then
		o = math.random(1, 4)
		if o == 1 then
is there any way to check if a grid is occupied? I am trying to spawn some mobs alongside the kingpin assassins when I do by random location some of them dont spawn, I figured is because they are set to spawn in a occupied grid but the createarmedcivilian function doesnt return anything.

Report message to a moderator

Private
Re: New feature: easily placed extra civilians[message #357484 is a reply to message #344843] Mon, 03 June 2019 00:47 Go to previous messageGo to next message
Kitty

 
Messages:473
Registered:October 2017
Location: Germany
It seems that script-placed civilians in basements (e.g. Tixa warden, Orta factory worker) didn't show up the first time I enter those basements. I have to leave once and when I return for the second time they show up and are gone the third time I enter as if the lua-script is reacting one turn too late. Is this true for anybody else? Or some strange behaviour on my side only?


How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: New feature: easily placed extra civilians[message #357485 is a reply to message #357453] Mon, 03 June 2019 01:01 Go to previous messageGo to next message
Kitty

 
Messages:473
Registered:October 2017
Location: Germany
netrunner wrote on Wed, 29 May 2019 18:04

is there any way to check if a grid is occupied? I am trying to spawn some mobs alongside the kingpin assassins when I do by random location some of them dont spawn, I figured is because they are set to spawn in a occupied grid but the createarmedcivilian function doesnt return anything.
the gridnumbers for the bountyhunters and other script-placed civilians are written in the lua-scripts (the number in the brackets, look at flugentes description). as far as I know, you have to check inside the map-editor if a grid-number is free (also to make sure there is no wall, deep water, etc.) . in the "docs"-folder of your JA2 1.13 installation there are two guide for map-editor. when in map-editor and moving mouse, you should see grid-number at the bottom-left of map-editor (picture of this in those guides)
I wouldn't add those armedCivilains of yours at the same place in scripts the bountyhunters of flugentes quest. Try to add the lines needed where the other civilains are.

o = math.random(1, 4)
if o == 1 then CreateArmedCivilain(CivGroup.YOUR_GROUP_GROUP, SoldierClass.SOLDIER_CLASS_ARMY, 15555, hostile )
if o == 2 Then CreateArmedCivilain(CivGroup.YOUR_GROUP_GROUP, SoldierClass.SOLDIER_CLASS_ARMY, 16666, hostile )
.
.
.

Something like this . 15555 and 16666 in the example are gridnumbers I just made up. The "Your Group" has to be defined in CivGroupNames.xml and also has to be added into civGroups in the lua-script, at least, that's what I have done.
Instead of the Bountyhunters rather look at how those blackmarket-guys are added or the d5 merchants whose spawning depends on kingpin to get the idea. If you still want to change bountyhunters look into flugentes description of the bountyhunter-quest (somewhere here under new features), there you'll find details on what he has done and which scripts, xmls are to be change (if I remember correctly, at least quest.lua had also stuff related to this).

I hope this isn't confusing more. Better start with reading flugentes description.

[Updated on: Mon, 03 June 2019 01:33]




How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: New feature: easily placed extra civilians[message #357486 is a reply to message #357485] Mon, 03 June 2019 02:27 Go to previous messageGo to next message
netrunner is currently offline netrunner

 
Messages:15
Registered:March 2019
I did, and I know about the grids in the editor, I wanted to avoid opening the editor to place mobs in sectors without water.
This is what I was trying to achieve:
function addMobs ( x , q)
	if (CheckMercIsDead ( Profil.KINGPIN ) == false) then
		if q == 0 or q == nil then
			q = 24
		end
		for i=1, q do
			--CreateArmedCivilain(CivGroup.KINGPIN_CIV_GROUP, SoldierClass.SOLDIER_CLASS_ELITE, math.random(1, 25000), 0)
			CreateArmedCivilain(CivGroup.KINGPIN_CIV_GROUP, SoldierClass.SOLDIER_CLASS_ELITE, x, (CheckFact( Facts.FACT_KINGPIN_IS_ENEMY, 0 )))
		end
	end
end
if the function CreateArmedCivilain returned something saying that it was successfully created so I could just make sure that all mobs were in the sector, I know that there is the civGroup stuff and the civilians cap per sector in the ini config too, but thanks for trying to help anyway.

Report message to a moderator

Private
Re: New feature: easily placed extra civilians[message #357487 is a reply to message #357486] Mon, 03 June 2019 06:46 Go to previous message
Kitty

 
Messages:473
Registered:October 2017
Location: Germany
not sure , when it comes to actually coding, I'm out. I've no clue how to add functions I haven't seen in lua-scripts before. I'm sorry not being more helpful. Your idea seems interestening, hope someone more capable can help.


How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Previous Topic: New feature: combat jeeps
Next Topic: Ancient feature: sexism, racism, cursing the french and other human relations
Goto Forum:
  


Current Time: Mon Dec 02 07:06:29 GMT+2 2024

Total time taken to generate the page: 0.01866 seconds