Page 1 of 1

Make civ 1 and 2 roam randomly?

Posted: Sat Sep 01, 2012 9:09 pm
by salvakiya
I am making a minigame map where I need the ability to allow civ 1 and civ 2 to roam randomly and sometimes stay in one spot... I also need to give a penalty to a player if they kill the neutral buildings/ civ's. How would I go about doing this?

Posted: Sun Sep 02, 2012 9:23 pm
by Matt
Have a look at https://github.com/OpenRA/OpenRA/blob/b ... .yaml#L375 the visceroid uses AttackWander to move around. You can disarm him by using adding JustMove to the Attackmove https://github.com/OpenRA/OpenRA/blob/b ... .yaml#L133 see the engineer for example. To give penalties I suggest to use negative bounties (killing them costs money). The bounty is calculated from the unit build cost so try making a negative value and maybe also add -GainsExperience: so that you don't get promoted for shooting civilians.

Posted: Mon Sep 03, 2012 10:15 pm
by salvakiya
Cmd. Matt wrote: Have a look at https://github.com/OpenRA/OpenRA/blob/b ... .yaml#L375 the visceroid uses AttackWander to move around. You can disarm him by using adding JustMove to the Attackmove https://github.com/OpenRA/OpenRA/blob/b ... .yaml#L133 see the engineer for example. To give penalties I suggest to use negative bounties (killing them costs money). The bounty is calculated from the unit build cost so try making a negative value and maybe also add -GainsExperience: so that you don't get promoted for shooting civilians.
Hey thanks for the help! I got everything working except for the negative bounty...

for the civ I have the following code... what is wrong with it? I assume I am placing the bounty in the wrong place though...

Code: Select all

	C1:
		Inherits: ^Infantry
		Selectable:
			Voice: CivilianMaleVoice
			Bounds: 12,17,0,-9
		Valued:
			Cost: 70
		Tooltip:
			Name: Civilian
		Health:
			HP: 20
		AttackWander:
			JustMove: True
		-GainsExperience:
		-GivesExperience:
		GivesBounty: -50
		Mobile:
			Speed: 4
		RevealsShroud:
			Range: 2
		AttackFrontal:
			PrimaryWeapon: Pistol
		ProximityCaptor:
			Types:CivilianInfantry	C1:
		Inherits: ^Infantry
		Selectable:
			Voice: CivilianMaleVoice
			Bounds: 12,17,0,-9
		Valued:
			Cost: 70
		Tooltip:
			Name: Civilian
		Health:
			HP: 20
		AttackWander:
			JustMove: True
		-GainsExperience:
		-GivesExperience:
		GivesBounty: -50
		Mobile:
			Speed: 4
		RevealsShroud:
			Range: 2
		AttackFrontal:
			PrimaryWeapon: Pistol
		ProximityCaptor:
			Types:CivilianInfantry

Posted: Tue Sep 04, 2012 6:07 pm
by Matt
The bounty is calculated by Value: Costs: so set that one negative (let's see what happens). Remove the GivesBounty line. It is already inherited from defaults.yaml and it is a boolean (true/false) value, not an integer.

Posted: Tue Sep 04, 2012 8:47 pm
by salvakiya
That worked but only when the total cash the player had remained above 0. if the player had no money and killed a civ the game would crash.


Edit:
Im no programming expert but is this due to the total cash amount being an unsigned int? and if that is the case is there a way around it?

Posted: Sun Oct 21, 2012 8:27 pm
by Matt
salvakiya wrote: That worked but only when the total cash the player had remained above 0. if the player had no money and killed a civ the game would crash.


Edit:
Im no programming expert but is this due to the total cash amount being an unsigned int? and if that is the case is there a way around it?
The game should never crash. Report it at https://github.com/OpenRA/OpenRA/issues/