Map Database  •  FAQ  •  RSS  •  Login

New Dynamic Script Ideas

<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 27 Apr 2013, 11:29

Re: New Dynamic Script Ideas

Could you implement GiveRecruits(Player, Count) ? Similar to GiveWeapons, it should add an amount of recruits to player's first Barracks. I'd make my own procedure for the time being, but I can't rely on GiveUnit since I'd need to carefully manage the space on the map (in other words, I'd need to spawn units in empty spaces, and what if I spawn more than one at once? I could literally make an array on a map, ready to be filed with random recruits, but still, this would not work while they were walking or something...
I added it to the proposals.
Also, would it be possible to implement a switch to disable all the "House is not occupied" messages in the game?
Yes, I think we can add a command to disable that message for a certain house. Then you can run that for each house that gets constructed with OnHouseBuilt if you want it for all houses. It's on the list.
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 27 Apr 2013, 16:04

Re: New Dynamic Script Ideas

I think sado1 meant to disable that kind of message centralized from main menu options.
Knights Province at: http://www.knightsprovince.com
KaM Remake at: http://www.kamremake.com
Original MBWR/WR2/AFC/FVR tools at: http://krom.reveur.de
<<

sado1

User avatar

Council Member

Posts: 1430

Joined: 21 May 2012, 19:13

KaM Skill Level: Skilled

Post 27 Apr 2013, 18:32

Re: New Dynamic Script Ideas

I think sado1 meant to disable that kind of message centralized from main menu options.
No, I didn't. If I did, I'd choose another topic for that. Lewin is right, although I should've been more clear :)
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 05 May 2013, 17:24

Re: New Dynamic Script Ideas

I just assigned GroupID to many different groups, and I started wondering...
- Can I 'merge' these GroupIDs to form an army? Something like Army1 = Cavalry1 + Sword1? I guess not, since most scripts use GroupID and Army1 isn't a GroupID... And what would happen if I give every group the same ID and use that ID later on? Would all groups be selected?
- There are no real attack scripts. I can only let them attack one specific building or one specific unit. That's not enough. In TNL 1, the player is given time to prepare for an attack. If the player attacks the AI before the AI attacks the player, I want the AI to retaliate by attacking with all forces at the same time. But there is no proper way to do so...
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 05 May 2013, 23:50

Re: New Dynamic Script Ideas

Firstly a group means a collection of soldiers, one with a flag. If you split a group you get 2 groups. A group will always have one guy with a flag, and every guy with a flag in the game belongs to a different group.
A GroupID in script is a pointer or handle which lets you access a single group (only one). It lets you tell the game which group you are referring to.

Army1 = Cavalry1 + Sword1: No, that will just give you an invalid ID in the Army1 variable. A group ID only stores 1 group.

"And what would happen if I give every group the same ID and use that ID later on?" - You can't give a group an ID. The engine assigns each group an ID when they are created and that ID never changes, unless the group gets linked into another one or all the soldiers in the group die (either way that group is considered dead because it has no members left).

Imagine you are the game engine, every time a group is created you hand the group a piece of paper with a number written on it (first group gets 1, second group gets 2, etc.). That number uniquely identifies the group, and you tell the script what the ID is if the group was created using Actions.GiveGroup. So when the script tells you "group 5 move to 57,23" you can find the group with ID 5, and tell them to move. That's all a group ID is, it makes it possible for the script and the game to identify a specific group.

If you want to store a collection of groups you can use an array to store every group's ID, which I'll show you in my example below.

"There are no real attack scripts" - I plan to add a function named something like "PlayerGetClosest###" (groups/houses/units). Then you can do your attack like this:

  Code:
var AIArmy: array of Integer; procedure OnMissionStart; begin SetLength(AIArmy, 4); //Allocate space to store 4 items (groups in this case) AIArmy[0] := Actions.GiveGroup(...); //Could also use GroupAt if you'd prefer to create the groups in the .DAT AIArmy[1] := Actions.GiveGroup(...); AIArmy[2] := Actions.GiveGroup(...); AIArmy[3] := Actions.GiveGroup(...); end; procedure OnTick; var TargetUnit: Integer; I: Integer; begin //AI gets reinforcements after 1 minute if States.GameTime = 600 then begin SetLength(AIArmy, Length(AIArmy)+2); //Allocate space to store 2 extra items //The last item in the array will be Length(AIArmy)-1, and the second last item -2 //these are the extra 2 spaces we added, in this case 4 and 5 because the array length is now 6 and before it was 4 AIArmy[Length(AIArmy)-2] := Actions.GiveGroup(...); AIArmy[Length(AIArmy)-1] := Actions.GiveGroup(...); end; //Player's closest unit is attacked after 10 minutes if States.GameTime = 6000 then begin TargetUnit := States.GetClosestUnit(0, 20, 30); //Player 0's closest unit to 20, 30 if TargetUnit <> -1 then //All the player's units might be dead for I:=0 to Length(AIArmy)-1 do if not States.GroupDead(AIArmy[I]) then Actions.GroupOrderAttackUnit(AIArmy[I], TargetUnit); end; end;
Note that using a dynamic (resizable) array as a global variable won't work in r5116, but it will work in the next RC.
You don't have to use the array if you don't want to, I was just showing what's possible. You could also do something like:
AIGroup1 := Actions.GiveGroup(...);
AIGroup2 := Actions.GiveGroup(...);
AIGroup3 := Actions.GiveGroup(...);
and
Actions.GroupOrderAttackUnit(AIGroup1, TargetUnit);
Actions.GroupOrderAttackUnit(AIGroup2, TargetUnit);
Actions.GroupOrderAttackUnit(AIGroup3, TargetUnit);

Cheers,
Lewin.
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 06 May 2013, 00:01

Re: New Dynamic Script Ideas

This is what I already had, in my layman's terms this is pretty much 'giving an ID to a group', but I understand the groups already have an ID and I assign them to Scout1, Scout2, etcetera. :P
  Code:
Scout1 := States.GroupAt(62, 39); Scout2 := States.GroupAt(62, 44); Scout3 := States.GroupAt(65, 39); Mil1 := States.GroupAt(25, 50); Mil2 := States.GroupAt(30, 50); Axe1 := States.GroupAt(17, 41); Bow1 := States.GroupAt(36, 47); Bow2 := States.GroupAt(19, 37); Lance1 := States.GroupAt(36, 50); Sword1 := States.GroupAt(25, 46); Sword2 := States.GroupAt(37, 44); Xbow1 := States.GroupAt(14, 51); Xbow2 := States.GroupAt(52, 34); Pike1 := States.GroupAt(19, 52); Pike2 := States.GroupAt(48, 38);
I'll try to figure something out with your examples, thanks. :)
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 06 May 2013, 14:23

Re: New Dynamic Script Ideas

Another idea, not important but could be a nice addition: a script command to change music. To me, and probably to many others as well, music is very important for gameplay experience. Ever played a horror game or watched a scary movie without sound? I'm sure it wasn't as intense. It would be awesome to have 'Struggle' play on the background when half your village is destroyed, or 'The Mercenary' when the allied reinforcements arrive... :)
<<

