Stan` Posted June 2 Report Share Posted June 2 Use as much pure white as you can for the texture 2 Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 2 Report Share Posted June 2 I also tried to experiment with the add blending for particle but all I managed to get was a glow Quote Link to comment Share on other sites More sharing options...
Allan Posted June 2 Author Report Share Posted June 2 (edited) I have a great result with these ! If you want to try Particle file : <?xml version="1.0" encoding="utf-8"?> <particles> <texture>art/textures/particles/red_lightning.png</texture> <blend mode="over"/> <constant name="emissionrate" value="250.0"/> <uniform name="lifetime" min="0.1" max="1.0"/> <uniform name="angle" min="-3.14" max="3.14"/> <uniform name="velocity.x" min="-5.0" max="5.0"/> <uniform name="velocity.y" min="-5.0" max="5.0"/> <uniform name="velocity.z" min="-5.0" max="5.0"/> <uniform name="size" min="1.0" max="8.0"/> <constant name="size.growthRate" value="25.0"/> <expr name="color.r" from="colorr" mul="1.0" max="1.0"/> <expr name="color.g" from="colorg" mul="1.0" max="1.0"/> <expr name="color.b" from="colorb" mul="1.0" max="1.0"/> </particles> Noticed that I named it red, I have to rename all of these files The texture is right down here Edited June 2 by Allan Quote Link to comment Share on other sites More sharing options...
Allan Posted June 2 Author Report Share Posted June 2 (edited) There's still a problem : When I start building a new building with particles, the color is not updated. I warned the UpdateColor function and the values are changing good but the particles are not getting the color of the player And when I change the diplomacy color with the button on the minimap, the particle color stay as the first color of the player, surecly because I have to call the UpdateColor function here Edited June 2 by Allan Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 2 Report Share Posted June 2 That's because the foundation actor doesn't take it into account You have to change https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/foundation.xml probably by adding <ParticlePlayerColor merge=""/> Yeah we probably need a hook for the diplomacy color thingy, I'm not sure whether it sends an event message or not Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 (edited) I changed the file that u said + the special/filter/construction.xml and nothing changed, the color is not applied to the particle, in construction preview and when it's constructed If I put the OnUpdate function, I clearly see that the color is updated after the construction, but I still don't have it on preview Edited June 3 by Allan Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 I did put the same thing in preview.xml and I see the particle color on preview, but not when it's constructed Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 For the diplomacy color https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js#L903 you might need to add the IID_ParticlePlayerColor to that function (Create a file with just that function that will be called after the actual one) GuiInterface.prototype.UpdateDisplayedPlayerColors = function(player, data) { let updateEntityColor = (iids, entities) => { for (let ent of entities) for (let iid of iids) { let cmp = Engine.QueryInterface(ent, iid); if (cmp) cmp.UpdateColor(); } }; let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); let numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers(); for (let i = 1; i < numPlayers; ++i) { const cmpDiplomacy = QueryPlayerIDInterface(i, IID_Diplomacy); if (!cmpDiplomacy) continue; QueryPlayerIDInterface(i, IID_Player).SetDisplayDiplomacyColor(data.displayDiplomacyColors); if (data.displayDiplomacyColors) cmpDiplomacy.SetDiplomacyColor(data.displayedPlayerColors[i]); updateEntityColor(data.showAllStatusBars && (i == player || player == -1) ? [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_StatusBars] : [IID_Minimap, IID_RangeOverlayRenderer, IID_RallyPointRenderer, IID_ParticlePlayerColor], cmpRangeManager.GetEntitiesByPlayer(i)); } updateEntityColor([IID_Selectable, IID_StatusBars], data.selected); Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager).UpdateColors(); }; 7 minutes ago, Allan said: but not when it's constructed When it's being constructed, or after it's been constructed ? Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 (edited) 4 minutes ago, Stan` said: When it's being constructed, or after it's been constructed ? I just see the good color on preview, not when I start the construction and not when it's constructed + It seems like the only building concerned by the good preview is my wall_tower, the other building doesn't have the good color on preview Edited June 3 by Allan Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 2 minutes ago, Allan said: he other building doesn't have the good color on preview Does the other building have ParticlePlayerColor in its template ? 1 Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 1 minute ago, Stan` said: Does the other building have ParticlePlayerColor in its template ? Yep, that's why it's strange Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 Does it call it with a different color onupdate and the first time it's called ? Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 Nope same color called on preview, when I start the construction by left-clicking, when the construction begin and when it's constructed. 16 minutes ago, Stan` said: (Create a file with just that function that will be called after the actual one) What do you mean when you say this ? Because we actually use GuiInterface.js in our project so I don't know how to rename the file. So I added the IID_ParticlePlayerColor to the function in the basic .js file and it's not changing the color of the partcile when I change diplomacy color. Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 (edited) Another starge thing is when the construction of the wall_tower is finished, the particle is grey (bad color) but when I change the diplomacy color from green to blue, the particle change to green Same with the other building which was "not working" Edited June 3 by Allan Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 56 minutes ago, Allan said: Nope same color called on preview, when I start the construction by left-clicking, when the construction begin and when it's constructed. What do you mean when you say this ? Because we actually use GuiInterface.js in our project so I don't know how to rename the file. So I added the IID_ParticlePlayerColor to the function in the basic .js file and it's not changing the color of the partcile when I change diplomacy color. In order to make mods more maintenable, we recommend users only override functions they touch rather than the whole files. You would usually have a file named ~GuiInterface.js with only the modified functions. 53 minutes ago, Allan said: Another starge thing is when the construction of the wall_tower is finished, the particle is grey (bad color) but when I change the diplomacy color from green to blue, the particle change to green Same with the other building which was "not working" After the Guiinterface change ? Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 3 minutes ago, Stan` said: In order to make mods more maintenable, we recommend users only override functions they touch rather than the whole files. You would usually have a file named ~GuiInterface.js with only the modified functions That makes sense yes 4 minutes ago, Stan` said: After the Guiinterface change ? Yep Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 The Guinterface forces a reload of the color, a bit like the on update That's why the color is changing. I'm wondering if we don't switch the color too early, causing the gaia color to be taken... Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 Maybe we have to determine the color when the construction is finished, but how ? Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 Well first, you have to figure out when the code is called and with what params Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 Ok so : When I start the game with two different players I have these parameters : red : 0.33 etc is the green one (me) red : 0.58 etc is the blue one (petra) When I click on a building to build it (preview) I have these and the building has the good particle color (green) : The same appears when the building starts being constructed and at the end of the construction, but the color is gaia when it finishes the construction. When I change the diplomacy color, only one UpdateColor is being done, and the green color appears, even if i'm in the blue team Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 I don't understand how the gaia color is being put in the particle, it seems like the code is working at every moment of the construction of the building so I don't see how to solve the problem Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 6 minutes ago, Allan said: I don't understand how the gaia color is being put in the particle, it seems like the code is working at every moment of the construction of the building so I don't see how to solve the problem Well it's possible the owner isn't set when we set the color, and so it sets gaia instead of something else. Although from your logs it looks like the color is correct Quote Link to comment Share on other sites More sharing options...
Allan Posted June 3 Author Report Share Posted June 3 (edited) I tested this quickly and it didn't work, obviously UpdateColor() { warn("UpdateColor"); let cmpVisual = Engine.QueryInterface(this.entity, IID_Visual); if (!cmpVisual) return; const player = cmpPlayerManager.GetPlayerByID(player); let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); cmpOwnership.SetOwner(player); const color = QueryOwnerInterface(this.entity, IID_Player).GetColor(); cmpVisual.SetVariable("colorr", color.r); cmpVisual.SetVariable("colorg", color.g); cmpVisual.SetVariable("colorb", color.b); warn("red : "+color.r); warn("green : "+color.g); warn("blue : "+color.b); } But maybe it's the good way, like maybe we have to set the owner manually before setting the color ? Tried because after a certain big amount of researches, I didn't found where and when the owner is set Edited June 3 by Allan Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 It's done in the foundation.js component. Basically your building goes through 3 filters preview| foundation| and nothing Quote Link to comment Share on other sites More sharing options...
Stan` Posted June 3 Report Share Posted June 3 1 hour ago, Allan said: let cmpOwnership = Engine.QueryInterface(ent, IID_Ownership); cmpOwnership.SetOwner(player); Well ent is not defined, and your setting the player to itself ^^ so it wouldn't change much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.