Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > MapHaven Guild > Thread: Scripting for AI boost - any help?
Thread: Scripting for AI boost - any help?
Zilonite
Zilonite


Famous Hero
posted September 04, 2008 10:47 AM

Scripting for AI boost - any help?

Hi all,

Does anyone know how to write scripting command that would add resouces to particular player only in case if that player is AI? Any help appreciated...

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted September 04, 2008 12:12 PM
Edited by Warmonger at 12:12, 04 Sep 2008.

If AI cheats are not enought for you, then... we have a trouble. There is no known function which returns player controller. You may want to try IsComputer (ATTACKER) combat script placed somewhere at the beginning.

There is also GetPlayerState() function, however I did not find out what type of argument does it need and what it gives in return.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Asheera
Asheera


Honorable
Undefeatable Hero
Elite Assassin
posted September 04, 2008 01:17 PM

Actually, in 3.1 there is a new function for testing if a particular player is AI

IsAIPlayer(player_id) -- returns 0 if specified player is human, and 1 otherwise


An example to give 10 Wood to Player 1 if it is AI:

function GiveAIResources()
  if IsAIPlayer(1) then
    SetPlayerResource(1, 0, GetPlayerResource(1, 0) + 10)
  end
end

____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted September 04, 2008 01:30 PM

Ok, I think I'll have to install this 3.1 then

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Asheera
Asheera


Honorable
Undefeatable Hero
Elite Assassin
posted September 04, 2008 03:04 PM

You didn't install it yet?
____________

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Warmonger
Warmonger


Promising
Legendary Hero
fallen artist
posted September 04, 2008 04:24 PM

It was just yeasterday when I saw NCF for patch 3.1

I'm also afraid that my NCF editor now won't work at all

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SimonaK
SimonaK


Promising
Supreme Hero
posted September 04, 2008 09:31 PM
Edited by SimonaK at 21:33, 04 Sep 2008.

Quote:
It was just yeasterday when I saw NCF for patch 3.1

I'm also afraid that my NCF editor now won't work at all



NCF editor 3.0 works in 3.1 environment even if it still crashs sometimes
for same reasons that before.

morevoer, unknown reasons.

After some research of my share, it seems that editor crashs with slot 300 and high.

but I'm really not sure.

In fact, I don't know why editor has a bug.

it must find the bug's explication before updating to NCF editor 3.1

Don't forget too: H5's rmg crashs in NCF .exe

This is probably unfixable.

NCF hacking EXE can have limit.

This limit is maybe reached about editor.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
SimonaK
SimonaK


Promising
Supreme Hero
posted September 04, 2008 09:53 PM
Edited by SimonaK at 21:57, 04 Sep 2008.

Quote:
Actually, in 3.1 there is a new function for testing if a particular player is AI

IsAIPlayer(player_id) -- returns 0 if specified player is human, and 1 otherwise
function GiveAIResources()
  if IsAIPlayer(1) then
    SetPlayerResource(1, 0, GetPlayerResource(1, 0) + 10)
  end

An example to give 10 Wood to Player 1 if it is AI:


end



yes!

does exist a function to skip turn and another to timing?

then, we could create a script for AI when it take a too long time to play.

example:

function KickAITurn()

  if IsAIPlayer(1) And TimeElapsed() >= 600 then
    SkipTurn(1)
  end
end







 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Zilonite
Zilonite


Famous Hero
posted September 05, 2008 08:02 PM

Tnx everyone for help! "IsAIPlayer" works quite well

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0237 seconds