Map Database  •  FAQ  •  RSS  •  Login

New Dynamic Script Ideas

<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 01 Mar 2015, 09:46

Re: New Dynamic Script Ideas

I guess you could give a player one special unit alike Barbarian and call him a "hero" ;-)
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
<<

Esthlos

User avatar

Knight

Posts: 676

Joined: 23 Jun 2013, 16:02

KaM Skill Level: Beginner

Post 01 Mar 2015, 09:51

Re: New Dynamic Script Ideas

I guess you could give a player one special unit alike Barbarian and call him a "hero" ;-)
In AED12 (or 11, depends on the version of the campaign) for example the player loses if his king gets killed.
The king is a Knight, as no other unit type would fit the role and as far as I remember a few TPR units are given as reinforcements, which fits the plot.

Having a way to differentiate him from the other Knights would be very handy in my opinion.

(P.S. It's been a while that you're no longer answering my PMs... did you receive them? (?) )
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 11 Aug 2015, 17:06

Re: New Dynamic Script Ideas

I'd like to have fallowing State in the next Release of the Remake:
  Code:
States.GroupAssignedToDefencePosition(GroupID, X, Y)
Returns true if target Group is assigned to the Defence Position on Coordinate X, Y.

Here an Example:
  Code:
var iAttackGroup: Integer; var bAttack: Boolean; procedure OnMissionStart(); begin Actions.AIDefencePositionAdd(1, 10, 20, 0, 0, 20, 1); iAttackGroup := 0; end; procedure OnWarriorEquipped(aUnitID, aGroupID: Integer); begin if States.GroupOwner(aGroupID) = 1 and iAttackGroup = 0 then begin if States.GroupAssignedToDefencePosition(aGroupID, 10, 20) then aGroupID := iAttackGroup; if iAttackGroup <> 0 and States.GroupMemberCount(iAttackGroup) = 12 then bAttack := true; end; procedure OnTick() begin if bAttack then begin Actions.GroupOrderAttackHouse(iAttackGroup, States.HouseAt(50, 50)); bAttack := false; end; end;
<<

thibmo

User avatar

Council Member

Posts: 124

Joined: 03 Aug 2015, 09:12

KaM Skill Level: Skilled

Website: https://kp-wiki.org/

Location: the Netherlands

Post 11 Aug 2015, 20:37

Re: New Dynamic Script Ideas

I find it strange that nobody asked this yet (but I can't remember where did you post the link with the proposed features, so I can't actually check this :$ ), but can we please have an Actions.HouseLock command, to do the opposite of Actions.HouseUnlock?
HouseAllow(false) it will do the job :P
Thank you.

I knew this (used it in Golden Cliffs - Bonus), but it disables wares' distribution for that building too, and if the unlock was supposed to be temporary then there needs to be dedicated scripting to re-enable it when the time comes in the construction tree... a HouseLock command would have none of these cons, and would in my opinion be a more elegant way of reverting HouseUnlock.
I'd try the following: HouseAllow(aPlayerIndex, aHouseType: Word; aAllowed: Boolean);
And as far as I know it didn't block wares?
Must give it a double check.

//Edit: Confirmed to work -->
1. Image
2. Image
~~ The magic wizard of PascalScriptus. ~~

KP-Wiki :
  • Information about Knights Province scripting ( unofficial )
  • Information about several hosting/server maintenance basics
  • Other random stuff
<<

Strangelove

User avatar

Crossbowman

Posts: 230

Joined: 30 Jul 2013, 06:32

KaM Skill Level: Fair

Post 18 Aug 2015, 19:55

Re: New Dynamic Script Ideas

Those 2 Actions would be a blessing!
  Code:
Actions.AddAIAttack(Player Index, Target, Soldier Amount, Initial delay, Melee Group Count, Antihorse Count, Ranged Count, Mounted Count: Integer; Random Groups, Repeating: Boolean); Actions.RemoveAllAIAttacks(Player Index);
<<

thunder

User avatar

Moorbach's Guard

Posts: 1044

Joined: 15 Apr 2012, 12:11

KaM Skill Level: Fair

Location: In the Market

Post 28 Apr 2016, 22:41

Re: New Dynamic Script Ideas

Hi,
Today Finaly I could figurate out how the Hello word is working on the overlay:D step by step forward:)

I would like to ask, is there any speciel command which could help to me count speciel type of citizens (unittype) and killing them?
For example I would like to kill only the butchers, or I would like to kill only miners with script. Kill them silent in the same time and I need to know how many citizens were killed by this script.
Should I register all citizens in an array? How could I identify them?
does every unit have speciel/uniqe ID? (or just the unit ID avaiable? like stoner has 10 or labourer have 9)
Thank you for the helps!
t
<<

Toxic

Rogue

Posts: 50

Joined: 22 Feb 2017, 19:04

Post 26 Feb 2017, 13:34