Vas

User avatar

Rogue

Posts: 55

Joined: 17 Sep 2010, 22:00

Post 06 May 2013, 21:29

Re: New Dynamic Script Ideas

I was thinking about playing sounds while gameplay. For example sound of a bugle when the enemy attacks.. You could create great atmospheres
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 09 May 2013, 07:58

Re: New Dynamic Script Ideas

People might object to you changing their music, especially if they're overridden the default music with their own (you are free to add/replace the music if you want to play your own music without using an external player)

We've considered a command for playing sounds, but it could be easily be overused or annoy people, then people might want an option to disable script sounds. For example, people might use it for in-game story narration or to play their own music at certain times, which a lot of people wouldn't like. You also need to consider that sound people play without sound, so sounds should not be used as the only way to notify the user about something. We might add it, in general we like the idea of giving script authors more control, but we're still undecided.
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 09 May 2013, 08:20

Re: New Dynamic Script Ideas

Maybe the 'scripted' music just shouldn't work if the player has disabled his KaM music? I think most people use a media player on the background rather than overwrite KaM music with their own.
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

Location: California - Pacific Time (UTC -8/-7 Summer Time)

Post 09 May 2013, 09:38

Re: New Dynamic Script Ideas

Forgive me for relating to AoE again, but the powerful editor there is a great source for ideas and inspiration. In AoE II, there is a trigger to play sounds. If a scenario author wanted to have custom music he would play his mp3 sounds in the custom sound folder and then he would have a looping trigger play the same track(s) over and over. He could also disable the music or change it at any time to fit the storyline of the scenario. In the readme for these scenarios, the author would specify that there is a special track and that the player should disable the music for the game so the two musics wouldn't compete.

