I would like to develop the following feature myself if I could figure out the api and logic around the action development.I was thinking of adding a new function to the priest unit. I wish to add the ability that he pray for resources. The action will put the priest in a praying position that every 1 minute the person increase one of his resources (wood or food or metal or stone) by a defined amount.
I would love and comment about this feature, any instruction how to develop it. I am trying to figure the api and the changes I need to do using
http://trac.wildfire....com/ticket/999 since that is the implementation of heal for the priest but since no documentation on the apis is available I am getting stuck.
Priest Praying for Resources
Started by
Trumbun
, Apr 01 2012 01:51 PM
3 replies to this topic
#1
Posted 01 April 2012 - 01:51 PM
#2
Posted 01 April 2012 - 06:20 PM
Increasing the speed of gathering a resource for a amount of time would be more realistic in my opinion, rather than giving instant resources.
#3
Posted 01 April 2012 - 06:22 PM
Trumbun, on 01 April 2012 - 01:51 PM, said:
I would like to develop the following feature myself if I could figure out the api and logic around the action development.I was thinking of adding a new function to the priest unit. I wish to add the ability that he pray for resources. The action will put the priest in a praying position that every 1 minute the person increase one of his resources (wood or food or metal or stone) by a defined amount.
I would love and comment about this feature, any instruction how to develop it. I am trying to figure the api and the changes I need to do using
http://trac.wildfire....com/ticket/999 since that is the implementation of heal for the priest but since no documentation on the apis is available I am getting stuck.
I would love and comment about this feature, any instruction how to develop it. I am trying to figure the api and the changes I need to do using
http://trac.wildfire....com/ticket/999 since that is the implementation of heal for the priest but since no documentation on the apis is available I am getting stuck.
But if you want to implement this just to make yourself familiar with the code or want to make a mini-mod, this sounds like a good exercise. This is probably a good document to get acquainted with simulation architecture: http://trac.wildfire...ionArchitecture .
From quick thinking you will need to implement following things: a simulation component, unit ai functionality, gui representation and interaction between simulation and gui parts (via GuiInterface and commands).
More detailed:
Simulation part:
1. Add a simulation component like 'Priest', it can contain some settings and logic (see binaries/data/mods/public/simulation/components)
2. Add your component to some templates (see binaries/data/mods/public/simulation/templates, probably to binaries/data/mods/public/simulation/templates/template_unit_support_healer.xml), this will define which units should have this functionality
3. Pass some info from simulation scripts to gui scripts via binaries/data/mods/public/simulation/components/GuiInterface.js : GetEntityState , like:
var cmpPriest = Engine.QueryInterface(ent, IID_Priest);
if (cmpPriest)
{
ret.priest = <...>
}
4. Add a command into binaries/data/mods/public/simulation/helpers/Commands.js : ProcessCommand (this is what will be called by gui part):case "pray": <...>5. Implement UnitAI functionality (binaries/data/mods/public/simulation/components/UnitAI.js): what unit should do in the praying state (i.e. generate resources after time intervals, this will use functionality from Priest component)
Gui part:
Add a command into binaries/data/mods/public/gui/session/utility_functions.js : getEntityCommandsList , like:
if (entState.priest)
{
commands.push({
"name": "pray",
"tooltip": "Pray for resources",
"icon": "pray.png"
});
}
I'm not sure, but I think this should display a button under unit's portrait and bind click to it with sending 'pray' command into simulation part.In all these places you can look how other things around are implemented.
Alexander Olkhovskiy [ aka fcxSanya ]
Wildfire Games Programmer
E-mail: fcxsanya at wildfiregames dot com
Wildfire Games Programmer
E-mail: fcxsanya at wildfiregames dot com
#4
Posted 03 April 2012 - 06:05 AM
Thanks fcxSanya.
About the conversion in the forum I think some already suggested it for building etc.
About the conversion in the forum I think some already suggested it for building etc.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











