Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 29, 2016 21:20:01 GMT 1
Right; well, from time to time an idea pops up (even though I'm not that active on the game) . I've never did much with scripting, so I need some assistance. - Would it be possible to write a genuine script that is easy to place in, say, existing scipts of the game? - Is it possible to script units; vehicles, humans, that when they have a certain amount of damage, they return to a locator somewhere on the map. So the effect is like an 'retreat' and more chance to save the unit. This possibility as well for the 'enemy'..
Can this be done?
|
|
|
Post by ariete on Jun 29, 2016 21:33:44 GMT 1
- Would it be possible to write a genuine script that is easy to place in, say, existing scipts of the game?
i don't understood, substitute a lua file? if all origin points are reported, yes!
- Is it possible to script units; vehicles, humans, that when they have a certain amount of damage, they return to a locator somewhere on the map. So the effect is like an 'retreat' and more chance to save the unit. This possibility as well for the 'enemy'..
everything is possible, a retreat also for example if the infantries sight heavy tanks. but i don't know. Q knows ... anyway you have to assign a script id to that group of units and then write in lua this condition. i repeat, i don't know how write
|
|
|
Post by Quintaxel on Jun 29, 2016 21:35:18 GMT 1
Tried this once without success so far. The challenge here is to find out if and to what extend a unit is damaged. So you would need to get the unit's healthpoints. As far as I know there is no KB Lua funtion to retrieve this information for a unit. For other objects like buildings this is possible.
|
|
|
Post by ariete on Jun 29, 2016 21:37:09 GMT 1
you could avoid the problem counting the number of units of that group, instead their healt
|
|
|
Post by Quintaxel on Jun 29, 2016 22:00:57 GMT 1
ariete, you could do this in some cases but and you would need to create scriptgroups. Say you create a scriptgroup of 3 units then you could check the number of units in that group. When the number of tanks is less than 3 then you could trigger a retreat. But then you would already have lost a unit. What I did once is to check if units stands a fighting chance in battle. Say that 2 medium armoured units encounter 1 or more heavy units then retreat of the medium units is the best option. The AI does take this option but this can be arranged through the script.
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,124
|
Post by kaoz on Jun 29, 2016 22:12:18 GMT 1
According to Calvin's Lua Guide GetObjectHPs only works on objects, not units. And personally, i do not always trust GetObjectHPs as it has failed on me a few times when i used it on buildings.
Calvin's Lua Guide gives no other option, except maybe: GetUnitMorale(iScriptID) · Returns the 1 value for all units other than infantry unit · Note : I am not sure of the useful of this command !
I doubt whether it's possible what you want to achieve. Might be easier to check whether the unit is dead or not and send reinf (same unit) when dead.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 30, 2016 7:51:43 GMT 1
Tried this once without success so far. The challenge here is to find out if and to what extend a unit is damaged. So you would need to get the unit's healthpoints. As far as I know there is no KB Lua funtion to retrieve this information for a unit. For other objects like buildings this is possible. Alright. Thanks for the information guys. I will get deeper into this with the suggestions you all gave. @quin.: The unit healthpoints is something I like to study more. I want to find out how this works since for infantry there must be some sort of Lua? function, since at certain damage, they call for a medic. For tanks there is a 'track damage' indication so maybe from this point some trigger functions could be possible. @ Kaoz: ofcourse move the units back by manual action, or send reinforcements. I just like the 'realism' idea. And especially for the enemy units. At certain point a negative outcome would make an attack useless and better to retreat. But I think it will need some heavy scripting for enemy to retreat-regroup and launch second attack. A script maybe is possible to write for when a certain amount of units is lost, new reinforcements are sended.
|
|
|
Post by Quintaxel on Jun 30, 2016 9:46:21 GMT 1
If we can get the healthpoints or track damaged status then this would open a whole lot of new scripting possibilities. You could then write a scripts that checks the status of units periodically and acts on that status. I just have no idea on how to retrieve these variables in Lua. As far as we know, there is no BK function for this
|
|
kaoz
General
inter faesces et urinam nascimur
Posts: 1,124
|
Post by kaoz on Jun 30, 2016 11:58:49 GMT 1
I am curious and trying to understand Boltz' explanation there. Too bad the link to the example script doesn't work :-(
|
|
|
Post by ariete on Jun 30, 2016 13:16:32 GMT 1
What I did once is to check if units stands a fighting chance in battle. Say that 2 medium armoured units encounter 1 or more heavy units then retreat of the medium units is the best option. The AI does take this option but this can be arranged through the script. i know Q , i thiked this your knowledge around could help the trouble of vonosten as far i remember, every choice by the AI could be conditioned trough the scripts functions, just assigning IDscript to a certain amount of units which have to answer to that condition about healt of the units, maybe there's much more to study yet ... mmm not properly my cup of tea, i would say ..
|
|
|
Post by Quintaxel on Jun 30, 2016 13:26:08 GMT 1
I am curious and trying to understand Boltz' explanation there. Too bad the link to the example script doesn't work :-(
The purpose of the script is different, yet also interesting . The script stops repair units from moving to a unit that needs repairing. When a unit is damaged then the AI will move a repair unit (that is connected to a warehouse) to the damaged unit. This happens even if the damaged unit is under attack. The script will prevent the unit from moving outside a defined perimeter. The damaged unit will have to move within that perimeter to get repaired. Edit: I'm a bit busy right now but I'll see if I can get the example.
|
|
|
Post by Scyooff on Jun 30, 2016 14:36:55 GMT 1
I've downloaded the contents (web pages and files linked to them) of the Boltz's memo in the beginning of this year here are them
|
|