This doesn't really help the Dark Lord's point on making "struggle" the activated music, because it wouldn't really work with this method (after-all, the in-game music is off this way), but I think that it is not needed anyway. For example, I took some music out of the game because there are tracks that I don't like. Struggle is one of them. Other users may have done the same, and "track switching" might have issues with this.
We've considered a command for playing sounds, but it could be easily be overused or annoy people...
To be blunt, I completely disagree with this. I don't see the logic here, because it ignores the real issue. Map authors don't need the ability to play sounds to annoy people. Authors can spam the same object 1000+ times on a map (which would be really annoying!) but do we disable objects? of course not. Authors could spam wolves in player bases with scripting. do we remove dynamic scripts all-together? Again, no. These are problems with the map author and not the command/feature itself. If the author makes a crappy/annoying scenario with abused sounds, nobody is going to play it; just like many poor-quality map[s that are in the remake. Granted, for example, an author could play a "scare" sound half way through a scenario to troll people (A very loud noise of a woman screaming, for example), but again, players can cause crashes with bad code for trolling, too. As I said before: These are all just flaws with map-makers, not commands/features.
I used to spam this forum so much...
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 10 May 2013, 03:41

Re: New Dynamic Script Ideas

The more I think about it the more I think changing tracks shouldn't be possible through script.

I mostly agree with your logic on playing sounds Ben. I'll discuss it with Krom. But what if people start using it to play story narrations/voiceovers? Then people with other languages can't understand it and won't like it. Or playing soldier voices in their specific language (like "Charge" when the enemy attacks)? We'd like to discourage people from doing that, it will make missions language specific and unable to be shared.
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 10 May 2013, 08:44

Re: New Dynamic Script Ideas

Well I don't see a problem, you could just not add missions with voiceovers to the Remake.
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

Location: California - Pacific Time (UTC -8/-7 Summer Time)

Post 10 May 2013, 13:22

Re: New Dynamic Script Ideas

I mostly agree with your logic on playing sounds Ben. I'll discuss it with Krom. But what if people start using it to play story narrations/voiceovers? Then people with other languages can't understand it and won't like it. Or playing soldier voices in their specific language (like "Charge" when the enemy attacks)? We'd like to discourage people from doing that, it will make missions language specific and unable to be shared.
Vas is already doing this, and is working on several translations. If a player's language is not available, then he should just not place the narrations/voiceovers into the Remake. If the game is unplayable/hard to understand without the sound effects, then that is a problem of the author, as it is proper to have more ways of knowing what is happening then just sound because of people with disabilities ;)
I used to spam this forum so much...
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 10 May 2013, 13:43

Re: New Dynamic Script Ideas

I mostly agree with your logic on playing sounds Ben. I'll discuss it with Krom. But what if people start using it to play story narrations/voiceovers? Then people with other languages can't understand it and won't like it. Or playing soldier voices in their specific language (like "Charge" when the enemy attacks)? We'd like to discourage people from doing that, it will make missions language specific and unable to be shared.
Vas is already doing this, and is working on several translations. If a player's language is not available, then he should just not place the narrations/voiceovers into the Remake. If the game is unplayable/hard to understand without the sound effects, then that is a problem of the author, as it is proper to have more ways of knowing what is happening then just sound because of people with disabilities ;)
Translations work fine with custom campaigns, and so do translated audio mission briefings (which play BEFORE the game starts). I was talking about in-game audio, if a scripter chooses to use it to play audio narrations then it won't work so well with translations, unless we allow some way to for a different audio file to be used depending on the user's language. But it's not a problem, we can deal with that if it happens.

Return to “Ideas / Suggestions”

Who is online

Users browsing this forum: No registered users and 13 guests