Some lua startscript questions

Some lua startscript questions

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Bogey Jammer
Posts: 2
Joined: 27 Jul 2008, 14:23

Some lua startscript questions

Post by Bogey Jammer »

Hi all

I'm new in the Spring community and started to make my own scripts to help my relative poor skill in RTS playing.

I've already created a template "mission" for training and testing purpose, with a startscript. But I have some questions to finalize my project:
  1. How to assign a color to each team when the mission starts? Currently, team 0 is blue and team 1 is red; I would like to change that.
  2. Is it possible to add text commands for use in game? I found this in a lua example file:

    Code: Select all

    function MissionTest:__init() super('LUA ordertroops')
        self.state = 0
    
        self.commands = {}
        self.commands[".help"] = self.Help
    end
    
    function MissionTest:Help(param)
            print("Request troops to attack you by saying for example '.send 5 arm_stumpy' or '.send 4 core_instigators'")
    end
    
    But it doesn't seem to work, I suspect this method is obsolete..
  3. Spring crashes when I include the code to insert an AI showed in the wiki tutorial (I point the correct AI dll btw). Is this method still valid? or am I just doing wrong?
That's all for now, I'll probably ask more questions later. Scripting is exciting :mrgreen:
User avatar
Bogey Jammer
Posts: 2
Joined: 27 Jul 2008, 14:23

Re: Some lua startscript questions

Post by Bogey Jammer »

I answer the question 3 myself, I just discovered that a function instanciation with () at the end of the function's name always executes the function's code... what a noob mistake I made :oops:
So the AI was loaded at mission startup, I can now activate it when I want during the game, but it Spring crashes or AI does nothing depending of the AI engine... I need to more investigate.
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Some lua startscript questions

Post by Satirik »

the startscript should be removed soon so use LuaRules to make your missions

LuaRules inside a Mutator file
Post Reply

Return to “Lua Scripts”