deestar12 / keeperfx

Automatically exported from code.google.com/p/keeperfx
0 stars 0 forks source link

Change alliance during gameplay by script #518

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What game elements does the new feature/behavior concern?
Alliance should be able to be changed by script during gameplay. ( AI 
orientated )

Where exactly inside the game should it be accessible?
I have no idea, what is the mean of this question? But in single player - mode

Under which conditions should it be triggered?
Script

How exactly should the new feature work?
IF(PLAYER0,TOTAL_CREATURES > 20
SET_ALLY_PLAYERS(PLAYER_GOOD,PLAYER1,1)
ENDIF

For example

Please provide any additional information below.

As making a brand new campaign from a scratch, as having a plot in campaign, 
this enhancement would be outstandingly awesome. No idea is it even possible to 
do it yet, if not have rewritten exact things over, but if there is possibility 
to do so, then I say there is a bug, as it won't work at all.

Please, if you have immediately answer, let me know it!

Good. ( I hope I or anyone else haven't done similar in 3 months, if there is, 
please give a link. Sometimes I forgot things before need to remember. )

Original issue reported on code.google.com by UnknownM...@Hotmail.com on 26 Feb 2015 at 8:54

GoogleCodeExporter commented 8 years ago
"but if there is possibility to do so, then I say there is a bug, as it won't 
work at all."

Lol, I tried to say, if there is already available to do so, instead of 
possibility to do so, but I think it's not big deal.

Original comment by UnknownM...@Hotmail.com on 26 Feb 2015 at 8:56

GoogleCodeExporter commented 8 years ago
There is: https://code.google.com/p/keeperfx/wiki/NewLevelScriptCommands

ALLY_PLAYERS(PLAYER1,PLAYER2,1)

Original comment by Loobinex on 26 Feb 2015 at 9:06

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Deleted comment: Adding new:

As I told, it does not work at all.

I mean I tried to change an alliance between Heroes and Player3. Did not work. 
I do not remember have we discuss this before, as it went to be an on hold and 
started it again. It does not work.

Like if having an action point, where it does changing an alliance. But nothing 
happens. Heroes still starts to attack Player 3, no matter what is the deal. 

Original comment by UnknownM...@Hotmail.com on 26 Feb 2015 at 9:41

GoogleCodeExporter commented 8 years ago
I think it is not even possible, as creating hero party, which is designed to 
deal with player 3, won't be changed as hero party created is designed to 
attack player 3. Changing this during a gameplay isn't a possible, as then 
there must be a changement for heroes to switch ally/non ally.

I have an idea.

How about creating hero party like this:
 ( An example )

CREATE_PARTY(FIRST_STRIKE)

ADD_TO_PARTY(FIRST_STRIKE,FAIRY,1,0,ATTACK_DUNGEON_HEART,3/0)
ADD_TO_PARTY(FIRST_STRIKE,ARCHER,1,0,ATTACK_DUNGEON_HEART,3/0)
ADD_TO_PARTY(FIRST_STRIKE,ARCHER,1,0,ATTACK_DUNGEON_HEART,3/0)

If alliance is off/on OR:

CREATE_PARTY(FIRST_STRIKE)

ADD_TO_PARTY(FIRST_STRIKE,FAIRY,1,0,ATTACK_DUNGEON_HEART,3/RANDOM)
ADD_TO_PARTY(FIRST_STRIKE,ARCHER,1,0,ATTACK_DUNGEON_HEART,3/RANDOM)
ADD_TO_PARTY(FIRST_STRIKE,ARCHER,1,0,ATTACK_DUNGEON_HEART,3/RANDOM)

if alliance is off, attack to player 3, if on, attack to random enemy keeper.

Possible? Needs to be rewrite the thing all over I assume.

Original comment by UnknownM...@Hotmail.com on 26 Feb 2015 at 9:45

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I don't know what your problem is exactly, but setting and breaking alliance 
during the game works.

Play the attached test map.
1. Throw the troll in with the knight and see him get attacked. Remove the 
troll.
2. Create an imp - they are now allies. Throw the troll in and see they don't 
fight.
3. Create an imp - no longer allies, they start to fight. Remove the troll.
4. Go back to step 1.

Original comment by Loobinex on 26 Feb 2015 at 11:07

Attachments:

GoogleCodeExporter commented 8 years ago
Yeah, but try the same with Hero Party. 

Which is guided to attack enemy keeper. And an exact game turn, when it is 
passed by 3000 or so in time, look, if something changed.

In my script, they start with alliance, or no alliance, regardless of what says 
the script. It does not make any difference to hero parties.

Original comment by UnknownM...@Hotmail.com on 27 Feb 2015 at 6:19

GoogleCodeExporter commented 8 years ago
Sorry for double post but

I can do a fix though by putting ADD_CREATURE_TO_LEVEL instead of 
ADD_PARTY_TO_LEVEL, if it does count on that way. I haven't tested it trough 
yet, as have to do fix on ther and fix on there, but please, if you have time, 
try with a hero party. If you can make it work, then I send my script and map 
to see what is the real problem.

Original comment by UnknownM...@Hotmail.com on 27 Feb 2015 at 6:24

GoogleCodeExporter commented 8 years ago
OK, attached level for easy reproduction. (Use reveal map dungeon special)

Two issues:
 * Heroes do not trigger action points.
(To see, just wait until white reaches blue without triggering a message)

 * When a hero moves out, he will ignore the alliance.
(Build a treasure tile right away and green will be destoyed. If however you 
wait until the reaper starts walking south, blue will be destroyed)

Original comment by Loobinex on 27 Feb 2015 at 7:19

Attachments:

GoogleCodeExporter commented 8 years ago
Doesn't work if they have already started to attack, I test more

Original comment by UnknownM...@Hotmail.com on 27 Feb 2015 at 8:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Both tests what I did carefully, does not function at all:

In level 1 version: It does work, but only on to one side. I mean, what if I do 
not have an imp anymore, should they break their alliance, yes, but it doesn't

The level 2 version: No matter what is the case, Heroes always destroys blue 
keeper.

No matter what is the situation, once they have started to attack, they won't 
stop it at all, unless picked up, or something else unknown thing

Original comment by UnknownM...@Hotmail.com on 27 Feb 2015 at 8:15

GoogleCodeExporter commented 8 years ago
I don't understand exaclty what you are saying, but I think you're trying to 
say the same thing I was. Using the last file I posted you can see 2 problems 
with the software.
1. Heroes cannot trigger action points
2. Once an attack starts, they will continue the attack even if you change the 
alliance.

Original comment by Loobinex on 27 Feb 2015 at 11:10

GoogleCodeExporter commented 8 years ago
Should this issue be retested after r1703?

Original comment by Loobinex on 12 Apr 2015 at 11:37

GoogleCodeExporter commented 8 years ago
No need, I haven't worked on that.

Original comment by mefistotelis on 13 Apr 2015 at 7:15

GoogleCodeExporter commented 8 years ago
Checked 1 - Heroes cannot trigger action points.

I think they could trigger APs; I'm not completely sure because now I rewrote 
the AP trigger function.

Anyway, that function is called once every 32 turns. This means that the 
creature needs to be 32 turns within the AP range to give certainty that it's 
triggered.

This interval could be tweaked a bit, but we definitely shouldn't check APs 
every turn. This game is RTS, after all.

To make these fast heroes trigger action point while running, increase action 
point range to 10 subtiles. Or place a door on path.

Original comment by mefistotelis on 13 Apr 2015 at 10:11

GoogleCodeExporter commented 8 years ago
I did some changes to the checking, it should now be much easier to detect 
creatures within AP. But I still wouldn't recommend range below 3.

I also fixed door and object fight to check whether we're still battling an 
enemy.

Please verify.

Original comment by mefistotelis on 13 Apr 2015 at 11:17

GoogleCodeExporter commented 8 years ago
Fixed in r1709. Both.

Original comment by Loobinex on 14 Apr 2015 at 11:52