Jump to content

Cheats - "wololo", player selection


Recommended Posts

I suggest replacing


case "convertunit":
for each (var ent in input.selected)
{
var cmpOwnership = Engine.QueryInterface(ent, IID_Ownership);
cmpOwnership.SetOwner(cmpPlayer.GetPlayerID());
}
break;

with


case "convertunit":
if (input.number >= cmpPlayerManager.GetNumPlayers())
return;
var playerEnt = cmpPlayerManager.GetPlayerByID(input.number);
if (playerEnt == INVALID_ENTITY)
{
var playerID = cmpPlayer.GetPlayerID();
}
else {
var playerID = input.number;
}
for each (var ent in input.selected)
{
var cmpOwnership = Engine.QueryInterface(ent, IID_Ownership);
cmpOwnership.SetOwner(playerID);
}
break;

so that you can also convert units to other players with the wololo cheat.

Edited by idanwin
Link to comment
Share on other sites

It might also be a good idea to add a defaultnumber to the data/cheats/convertUnit.json file

wololo command is possibly to do a kind of convertion if is used with button instead a input?

Working on it :-p not sure how someone like me could be able to pull it off, but I'll give it try.

Edited by idanwin
  • Like 1
Link to comment
Share on other sites

I'd forgotten how much fun it is to have priests converting units :-p (yep, just implemented it! The AI is not using it though :-( )

This is how I did it:

I added a new attack type called convert that does no damage and changes the unit ownership (all in Attack.js), when a unit has the attack type 'convert' this unit will be able to use a convert attack on enemy units. I got no clue how to give the user a button to control this though ...

EDIT:

The enemy is not using it because healers are passive, aggressive units with the attack will be used by the AI without problem.

EDIT2:

If you want to test it or fiddle with it:

http://www.mediafire.com/download/7tfb3d4bdg6fze4/bronze_(0.1.1_-_converting_healers).7z

Edited by idanwin
  • Like 1
Link to comment
Share on other sites

Hmm... Some times like do a tech to unlock abilities or attacks haha, one thing I can evade is the argument about priest rush. And no all civilization were religious fanatic or they give some importance for live after dead.

This why the math formula. The timer I like but in age of empires I the Assyrian do a foursome priest rush, that are in our minds in present days XD.

Link to comment
Share on other sites

on the Trac ticket about converrsion and capturing, I also included a patch for timer based conversion. But it's no good yet. Btw, you really want to work with Trac, as forum posts get lost in the stream. And Trac is clever enough to show all changes on top of the current code, so we see immediately what you do.

  • Like 1
Link to comment
Share on other sites

Some comments on the archive:

  • You shouldn't need to supply Cheats.js (or cheats.json) as the Cheats.js in svn should pick up the json files in cheats/.
  • You have the modified Heal.js in there (which is just Convert.js before renaming).
  • Convert.js isn't actually used as you hacked that onto Attack.js (which is ugly IMO, but if you just want the AI to use the feature it is probably the easiest way) (The proper way would be to add a new component (similar to the Convert.js you added) add a new command to Commands.js (and call that from the gui) and add some new state to UnitAI)

Link to comment
Share on other sites

Some comments on the archive:

  • You shouldn't need to supply Cheats.js (or cheats.json) as the Cheats.js in svn should pick up the json files in cheats/.
  • You have the modified Heal.js in there (which is just Convert.js before renaming).
  • Convert.js isn't actually used as you hacked that onto Attack.js (which is ugly IMO, but if you just want the AI to use the feature it is probably the easiest way) (The proper way would be to add a new component (similar to the Convert.js you added) add a new command to Commands.js (and call that from the gui) and add some new state to UnitAI)

  • Thank you, I hadn't noticed the cheats.json had been split up in the meantime.
  • I didn't know what file I had to edit for Convert.js to work (apparently Commands.js, thx) so I replaced Heal to test it and forgot to remove it afterwards...

on the Trac ticket about converrsion and capturing, I also included a patch for timer based conversion. But it's no good yet. Btw, you really want to work with Trac, as forum posts get lost in the stream. And Trac is clever enough to show all changes on top of the current code, so we see immediately what you do.

I'll try to understand how to work with it

Link to comment
Share on other sites

That is handled in gui/session/input.js. The relevant places are line 333 (checking if the action (convert in this case) is possible (done when hovering the unit)), line 532 (calling the first and what priority the action should have (eg if a unit can both heal and attack what should be done (bad example, but you should get the point))) and line 1350 (sending the command to the simulation (different script contexts, so you need some way to pass the data between those (with PostNetworkCommand being GUI->simulation and GuiInterfaceCalls mostly being simulation->GUI (as in GuiInterfaceCalls shouldn't change the simulation state (the sychronized state that is), setting the display of rallypoints would be an example)); this will result in calling ProcessCommand() in Commands.js which will then handle it on the simulation side).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...