Monday, April 16, 2012

[FA] access to an enemy object from its entityId

Hi,
Back again, ok, why cant i get access to an enemy object from an entityId
when i import a function from usersync.. i guess its in the user layer..
i have access to my own army entitities using the same function however
when i send an enemy entity id getunitbyid returns nil
how come, and is there away around this?|||It's obviously for security reasons, and you can't work around it, nor should you.|||ok well imma need help...
im trying my hat again at custom strat icons from a mods path..
its 50% there, more so i think than has been possible thrus far.. i know its an old topic.. but ive now got custom strat icons on own army units with no problems..
as demonstarted in this lil video i just did..
http://www.youtube.com/watch?v=Vc1hlc6n4Dw
ok now the cat is out of the bag.. the problem is that i cant find/think of a way to also add the strat icons to enemy units.. as i dont have access to this object in the user layer.. so can you think of another method i can use.. to be able to place strat icons on units.. i could do with some help here.. because im feel like im really close with this attempt at solving this problem..
the method is in the video i think is superior to anything yet seen regarding custom strat icons .. they dont jitter around the map at all.. and there position updates effortlessly by the ui.. so no impact to game performance at all..|||Without knowing how or why you're using sync to handle this, I'm not really sure what to tell you?|||Post removed|||Welp, to prevent exploits that would give everyone user-side handles to all opponents' units, you're going to need to create your own sync table for displaying strat icons (instead of using UnitData - just to keep things consistent, and to keep the enemy units you can see out of UnitData), and use the AIBrain OnIntelChange function to keep an up-to-date table of visible (but not dropped-off-all-intel) enemy units in your sim-side sync table, and have SimSync selectively push allied army tables across the sync.
Good luck with all that.

Edit: Even then, you'll still be providing user-side handles to enemy units that are still on intel. That's not great, and could be used for some exploits. Basically, there's absolutely no clean way to do this, because it relies on having userunit handles to every unit that gets a strat icon, which is always going to allow some cheating.|||Hi,
already started the aibrain onintelchange function.. ive 50% fixed the buildings still showing under the FOW, they no longer show.. that is why i started the other thread about setting units untargetable, because although i can hide the structures.. they can still be targeted by hovering the mouse over there last known position.. kk thats offtopic..
so.. will you roughly explain how i create my own sync table just for this purpose..
infact will you roughly explain how to do the things you have surgested.. i have no clue.. how to do most of those..
lets face it.. our lil modding community isnt that great.. and tbh.. i dont think the modders whom are still here will take advantage of an exploit.. besides.. its a 4 year old game.. are we really bothered about 1 lil thing.. as long as we can have modpath start icons.. im not bothered.. i wont use the setup to exploit the game..
and if others do.. then they just suck.. :) we have to remember that everyone has to download and have loaded a mod that would use an exploit.. usual players wont use such a mod, as it would spoil there game..|||Domino|||You don't need any mods to exploit for data you shouldn't have in the UI, although I admit that it would reduce the coding skills required to make something work.|||There's a world of difference between using some arcane vulnerabilities in the engine (that I've played with, and found very, very difficult do anything with without triggering desyncs) and having the data handed to you on a silver platter, along with a framework to display that data accurately, in icon form.|||Hi,
Had a brainwave this morning.. ive figured out away to add the strat icons to enemy units.. using the same function.. without having access to the object.. bada boom..
there is no exploits or chance of cheating.. its all safe.. :) thanks for the help anyway.|||Passing the position + icon type?
That would need an awful lot of resyncing.|||BulletMagnet|||Well, explain your strategy. Then we'll see if I was a little hasty.|||LOL, you explain yours AND THEN ill explain mine..|||Instead of passing a handle to the unit; you find the position and the icon to be used in the Sim, chuck that into the sync table and draw it in User Land. The problem will be when units move... their positions chance, and hence need to be re-synced. You could optimise it such that you pass the velocity as well (a linear regression, if you're mathematically inclined) and you could get away with resyncing only at times when the unit changes.|||well no im not doint it like that...
im letting the ui sort the position out.. in the bitmaps onframe event :)
i only need to pass one thing from the sync table.. from the sim to the ui :)|||Which would be?|||Post Removed|||If that works, it'll be a very clever and elegant solution. Nice work. :D
[PS:] Hmmz. Can blip:GetUnit() be called from User Land?|||BulletMagnet|||Is the blip completely destroyed when the owning army loses intel on it? I would assume it is, but it would be a good thing to double-check.|||No, the blip isnt destroyed.. when intel loses the blip.. it appears that blips.. are always there until the unit dies.. they are triggered from intel, in the engine.. whether they are visable or objects ..
i think the blip is just the unit object.. except masked in some way.. because they blip has the same ent id as the unit. the blip is the unit.. only a c-object version of it..|||Well, uh, then that's no different than giving away a unit handle. Any UI mod can easily tweak your mod's code and even use your icon display function to permanently attach an icon to each enemy blip, and thus never lose intel on those units.
And if I'm understanding what you just said correctly, they can still get the entityid of the actual userunit object, allowing them access to health and other stats at all times anyway.

I'm not just posting this stuff to be negative, these are real concerns you have to deal with or nobody will ever use a mod that enables easy, silent cheating. It's great if it works, but it needs to both work and be exploit-resistant (even if not totally exploit-proof, which would be nice).|||well uh, indeed this is a problem.. :| because we do have access to unit functions, like gethealth, getfocusunit .. all that jazz..
for the record this is NOT my doing... i just send the ******** to the user layer..
and this is the only way to have strat icons from a mod path without them jittering all over the map.. i should prolly delete the post where i tell people how to do it.. best not have instructions on how to do this..
the problem is right its 100% working.. building dissappear under the FOW and start icons are created and destroyed upon intel no intel.. on the unit(s)
what should i do.. ?

No comments:

Post a Comment