Add Ants attacks on a map

Information and discussion for custom maps and mods.
Post Reply

Anyone want to help me on this project ? :)

- Yes
0
No votes
- No
0
No votes
- I prefer a cookie :x
0
No votes
 
Total votes: 0

Jeff560BZH
Posts: 12
Joined: Sat Dec 01, 2018 5:35 pm

Add Ants attacks on a map

Post by Jeff560BZH »

Hello.

Long time i came here.. ^^
I have a question, or i mean.. I think i have a request..

I've made some cool smart, small and big maps :D and i wish implement "Ants" on my maps with some "Hives", like the Extras missions from C&C RA..
After some bad results with my tests, i got an idea to find help here with a good person who want try to help me in this "project".. :D
I precise i have Visual Studio 2019 with Python / JSON and some other extensions if needed.
The "lua" format is complicated for me and im trying to learn how to use it 8)

PS : I hope you understand what i'm trying to say (i got a bad english.. :lol: )

Thanks for your time to read me.
Cordialy.

[*] 2 exemples of my maps here :

1st map : Image
2nd map : Image
Image

User avatar
Materianer
Posts: 199
Joined: Mon Jul 04, 2016 8:27 am

Re: Add Ants attacks on a map

Post by Materianer »

I started because of the same thing with mapcoding :lol:
Here is an example how you can make such an ant walk around and attack.
https://resource.openra.net/maps/56896

In this map i added a whole Antrace with the Anthill as a destroyable building, antqueen etc. but the code might be a bit outdated.
https://resource.openra.net/maps/41552/

Jeff560BZH
Posts: 12
Joined: Sat Dec 01, 2018 5:35 pm

Re: Add Ants attacks on a map

Post by Jeff560BZH »

Oohhh ! :eek: Nice one with the red Queens and blood :D
Sure its updates, cause lot of items are removed or replaced.. Lol.

But yes, on the form is the type of map i want to do. But i dont really know of making Lua code properly here.. :x
If you or someone want to work with me on it on one of my maps, i will be happy :D

The first map will be better :
https://resource.openra.net/maps/56790/

Cause the other one is too huge, and i think is better for scenario... xD :
https://resource.openra.net/maps/56791/

User avatar
Materianer
Posts: 199
Joined: Mon Jul 04, 2016 8:27 am

Re: Add Ants attacks on a map

Post by Materianer »

I think a good way to learn this lua stuff is to read and test other maps with lua code.
You could for example try to just copy the lua file from the first map i posted.
https://resource.openra.net/maps/56896
It should will work if you add 4 Waypoints to your map then and change the names of the waypoints to:
upperleft, upperright, downleft, downright
You will find those words in the lua file, the Waypoints are used there for the way the ants walk and where the ant spawns.

Jeff560BZH
Posts: 12
Joined: Sat Dec 01, 2018 5:35 pm

Re: Add Ants attacks on a map

Post by Jeff560BZH »

Oh, thanks. Okay ^^
But you sure it will work ? Cause you map got "Link chess status" : failed .
I have to unpack to openra file first to see that.

Thanks for your soluce :). But i continue to check for the "word keys" descriptions to code the "Lua" file :)

User avatar
Materianer
Posts: 199
Joined: Mon Jul 04, 2016 8:27 am

Re: Add Ants attacks on a map

Post by Materianer »

Yes i´m pretty sure :lol: i dont think that Luaerrors are listed there and you can use like 99% of old Luacode because luachanges are really rare.
If you have a Luacrash it doesnt crash like normal, instead you will have a Message ingame and find an Errormessage in the Lua.log

The error on my map is because of the Interior rules wich i added to the map.
No Airunits or ships needed in Rooms so i removed the Naval AI too, wich is maybe renamed in the yamlcode meanwhile, you can see the errormessage if you click on the red Lintcheck letters in resource center. ctrl F error ;)

But you only need 2 Lines for your rules.yaml to add the ants:

Code: Select all

World:
	LuaScript:
		Scripts: Brunsbuettel.lua
and of course add the luafile to your mapfolder.
by the way the ants will not come at start but at a randomtime between 0 and 180 Seconds, you can see this in the WorldLoaded function on the bottom of the file, the things in this function happen at start.

Code: Select all

Trigger.AfterDelay(DateTime.Seconds(Utils.RandomInteger(0, 180)), function()
You can just change the 180 to 5 and then it will come between 0 and 5 Seconds.

Try

Code: Select all

ActivateAnt1()
ActivateAnt1()
ActivateAnt1()
for more ants ;)

Post Reply