Urgent editor request.
Moderator: Panzer Corps 2 Moderators
-
- Panzer Corps Map Designer
- Posts: 4518
- Joined: Fri Jun 24, 2011 1:21 pm
- Location: Belgium
- Contact:
Urgent editor request.
A simple but urgent request.
Please add in edit/configure units/AI script/command an option to define the number of turn in order to trigger that particular AI script.
I'd love to create some content for the community but i beg for an editor to have the easy, frustrationless ease to do some scripting. I have no desire to invest time to learn the ropes of Lua.
I looked at some of those lua files, i can start reading chinese just the same.
Please add in edit/configure units/AI script/command an option to define the number of turn in order to trigger that particular AI script.
I'd love to create some content for the community but i beg for an editor to have the easy, frustrationless ease to do some scripting. I have no desire to invest time to learn the ropes of Lua.
I looked at some of those lua files, i can start reading chinese just the same.
https://www.facebook.com/NikivddPanzerCorps
https://www.youtube.com/channel/UCk2lyeEuH_hoA1s7tnTAEJQ
https://www.youtube.com/channel/UCk2lyeEuH_hoA1s7tnTAEJQ
Re: Urgent editor request.
https://www.youtube.com/watch?v=UELWnj-SSxc
I looked at some scenarios that have something like this. Yea there's no way I can teach you, nor write that on my own. It would be an exercise is copy pasting...
but that's the nice thing about scripts, if you have a library of functions, you don't necessarily need to know how they work, only that they do.
I'll see if I can help, but if you really want this in the editor, you'll have to wait for Alex.
And ideally, some things will be added in the editor eventually, but I don't think anything will come soon after launch.
-
- Panzer Corps Map Designer
- Posts: 4518
- Joined: Fri Jun 24, 2011 1:21 pm
- Location: Belgium
- Contact:
Re: Urgent editor request.
Thanks a lot for your inputKerensky wrote: ↑Sun Mar 22, 2020 6:52 pm
https://www.youtube.com/watch?v=UELWnj-SSxc
I looked at some scenarios that have something like this. Yea there's no way I can teach you, nor write that on my own. It would be an exercise is copy pasting...
but that's the nice thing about scripts, if you have a library of functions, you don't necessarily need to know how they work, only that they do.
I'll see if I can help, but if you really want this in the editor, you'll have to wait for Alex.
And ideally, some things will be added in the editor eventually, but I don't think anything will come soon after launch.
Most likely (PzC1) modders would be grateful if a thread could be created with common lua script examples and some explanation what each script actually does.
Nonetheless, i would still like to see the turn trigger in the editor, it is something i feel much more comfortable with.
https://www.facebook.com/NikivddPanzerCorps
https://www.youtube.com/channel/UCk2lyeEuH_hoA1s7tnTAEJQ
https://www.youtube.com/channel/UCk2lyeEuH_hoA1s7tnTAEJQ
Re: Urgent editor request.
+1 for turn trigger. I want to set delays on AI attacks to simulate attack waves. What's the alternative? have them move back and forth between 2 hexes X amount of turns?
Re: Urgent editor request.
The alternative is to use the Patrol order before the Attacker. On Patrol unit behaves "active" meaning if it can attack enemy unit in striking range it will do it. The workaround is the following: for the sequence set single hex on which unit is standing at, use the arrow at the right for a drop-down menu and set the duration of patrol in turns. Since the sequence of Patrol is only on one hex unit will not move (you can use several hexes if you wish so) and when the duration of Patrol passes unit will switch to the next order, in this case the Attacker.
Re: Urgent editor request.
This works well when dealing with long distances. In my case I would prefer the unit to hold position (fire) for X amount of turns. Tank and recon movement range is too long and the "active" aspect of the patrol single hex method makes them attack the player when I don't want them to yet.uran21 wrote: ↑Fri Apr 17, 2020 5:54 amThe alternative is to use the Patrol order before the Attacker. On Patrol unit behaves "active" meaning if it can attack enemy unit in striking range it will do it. The workaround is the following: for the sequence set single hex on which unit is standing at, use the arrow at the right for a drop-down menu and set the duration of patrol in turns. Since the sequence of Patrol is only on one hex unit will not move (you can use several hexes if you wish so) and when the duration of Patrol passes unit will switch to the next order, in this case the Attacker.
Edit: I guess the only real solution is to make my map larger and stack up the the units further back.
Re: Urgent editor request.
I hope the devs come back to the editor "world" soon. We have a lot of questions and suggestions, I put some in some other thread.
Regarding the scripts, it would be cool if the Editor includes some basic functions/triggers "pre-made" in order to ease the life of the modders, i.e: wait X turns and attack, spawn units, change weather, set turns, etc.
Regards,
Akkula.
Regarding the scripts, it would be cool if the Editor includes some basic functions/triggers "pre-made" in order to ease the life of the modders, i.e: wait X turns and attack, spawn units, change weather, set turns, etc.
Regards,
Akkula.
Eastern Front: Soviet Storm (v1.96): http://www.slitherine.com/forum/viewtopic.php?f=147&t=50342
Modern Conflicts (v1.95): http://www.slitherine.com/forum/viewtopic.php?f=147&t=72062
Modern Conflicts (v1.95): http://www.slitherine.com/forum/viewtopic.php?f=147&t=72062
Re: Urgent editor request.
I looked at the Berlin defense scenario that spawns enemies. But I can't plainly see anything in the editor that actually triggers the spawning of units. Special hexes, triggers ect... Spawning units would actually alleviate my issue and be another option other than the "patrol" single hex method or move back and forth method to wait X amount of turns before I want the unit to move to engage the player.Akkula wrote: ↑Sat Apr 18, 2020 4:17 pm I hope the devs come back to the editor "world" soon. We have a lot of questions and suggestions, I put some in some other thread.
Regarding the scripts, it would be cool if the Editor includes some basic functions/triggers "pre-made" in order to ease the life of the modders, i.e: wait X turns and attack, spawn units, change weather, set turns, etc.
Regards,
Akkula.
Re: Urgent editor request.
The Berlin scenario (as many others) uses turn conditions to spawn enemy units. Check the "conditions" functions and you will see they return a turn value.NETSCAPE wrote: ↑Sat Apr 18, 2020 6:55 pmI looked at the Berlin defense scenario that spawns enemies. But I can't plainly see anything in the editor that actually triggers the spawning of units. Special hexes, triggers ect... Spawning units would actually alleviate my issue and be another option other than the "patrol" single hex method or move back and forth method to wait X amount of turns before I want the unit to move to engage the player.Akkula wrote: ↑Sat Apr 18, 2020 4:17 pm I hope the devs come back to the editor "world" soon. We have a lot of questions and suggestions, I put some in some other thread.
Regarding the scripts, it would be cool if the Editor includes some basic functions/triggers "pre-made" in order to ease the life of the modders, i.e: wait X turns and attack, spawn units, change weather, set turns, etc.
Regards,
Akkula.
Eastern Front: Soviet Storm (v1.96): http://www.slitherine.com/forum/viewtopic.php?f=147&t=50342
Modern Conflicts (v1.95): http://www.slitherine.com/forum/viewtopic.php?f=147&t=72062
Modern Conflicts (v1.95): http://www.slitherine.com/forum/viewtopic.php?f=147&t=72062
Re: Urgent editor request.
Excerpts from the Beta:
Kerensky wrote: ↑Tue Dec 10, 2019 8:55 pm
I looked at the sample file. Man... it's tough to digest. Mostly because I'm an idiot at this sort of thing. lol
Not going to lie, there is a ton that I don't properly understand, and that I have been copy pasting around.
But...
You specifically asked 'a question of not using tables' Which is exactly what I set out to create.
I even think Scipt.lua is too complex for my liking. He clearly wanted to try and demonstrate a lot of things all at once, but it's too must to digest all at once.
Here's what I made (and massively copy pasted from ScriptDemo).
It's just the absolute, most bane bones basic 'create a unit' trigger that I could come up with. Actually that's a lie, I also injected the message box output in there.Code: Select all
function Turn3Landing(action) local message3 = "Allied Reinforcements have landed on the beach east of Gela." MessageBox("", message3) player = 0 zone = { {20,37},{21,37},{20,38},{21,38},{22,38} } units = { {"GBInfantry43", "UniversalCarrier", 0, 1750}, {"GBInfantry43", "UniversalCarrier", 0, 1750} } SpawnWave(player, zone, units) end
But ignore that.
Point is, I made this function as 'baby's first script' meaning it is ultra simplistic.
1. The function fires.
2. It defines which player, where to spawn, and what to spawn.
3. It then calls on another function to do all the heavy lifting.
I think anyone can read and understand this function. All you do is what you absolutely are required: Define who gets the unit, where the units appear, and what the units are. That's literally all that happens.
Anyone can copy paste that small sample function, and edit it to their heart's desire with whatever units they want, wherever they want them.
There comes a time on every project when it is time to shoot the engineer and ship the damn thing.
Re: Urgent editor request.
More
uran21 wrote: ↑Tue Dec 10, 2019 9:01 pm Tables are not used if you plan to spawn single unit on a single hex. Goes something like this:
Code: Select all
function SpawnUnit() local player = world:GetPlayer(0) local create_action = world:MakePurchaseAction(player, "WehrInfantry", "OpelBlitz", 0) world:Exec(create_action) local unit = world:GetUnit(create_action.id) local hex = world:GetHex({3,2}) if (hex:GetUnit(0) == nil) then -- this check is absolute necessary deploy_action = world:MakeDeployAction(unit, {3,2}) world:Exec(deploy_action) end end
There comes a time on every project when it is time to shoot the engineer and ship the damn thing.
Re: Urgent editor request.
Kerensky wrote: ↑Tue Dec 10, 2019 9:02 pm And here's the part where I massively steal from Alex's hard work.
So that function I wrote. It's super basic, just defines some parameters of who, what, and where. And then it calls for SpawnWave. Which doesn't do anything...
Until in the same script file, you copy paste this monstrosity as a separately defined function.
This indecipherable beast of a script is who does all the work.
Code: Select all
function SpawnWave(player, zone, units) local owner = world:GetPlayer(player) local cur_hex = 1 -- Iterate through all units and spawn each one for _,u in ipairs(units) do -- Find the next vacant hex in the zone while zone[cur_hex] do hex = world:GetHex(zone[cur_hex]) if hex:GetUnit(0) == nil then break end -- found cur_hex = cur_hex + 1 end -- If we have run out of hexes in the zone, stop if not zone[cur_hex] then return end -- Create the unit in the free hex we've found -- 1. Create and execute purchase action, use unit type, transport type and overstrength as parameters local create_action = world:MakePurchaseAction(owner, u[1], u[2], u[3]) create_action.auxiliary = false -- spawn core units create_action.cost = 0 -- don't take money for units we generate world:Exec(create_action) -- 2. Create and execute deploy action, place the unit in the hex we've picked. local unit = world:GetUnit(create_action.id) deploy_action = world:MakeDeployAction(unit, zone[cur_hex]) world:Exec(deploy_action) -- 3. Now modify the unit to set its experience to the value we need. unit.experience = u[4] -- 4. Now modify the unit to set its aggressiveness to the value we need. player_aggressiveness = { 0, 85, 70, 50 } unit.aggressiveness = player_aggressiveness[player+1] end end
But by cutting up the spawn trigger, and the 'how to spawn' trigger.... the process becomes very simple and easy to manage.
All you do is edit the part that I created.
And then copy paste wholesale this entire function. You don't need to read or comprehend or worry about it, just wholesale copy paste theft.
There comes a time on every project when it is time to shoot the engineer and ship the damn thing.
Re: Urgent editor request.
I guess one thing to consider is the not the pain of coding the spawn, but all the subsequent actions I'd want the unit to do. Not just set aggressiveness and set as "attacker". I'd want artillery to move to specific hexes, hold position fire, while tanks move along roads only and infantry flank ect.
I think for my very specific case of my first scenario I'm working on I will use uran's recommendation of the patrol one hex technique. Mainly because I want to use the ease of the editor to configure how my units act (rather than sit their coding) in detail where to move and how to act. I've just finished expanding my map to be much larger to facilitate this...right afterwards I see this code for spawning.
I really appreciate the posts though dalfrede. I am going to experiment and test later. Or maybe make a less historically accurate random spawn wave version of my Cholm scenario.
I think for my very specific case of my first scenario I'm working on I will use uran's recommendation of the patrol one hex technique. Mainly because I want to use the ease of the editor to configure how my units act (rather than sit their coding) in detail where to move and how to act. I've just finished expanding my map to be much larger to facilitate this...right afterwards I see this code for spawning.
I really appreciate the posts though dalfrede. I am going to experiment and test later. Or maybe make a less historically accurate random spawn wave version of my Cholm scenario.
Re: Urgent editor request.
Personally, I can't wait till I can work on the Editor again. But alas, right now other things must take priority. When the next patch comes out and you see the full list of changes, you will see where the time went. But I should be able to get to the Editor in the reasonably near future (something like one month perspective). Sorry for the wait.Akkula wrote: ↑Sat Apr 18, 2020 4:17 pm I hope the devs come back to the editor "world" soon. We have a lot of questions and suggestions, I put some in some other thread.
Regarding the scripts, it would be cool if the Editor includes some basic functions/triggers "pre-made" in order to ease the life of the modders, i.e: wait X turns and attack, spawn units, change weather, set turns, etc.
Re: Urgent editor request.
Take your time Alex. I totally understand the priorities right now.Rudankort wrote: ↑Sun Apr 19, 2020 7:46 pmPersonally, I can't wait till I can work on the Editor again. But alas, right now other things must take priority. When the next patch comes out and you see the full list of changes, you will see where the time went. But I should be able to get to the Editor in the reasonably near future (something like one month perspective). Sorry for the wait.Akkula wrote: ↑Sat Apr 18, 2020 4:17 pm I hope the devs come back to the editor "world" soon. We have a lot of questions and suggestions, I put some in some other thread.
Regarding the scripts, it would be cool if the Editor includes some basic functions/triggers "pre-made" in order to ease the life of the modders, i.e: wait X turns and attack, spawn units, change weather, set turns, etc.
I can wait more than a month if needed , this game will last MANY years so dont rush anything.
Thanks for all your work.
Best regards,
Akkula.
Eastern Front: Soviet Storm (v1.96): http://www.slitherine.com/forum/viewtopic.php?f=147&t=50342
Modern Conflicts (v1.95): http://www.slitherine.com/forum/viewtopic.php?f=147&t=72062
Modern Conflicts (v1.95): http://www.slitherine.com/forum/viewtopic.php?f=147&t=72062