Jump to content
Sign in to follow this  
Madin

ExecuteAction Lua?

Recommended Posts

Can anyone help me with 'ExecuteAction' Lua scripts?

 

There is this one example in the lua:

function kill(self) -- Kill unit self.
ExecuteAction("NAMED_KILL", self);
end
 


But I was wondering if someone could provide other examples of how other actions could be used (the actions in scripts.ini), eg to do something to another target, etc.

Share this post


Link to post

I am guessing alot of these will work, you just need to have the time and will to test some:

 

see attachment, or you can extract the data/ini/scripts.ini file yourself

 

 

edit: nvm misread you allrady know about that...just was asking for examples.

 

a awhile ago megumi told me about one called named_delete, in regards to removing a spawned object after it did what it was supose to do, so basicly a end script to clean up a dummy. Can't remember the tread tho.

 

 

ScriptAction
  InternalName = "UNIT_GAIN_LEVEL";
  UIName = "Unit (includes Structures) -- Action/Experience/Unit levels up with visual FX.";
  HelpText = "No Help."
End
 

this one seems pretty strait forward. I might test a few over the next days if i find the time (bussy baking waffles..don't ask :o )

scripts.zip

Edited by Ravendark

Share this post


Link to post

I am trying out the enter transport script, but I really do not understand the correct usage:

function SovietConscriptEnterTransport(self)
        ExecuteAction("NAMED_ENTER_NAMED", self, "NODScorpionBuggy");
end

'NODScorpionBuggy' is the name of the transport. The transport has a weapon that is triggering the script within a certain range, but nothing happens.

 

Has always, if the script action is being fired on the unit executing the script is works fine (eg "NAMED_KILL"). It is executing on another unit that causes issues for me.

Edited by Madin

Share this post


Link to post

The scripts are the same as the scripts available in WorldBuilder. If you want to know the name (some aren't in the scripts.ini) create a blank map with that script and save it.

The order of the parameters is the same as it's in the WB.

 

If you're using the lua event nugget iirc the signature is func(self, other) where self is the victim, and other the shooter. Might be vice versa, but you cannot just use "NODScorpionBuggy".

Share this post


Link to post

"void ExecuteAction(string actionName, object[] params)"

This is from a list that has been posted on various sites.

 

What does the 'object[] params' mean?

Share this post


Link to post

that's the list I made some time ago, I made them in a c# style manner... it just means that you can have a variable amount of objects to be passed in the function... like:

ExecuteAction("NAMED_KILL", self)

or

ExecuteAction("SHOW_MILITARY_CAPTION", message, "3")

Share this post


Link to post

hi, I did some research on Lua and also found some nice possibilities. See the Source Code of my mod for more examples: http://www.moddb.com/mods/mjjstral/downloads/meta-mod-101-source-code

I add a list at the end of this post.

 

But first I want to give some inspirational ideas where I will need the help of you Experts e.g. Lauren, Ravendark, Megumi and all the other good people.

I figured out that we can use all ExecuteActions where we pass a unit (self) to the function. These mostly beginn with NAMED_ (NAMED_DAMAGE, NAMED_USE_COMMANDBUTTON_ABILITY....). On the other side there is many actions where you need to use Player or Team, for example:

 

ExecuteAction("PLAYER_SET_MONEY", Player_1?, 77777);

ExecuteAction("NAMED_TRANSFER_OWNERSHIP_PLAYER", self, PLAYER_1?);
ExecuteAction("UNIT_SET_TEAM", self, TEAM_1?);

 

I don't know if we can make these to work if we find a way to adress the attribute PLAYER or TEAM properly:
Think about creating a diplomacy System and many other nice possibilities...

 

Another way which can turn out to be the holy grail of C&C Modding is to use scripts with one of these Actions:

 

ExecuteAction("UNIT_EXECUTE_SEQUENTIAL_SCRIPT"....
ExecuteAction("ENABLE_SCRIPT"...
ExecuteAction("UNIT_EXECUTE_SEQUENTIAL_SCRIPT_LOOPING"...
ExecuteAction("CALL_SUBROUTINE"...

 

At least you can activate and run the scripts which were already added to the map with these commands.

But the point is to run external scripts added to the mod package not the map. Maybe export a World Builder script then load it as an external file in scripts.lua and run it with the above...

 

 

Now here is the List of mostly testet and working Actions:

CAMERA
ExecuteAction("CAMERA_SET_DEFAULT", 0.00, 0.00 , 1.0); (only last parameter works)
ExecuteAction("SET_CAMERA_CLIP_DEPTH_MULTIPLIER", 1.0); --1.0=default, smaller 1 shortens, bigger 1 lengthens
ExecuteAction("CAMERA_MOD_SET_FINAL_SPEED_MULTIPLIER", 1)
ExecuteAction("CAMERA_MOD_SET_ROLLING_AVERAGE", 5); -- 1=smooth, 5=very smooth
ExecuteAction("LOCK_CAMERA", 1);
ExecuteAction("HIDE_UI");
ExecuteAction("SHOW_UI");

GRAPHICS/GAMESPEED
ExecuteAction("OPTIONS_SET_PARTICLE_CAP_MODE", 0);
ExecuteAction("OPTIONS_SET_DRAWICON_UI_MODE", 0);
ExecuteAction("TERRAIN_RENDER_DISABLE", 1); -- ground gets black
ExecuteAction("SET_VISUAL_SPEED_MULTIPLIER", speed)
ExecuteAction("SET_FPS_LIMIT", fps_speed)

OTHER
ExecuteAction("NAMED_KILL", self);
ExecuteAction("NAMED_USE_COMMANDBUTTON_ABILITY", self, "Command_Name")
ExecuteAction("NAMED_DAMAGE", self, 9999999);
ExecuteAction("RESUME_SUPPLY_TRUCKING");
ExecuteAction("SET_IGNORE_SKIRMISH_VICTORY_CONDITIONS", 1);
ExecuteAction("OPTIONAL_VICTORY")
ExecuteAction("SHOW_MILITARY_CAPTION", "MESSAGE:Name", 8);
ExecuteAction("VICTORY");
ExecuteAction("SCREEN_SHAKE", "Cine_Insane")

Maybe work maybe not
ExecuteAction("WAREHOUSE_SET_VALUE", self, 55555);
ExecuteAction("TECHTREE_MODIFY_BUILDABILITY_OBJECT", self);
ExecuteAction("MAP_SHROUD_SET_RESHROUD_TIME", 5);
ExecuteAction("PLAY_SOUND_EFFECT", SoundName);
ExecuteAction("NAMED_RECEIVE_UPGRADE", self, Upgrade);
ExecuteAction("NAMED_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING", "Command_Name");

 

Another possibly nice command besides ExecuteAction:
EVALUATECONDITION (Use the Conditions from World Builder)
EvaluateCondition("MULTIPLAYER_ALLIED_VICTORY")
EvaluateCondition("MULTIPLAYER_ALLIED_DEFEAT")
EvaluateCondition("IS_GAME_IN_SKIRMISH_OR_MULTIPLAYER")

Edited by Mjjstral

Share this post


Link to post

Theres all kinds of crazy **** you can do with ExecuteAction and other commands... i wrote some 2000 lines of new LUA code for my Renegade Wars mod (the original LUA code was barely 1000), check it out if you are interested:

 

http://www.moddb.com/mods/renegade-wars-kw

 

As the above poster mentioned though, the biggest downside is there doesnt seem to be a way to make player references work... im also not sure if you can reference to WB scripts, but its worth a try i guess

 

 

@madin you can add me on skype if you want

Edited by cgf123

Share this post


Link to post
On 18/01/2016 at 4:59 PM, cgf123 said:

Theres all kinds of crazy **** you can do with ExecuteAction and other commands... i wrote some 2000 lines of new LUA code for my Renegade Wars mod (the original LUA code was barely 1000), check it out if you are interested:

 

http://www.moddb.com/mods/renegade-wars-kw

 

As the above poster mentioned though, the biggest downside is there doesnt seem to be a way to make player references work... im also not sure if you can reference to WB scripts, but its worth a try i guess

 

 

@madin you can add me on skype if you want

thanks i download your mod and i checked your scripts you wrote i really dont know what these scripts doing i need interested one , can you help me with that and explain every script what can do discord neroZzero#4903

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×