Does anyone think this might be possible? For example, forcing the mouse click event to trigger even though the player isn't clicking their mouse.
I'd really like to find out but I don't know how. Theoretically it should be able to 'hack' the engine and find out how events are being fired so that we can force them to happen without the actual events firing. Does anyone know how this might be possible? Perhaps by tapping into the ram and watching which sectors are being read/written etc..
You can execute a trigger through the run trigger action.
If you want triggering unit and similar functions to still work than you should transfer the script to a function and add the unit as a parameter (or whichever parameters you still want to work) and then call that function in that trigger. This function could also be run in another trigger.
Yeah, but that wouldn't register any information into the function callbacks such as EventGetMousePositionX/Y. What i'm trying to get at is that if we can somehow trick the engine into thinking the mouse click event fired without clicking the mouse, we just might be able to get mouse position with much more ease. To do this, I foresee it would take some degree of hacking and observation of how variables are handled in the game memory. Unfortunately I have no idea how to do this and thus I'm hoping someone out there might know how.
The game only sends that kind of information to the server at certain times so you would need to change the actual game engine for that to work. The map would then be unpublishable and non-playable for anyone that doesn't have the modified version of the game engine.
As Twin said, such a hack could not be played on Battle.net (in fact you could get banned for it) and there is no other way to simulate an event directly.
But you can use global variables in combination with the TriggerExecute to get the job done:
unitgTempUnit;//Global for passing parameterstriggergTrigUnitDied;boolUnitDied(boola,boolb){unitdyingUnit;if(EventUnit()==null){//Only if the event unit is invalid we try to get gTempUnitdyingUnit=gTempUnit;}else{dyingUnit=EventUnit();}DisplayMessage("Oh shit, "+GetUnitName(dyingUnit)+" has died!");returntrue;}voidsimulateUnitDeath(unitu){gTempUnit=u;TriggerExecute(gTrigUnitDied,false,false);}voidMapInit(){//Just trigger declarationgTrigUnitDied=TriggerCreate("UnitDied");TriggerAddEventUnitDied(gTrigUnitDied,null);}
This way your trigger will choose EventUnit() if it's a valid target and otherwise will get it's dying unit from a global variable.
Note, however, that you'll still get a debug error message "EventUnit() has no matching event", but the trigger still works.
If you want to avoid this you can use other methods.
1) You can tell the trigger only to get the unit from gTempUnit if gTempUnit!=null and always set gTempUnit=null after the trigger started.
2) You can abuse the TriggerExecute's second parameter (the checkConditions boolean) and tell the trigger to only look for gTempUnit if this boolean is either true of false:
boolUnitDied(boola,boolb){unitdyingUnit;if(a==false){//a is the checkConditions parameterdyingUnit=gTempUnit;}else{dyingUnit=EventUnit();}DisplayMessage("Oh shit, "+GetUnitName(dyingUnit)+" has died!");returntrue;}
Of course all event parameters would have to get their respective global temp variable.
PS: First post in 3 days in the galaxy section.. this is like a ghost town :P
PPS: I just read the thing with getting mouse position without mouse click - no this really would only work with chode modification, no nifty tricks for that..
Haha, alright. Thanks for verifying that. Looks like i'll have to keep trying with that no click method then :P Yeah. I noticed, this section is kinda quiet =( Seems the scripting population is at quite a minima.
Quote:
Feeling lonely?
Oh so very. We should totally organize some competitions that must be done entirely in galaxy.
When the hours pass and a lonely s3rius looks at this section from afar.. the sun sets, the shadows grow longer and a hurrying passenger or two pass by the ancient dusty gates of Script Knowledge...
Can you hook functions just like you did in World of Warcraft?
Like hack the "Unit Dies" event register function with your version of the event (to keep the trigger in your own array) and then pass the parameters to the original function.
Do you mean Warcraft 3?.. The NewGen hooks? They're just differently compiled than usual.. nothing magic about it.
If there's anything like that in WoW I don't know about it.
Can you hook functions just like you did in World of Warcraft?
No :(
WoW is using lua as a scripting language that treats functions as first class object (basically they are just variables). This means that you can do something like this:
varold=locked_function;functionlocked_function(a,b,c){/* Do something */varresult=old(a,b,c);/* Do something */returnresult;}
However galaxy is closely related to C and this is not possible.
Also, this is really fun you are asking because I was the first one to discover it on WoW during the beta on Cosmos UI :) It was really annoying to have to manually update all the files that were edited. You basically had to do manual diffs on all the files and try to fix it.
During 6 hours after a patch release we were focusing on fixing Cosmos. This was the birth of the expression "Patch Day, No play" :)
When I found out this trick, I started moving into "modules" (was the name we had) our code. My Minigames were therefore the first addon of WoW! They introduced the addons something like 2 weeks later.
All of the above? :P I'm pretty sure it would open up new doors to creative map design. When there is a tool, someone will usually find out how to use it in an innovative way.
Well if your looking to do non rts game then you can prolly easily use Progammers way with units all over the map in a grid and detect the mouse hovering on those units.
Top down shooter? I dunno why you would need mose cords for a top down shooter.
Progammers way suffers from lag from all the units. Top down shooters need it so that the unit always faces the mouse cursor and so that you can have a hold in shooting and movement system instead of a spam-clicking system.
eh. top down shooters should really have wasd controls anyways. and top down shooters with auto follow mouse doesnt really sound like a top down shooter to me.
Id honestly go with progammers Data driven WASD system if I was gonna make a top down shooter. Games like that shouldnt rely on the mouse anyways.
You may say well thats not very good either, I say eh , you dont have much of a choice with whats currently available.
Well, look at a video of a Top Down shooter and then tell me how are you supposed to shoot without a mouse?
Firing only in the direction you're facing? Bah.
Does anyone think this might be possible? For example, forcing the mouse click event to trigger even though the player isn't clicking their mouse. I'd really like to find out but I don't know how. Theoretically it should be able to 'hack' the engine and find out how events are being fired so that we can force them to happen without the actual events firing. Does anyone know how this might be possible? Perhaps by tapping into the ram and watching which sectors are being read/written etc..
You can execute a trigger through the run trigger action.
If you want triggering unit and similar functions to still work than you should transfer the script to a function and add the unit as a parameter (or whichever parameters you still want to work) and then call that function in that trigger. This function could also be run in another trigger.
@Twinmold20: Go
Yeah, but that wouldn't register any information into the function callbacks such as EventGetMousePositionX/Y. What i'm trying to get at is that if we can somehow trick the engine into thinking the mouse click event fired without clicking the mouse, we just might be able to get mouse position with much more ease. To do this, I foresee it would take some degree of hacking and observation of how variables are handled in the game memory. Unfortunately I have no idea how to do this and thus I'm hoping someone out there might know how.
The game only sends that kind of information to the server at certain times so you would need to change the actual game engine for that to work. The map would then be unpublishable and non-playable for anyone that doesn't have the modified version of the game engine.
@FuzzYD: Go
As Twin said, such a hack could not be played on Battle.net (in fact you could get banned for it) and there is no other way to simulate an event directly.
But you can use global variables in combination with the TriggerExecute to get the job done:
This way your trigger will choose EventUnit() if it's a valid target and otherwise will get it's dying unit from a global variable.
Note, however, that you'll still get a debug error message "EventUnit() has no matching event", but the trigger still works.
If you want to avoid this you can use other methods.
1) You can tell the trigger only to get the unit from gTempUnit if gTempUnit!=null and always set gTempUnit=null after the trigger started.
2) You can abuse the TriggerExecute's second parameter (the checkConditions boolean) and tell the trigger to only look for gTempUnit if this boolean is either true of false:
Of course all event parameters would have to get their respective global temp variable.
PS: First post in 3 days in the galaxy section.. this is like a ghost town :P
PPS: I just read the thing with getting mouse position without mouse click - no this really would only work with chode modification, no nifty tricks for that..
Feeling lonely?
@s3rius: Go
Haha, alright. Thanks for verifying that. Looks like i'll have to keep trying with that no click method then :P Yeah. I noticed, this section is kinda quiet =( Seems the scripting population is at quite a minima.
Oh so very. We should totally organize some competitions that must be done entirely in galaxy.
When the hours pass and a lonely s3rius looks at this section from afar.. the sun sets, the shadows grow longer and a hurrying passenger or two pass by the ancient dusty gates of Script Knowledge...
@FuzzYD: Go
I think for galaxy-only contests there are just too few who actually practice it.
Can you hook functions just like you did in World of Warcraft?
Like hack the "Unit Dies" event register function with your version of the event (to keep the trigger in your own array) and then pass the parameters to the original function.
@Klishu: Go
Do you mean Warcraft 3?.. The NewGen hooks? They're just differently compiled than usual.. nothing magic about it.
If there's anything like that in WoW I don't know about it.
I think he meant LUA function "overriding" or whatnot.
In any case, that's a construct of LUA, not Galaxy.
No :(
WoW is using lua as a scripting language that treats functions as first class object (basically they are just variables). This means that you can do something like this:
However galaxy is closely related to C and this is not possible.
Also, this is really fun you are asking because I was the first one to discover it on WoW during the beta on Cosmos UI :) It was really annoying to have to manually update all the files that were edited. You basically had to do manual diffs on all the files and try to fix it.
During 6 hours after a patch release we were focusing on fixing Cosmos. This was the birth of the expression "Patch Day, No play" :)
When I found out this trick, I started moving into "modules" (was the name we had) our code. My Minigames were therefore the first addon of WoW! They introduced the addons something like 2 weeks later.
Yep, that was what I was referring too. Well too bad then; I can't think of any other way.
What are you trying to do that you would need the mouse position anyways?
@SouLCarveRR: Go
Having triggered cursor splats just like abilities? Making a good top-down shooter? Making Paint for Sc2? xD
@s3rius: Go
All of the above? :P I'm pretty sure it would open up new doors to creative map design. When there is a tool, someone will usually find out how to use it in an innovative way.
@FuzzYD: Go
Well if your looking to do non rts game then you can prolly easily use Progammers way with units all over the map in a grid and detect the mouse hovering on those units.
Top down shooter? I dunno why you would need mose cords for a top down shooter.
@SouLCarveRR: Go
Progammers way suffers from lag from all the units. Top down shooters need it so that the unit always faces the mouse cursor and so that you can have a hold in shooting and movement system instead of a spam-clicking system.
eh. top down shooters should really have wasd controls anyways. and top down shooters with auto follow mouse doesnt really sound like a top down shooter to me.
Id honestly go with progammers Data driven WASD system if I was gonna make a top down shooter. Games like that shouldnt rely on the mouse anyways.
You may say well thats not very good either, I say eh , you dont have much of a choice with whats currently available.
@SouLCarveRR: Go
Well, look at a video of a Top Down shooter and then tell me how are you supposed to shoot without a mouse?
Firing only in the direction you're facing? Bah.