Page 1 of 2

AI Code

Posted: Tue May 19, 2020 12:28 am
by HE95
Hi i'm just asking about developing or adding a new Cvar to the game, i want to find a way to the ai to give him additional cash, i tried to modify the truck by changing the cost from 500 to -5000 it works and added TRUK to ai but when you take it down the game crushes.
So the best thing is to give the extras ressources by adding an exact command: /givecashai
thanks for helping

Re: AI Code

Posted: Tue May 19, 2020 1:24 pm
by abcdefg30
The best solution would likely be adding a "CashTrickler" trait that is conditional and enabled by the "GrantConditionOnBotOwner" trait.
For example adding something like the following would give the normal AI $50 every 5 seconds:

Code: Select all

CashTrickler:
	Amount: 50
	RequiresCondition: enable-normal-ai
	Interval: 125

Re: AI Code

Posted: Thu May 21, 2020 2:21 am
by HE95
This is a great solution, i'm trying to find Mods.Common.traits for hours but nothing found, even try to execute OpenRa.Mods.Common dont know how it works, could you help me with this ? otherwise thanks for the answer

Re: AI Code

Posted: Thu May 21, 2020 7:50 pm
by abcdefg30
You'd have to add that to the code in "ai.yaml" under "Player:".

Re: AI Code

Posted: Fri May 22, 2020 10:47 am
by HE95
OpenRA engine version release-20200202
Red Alert mod version release-20200202
Date: 2020-05-22 09:46:46Z
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `System.NullReferenceException`: La référence d'objet n'est pas définie à une instance d'un objet.
à OpenRA.Mods.Common.Traits.CashTrickler.Created(Actor self)
à OpenRA.Actor.Created()
à OpenRA.Player..ctor(World world, Client client, PlayerReference pr)
à OpenRA.Mods.Common.Traits.CreateMPPlayers.OpenRA.Traits.ICreatePlayers.CreatePlayers(World w)
à OpenRA.World..ctor(ModData modData, Map map, OrderManager orderManager, WorldType type)
à OpenRA.Game.StartGame(String mapUID, WorldType type)
à OpenRA.Game.LoadShellMap()
à OpenRA.Mods.Common.LoadScreens.BlankLoadScreen.StartGame(Arguments args)
à OpenRA.Game.InitializeMod(String mod, Arguments args)
à OpenRA.Game.Initialize(Arguments args)
à OpenRA.Game.InitializeAndRun(String[] args)
à OpenRA.WindowsLauncher.RunGame(String[] args)

Re: AI Code

Posted: Fri May 22, 2020 10:49 am
by HE95
Player:
CashTrickler:
Amount: 50
RequiresCondition: enable-normal-ai
Interval: 125
ModularBot@RushAI:
Name: Rush AI
Type: rush
ModularBot@NormalAI:
Name: Normal AI
Type: normal
ModularBot@TurtleAI:
Name: Turtle AI
Type: turtle
ModularBot@NavalAI:
Name: Naval AI
Type: naval

Re: AI Code

Posted: Fri May 22, 2020 10:52 am
by HE95
Player:
CashTrickler:
Amount: 50
RequiresCondition: enable-normal-ai
Interval: 125
ModularBot@RushAI:
Name: Rush AI
Type: rush
ModularBot@NormalAI:
Name: Normal AI
Type: normal
ModularBot@TurtleAI:
Name: Turtle AI
Type: turtle
ModularBot@NavalAI:
Name: Naval AI
Type: naval

Re: AI Code

Posted: Fri May 22, 2020 10:53 am
by HE95
Player:
CashTrickler:
Amount: 50
RequiresCondition: enable-normal-ai
Interval: 125
ModularBot@RushAI:
Name: Rush AI
Type: rush
ModularBot@NormalAI:
Name: Normal AI
Type: normal
ModularBot@TurtleAI:
Name: Turtle AI
Type: turtle
ModularBot@NavalAI:
Name: Naval AI
Type: naval

Re: AI Code

Posted: Fri May 22, 2020 10:57 am
by HE95
Image

Re: AI Code

Posted: Fri May 22, 2020 10:58 am
by HE95
[img]file:///C:/Users/RAMBO%20III/Desktop/Capture.PNG[/img]

Re: AI Code

Posted: Fri May 22, 2020 10:59 am
by HE95

Code: Select all

[Player:
	CashTrickler:
		Amount: 50
		RequiresCondition: enable-rush-ai
		Interval: 125
	ModularBot@RushAI:
		Name: Rush AI
		Type: rush
	ModularBot@NormalAI:
		Name: Normal AI
		Type: normal
	ModularBot@TurtleAI:
		Name: Turtle AI
]Player:
	CashTrickler:
		Amount: 50
		RequiresCondition: enable-rush-ai
		Interval: 125
	ModularBot@RushAI:
		Name: Rush AI
		Type: rush
	ModularBot@NormalAI:
		Name: Normal AI
		Type: normal
	ModularBot@TurtleAI:
		Name: Turtle AI

Re: AI Code

Posted: Fri May 22, 2020 11:01 am
by HE95
[img][file:///C:/Users/RAMBO%20III/Desktop/Capture.PNG]

Re: AI Code

Posted: Fri May 22, 2020 11:02 am
by HE95

Code: Select all

[Player:
	CashTrickler:
		Amount: 50
		RequiresCondition: enable-rush-ai
		Interval: 125
	ModularBot@RushAI:
		Name: Rush AI
		Type: rush
	ModularBot@NormalAI:
		Name: Normal AI
		Type: normal
	ModularBot@TurtleAI:
		Name: Turtle AI

Re: AI Code

Posted: Fri May 22, 2020 4:09 pm
by abcdefg30
Odd, that shouldn't crash at all. I'll have a look at it.

Re: AI Code

Posted: Sat May 23, 2020 5:28 am
by HE95
The same issue with the last release...