Re: New Dynamic Script Ideas

When you want to create a map via script (actions: MapTileSet, MapTileHeightSet, MapTileObjectSet for each tile) in Events.OnMissionStart the map will be loading for at least 10 second at my High-end Pc (loading with same script without those actions takes less than 1 sec). I expect that those commands have to do much more than just to change textures. In result this means repeated process which requires to calculate 256*256 tiles.
Is there a way how to make loading of maps generated via script faster? Maybe something like Events.OnMissionLoad which will allow me to change tiles using actions in this function at once before game start analizing map tiles.

Second idea - to set random number generator using seed (for example if script generates a nice map and you want play it again).
  Code:
States.GetSeed() - return you seed of random number generator Actions.SetSeed() - to set seed of random number generator
And third - to set parameters (constants) of your script in game. For example from chat menu in multiplayer, there could be this option (I have scripts which limit number of towers, send resources to teammates with specific ratio, change difficulty). So you do not have to create new map with specifics script parameters over and over again.
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 26 Feb 2017, 14:13

Re: New Dynamic Script Ideas

"When you want to create a map via script" - why would you want to create it every time when you can create it once in MapEd?

"to set random number generator using seed" - maybe it's better to use your own seed and RNG in the script?
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
<<

Toxic

Rogue

Posts: 50

Joined: 22 Feb 2017, 19:04

Post 26 Feb 2017, 14:48

Re: New Dynamic Script Ideas

"When you want to create a map via script" - why would you want to create it every time when you can create it once in MapEd?
Because when you create map in map editor it will be always same. I am talking about completely randomly generated map (I already made it).
"to set random number generator using seed" - maybe it's better to use your own seed and RNG in the script?
Ok. :'(

Is there any chance to set parameters (seed) of script from game?
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 26 Feb 2017, 17:48

Re: New Dynamic Script Ideas

Dynamic scripts were never intended to be used in such a way. They are inherently "slow".

A better approach would be to add random-map-generation code into KaM Remake itself (or another standalone tool).
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
<<

Ben

User avatar

Former Site Admin

Posts: 3814

Joined: 08 Jan 2009, 23:00

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

Post 26 Feb 2017, 17:52

Re: New Dynamic Script Ideas

Toxic, with the exception of the slow creation speed, is this script of your working? I would be interested in seeing it.
I used to spam this forum so much...
<<

Krom

User avatar

Knights Province Developer

Posts: 3280

Joined: 09 May 2006, 22:00

KaM Skill Level: Fair

Location: Russia

Post 26 Feb 2017, 18:17

Re: New Dynamic Script Ideas

I'd like to see some examples of its work too
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
<<

Toxic

Rogue

Posts: 50

Joined: 22 Feb 2017, 19:04

Post 27 Feb 2017, 19:06

Re: New Dynamic Script Ideas

... is this script of your working?
Sure. I made new topic:

http://www.knightsandmerchants.net/foru ... =32&t=3231
<<

Esthlos

User avatar

Knight

Posts: 676

Joined: 23 Jun 2013, 16:02

KaM Skill Level: Beginner

Post 02 Mar 2017, 11:20

Re: New Dynamic Script Ideas

For campaigns: Actions.SetNextMission(MissionNumber: Integer);

This would allow for interactive campaigns... for example: in mission 3, you have an allied town.
If you save it, you go to mission 4, where you help them and gain their support for later.
If you don't save it, you obviously need to skip mission 4, so you go straight to mission 5 using Actions.SetNextMission(5).

Another example: mission 2 is an "homebase" mission, so OnMissionStart of every mission you say Actions.SetNextMission(2), and you save and restore the homebase's state in the campaign-wide variables; this way, you can effectively visit your main town after every mission, and even treat all the other maps as expeditions.

Pwease?
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"
<<

thibmo

User avatar

Council Member

Posts: 124

Joined: 03 Aug 2015, 09:12

KaM Skill Level: Skilled

Website: https://kp-wiki.org/

Location: the Netherlands

Post 02 Mar 2017, 12:04

Re: New Dynamic Script Ideas

For campaigns: Actions.SetNextMission(MissionNumber: Integer);
I think this might bring a challenge.

How will you be able to complete the campaign, then?
Maybe a command like Actions.LoadMap(aMapName: string); // Must be in the same directory
Would be better. Then you could load a new map file whilst keeping the script values.
Then you keep one single mission that you can present as a campaign-like mission.

For the question 'how about loading a save-game?' : This might require a change in the save file. ( Which is a good thing, as that's the requirement for a new release IIRC :P )
~~ The magic wizard of PascalScriptus. ~~

KP-Wiki :
  • Information about Knights Province scripting ( unofficial )
  • Information about several hosting/server maintenance basics
  • Other random stuff

Return to “Ideas / Suggestions”

Who is online

Users browsing this forum: No registered users and 5 guests