Jump to content

Map-wide Random AI / Neutral spawner

Recommended Posts

Following from that topic I managed to successfully create animal-like Visceroids that spawn from infantry squads only in poisonous areas and they're pretty neat, aside from the merging baby and adults I managed to get them quite similar in terms of roaming AI to Tib-sun so they sort of go everywhere, though only in a small radius.


However, my next idea was to have a completely random "Neutral" spawner, that could (at the start of the game) quickly populate the map with a specific amount of Neutral AI, like Visceroids, Maruaders and possibly even Ion Storms, (with Ion Storms preferably spawning throughout the game at random) I know you could populate maps in Worldbuilder but I really wanted a solution that could do this on every map to create a new "world" every time you play a Skirmish / Multiplayer.


A way I figured I could do it is use a spawner nugget like those on the War Factories / PAC's which spawns an invisible object that uses AnimalAIUpdate and quickly roams the map for say 2-3 seconds and then when it dies, spawns whatever you want at said location.

I'd have these spawners attached to tiberium fields (a bit wonky ik) as they're almost always there.


I don't really know if there's any other way of doing it, or if anyone's tried anything similar before, but a random map-wide spawner of just random Neutral stuff, be it Ion Storms, Visceroids, Maruaders or anything else is what I'm looking for. :P


Thanks for the help from everyone on the previous topic btw. :D

Edited by Nowaru

Share this post

Link to post

Hi mate

I was able to make viscords to spawn from inf in certain situations too and thanks to Mjjstral I also was able to add percents to the spawn, I didn't however managed to make fiends that I spawn on the map from tib field to be aggressive to all players due to the way TW and KW team system works, I only managed to make the fiends to attack you if You attack them first,

Still try to figure it out ;/

As for making things to appear on each map, aside from modding each map you can just spawn it from exisitng object in the static like tib field and set it to spawn far from it or on it depend what you want, that way it spawn the game objects on  every map

There should be some ways to spawn things in the map from lua too (or so I believe)


Edited by Egozi44

Share this post

Link to post

Yeah, I still don't understand Lua though, whether you write it inline with the XML or what you do with it lol.

Is it that stuff that's written with:



Because I've written some of that myself for a particular model to display its subobjects, but I wasn't sure how you'd use it in regards to the XML otherwise.

I'd like to have visceroids spawn around 50% of the time and I figured I could just do a simple random number check, and it looks kinda similar to Javascript imo, but I have no idea how to write it in lol.


And I kinda see what you mean, with spawning at fields, not sure how you'd give them spawn parameters, if that's even possible lol.

Share this post

Link to post

Sorry for the delay (tend to forgot old threads with my 3s memory xP)

I can help you with it if you want

Share this post

Link to post

Don't worry about it. :) I keep getting distracted with War Thunder lol.

I end up working on mod one minute, procrastinating because of a damn event the next. xD

But yeah, I could do with some help, if you don't mind; Lua just looks alien to me atm. :P

Share this post

Link to post

Know how it feel (with both cases)

In regard to how lua work on xmls, when it come to gameobjects xml for example you need to add in their behavior

<AI> </AI>, and inside them any kind of AI like the AIUpdate code, then you need to add the AILuaEventsList="UnitNameFunctions" code, from there it go to the scriptevents which afterward go to the lua "scripts" file

I'm not expert in lua myself but I know some of the basic things, we can keep it via pm if you want (at least for some of the things you wanted to do)




Edited by Egozi44

Share this post

Link to post

Sure PM's is fine, sorry about the delay. x3

I've been considering adding CABAL Eva for Marked of Kane, pretty sure I'm going insane here, but every time I play Tiberian Sun I want to implement more of the game in Kane's Wrath. lol

I've written some basic stuff with the AI thing, using the old animalAI update or whatever it is for the Visceroid, but I didn't know it was used for lua. :3


Share this post

Link to post

I just had a thought, could the lack of AI responding when spawned in a tiberium field be due to a lack of Army Definition?

I've been reading into it, and I think the reason why Civilian and Neutral AI don't do anything when they're spawned from Neutral / Civilian objects is directly down to their stance as an actual competitor.

As far as I know, the Emotion_Dissident flag seems to simply reverse the "friendship" towards the owner of the object, which is why the Visceroids work; because of the way the ownership is passed down from the dead infantry... but other stuff doesn't.


I don't know, I've been reading stuff for Battle for Middle Earth which uses Sage, as well as using the schema files. Stuff seems well documented for BFME; so its pretty useful. :P

Share this post

Link to post

I'm actually stuck on this area as well cause I want to make hostile AI that spawn from netural as well and if it not being spawned from your units it just won't do anything to the players 

Lua didn't helped me so far; setting them to spawn as creep team made it possible for them to fight back only when you attack them first,  giving them the Vis attribute made your units to auto attack them so they attack right after lol xP

But I still stuck on it, here what commiedog said about how it work on TW/KW:

"Each "player" maintains a list of teams as well as a default team value for any unit or structure not explicitly assigned to a team. Teams are primarily used by AI-controlled players to group their units, allowing for easier scripting (instead of telling each tank to attack an enemy, the AI groups the tanks into a team and only has to issue one attack order for the entire team).
C&C 3's friendliness checks primarily rely on the players in control of the units involved, but it's possible to override that for specific teams with the code I mentioned. For the Fiends to attack any of a player's units or structures, you'd have to override it for every one of a player's teams. And since teams are generated dynamically in-game (at least for faction players--the Fiends may be lumped into the team of the Tiberium field that spawned them, which would almost certainly be the default team for the neutral player), you have to add the overrides on a team-by-team basis."

We still experiment on that...

Share this post

Link to post

Bit of a necro...

But surely if we use the new AI Schemas and use the playertemplate mixed together, there should be some hacky way of getting this working.

I'm gonna give it a go anyway, it probably wont work or cause massive issues, but why not?

I can just set it to non-playable but let the Neutral AI access teams as necessary; if I'm not thinking completely dumb here. xP

Share this post

Link to post

I've build a spawner system in meta mod with lua. You can incorporate it into your mod. For an example see the meta menu spawner submenu that has a random position option to spawn any object. Initial load mechanism is as follows: playertemplate invisible start object dummy OR spellbook -> OnCreate lua event -> lua random spawn function

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.