Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
It still didn't work I also tried with
$SetThreadInterval (ThisAgent's "EventScript", $Random_Time ( 180 ));
But, really, thanks man, I wasn't expecting help.
If you want something to be called periodic you need place where you can store that function. It can be any unit or building or agent or prototype.
If it is a quest then you can store this function in AIRootAgent. Most quest variables and functions are stored there.
If it is a mod then... I recommend to start with the quest to learn a bit how it works.
Big map You can get easy reference how to setup periodic functions here. This is empty big map quest with periodic monsters spawning. Download it. Look it up in steam workshop folders and take a look at the map .gpl file.
I just don't get it, there are some mods I've downloaded and even if I follow the exact same logic it still doesn't work.
What is wrong here exactly? Sorry if I sound whyny or frustrated.
Function recruitment2 ( agent ThisAgent )
Declare
list Palaces;
agent Palace, ThisAgent;
string Hero_Type;
Begin
Palace = $GetPalace (ThisAgent);
if ($isvalidgamepiece(palace))
begin
//Doesn't matter which palace does the spawning;
Palaces = $ListPalaces ();
Foreach Palace in Palaces do
begin
Hero_Type = $Random_Hero_Type ( Palace );
$SpawnUnit ( Palace, Hero_Type, $RandomEdgeCoord ( $randomnumber ( 4 )), $GetUnitPlayerNumber ( Palace ));
end
end
$SetThreadInterval ( $recruitment2, $Random_Time ( 180 ));
End
The fact that it exists in your mod doesn't automatically executes it. I just want to establish what your level of coding is.
The first thing that would help you to understand is to download big map quest and look at its code. It is really easy to understand and modify. Then you can move on
So that is what the problem is?
It's weird, since I've downloaded some mods for reference I've seem some of them creating new functions but nowhere else i've seen that function being called, I tought all it was needed was to just compile a gpl on the RGS the function and it would run by default.
So there is no way to do what I'm trying to do? (reinforcements mod for all quests).
My idea actually is to replace the recruitment of heroes with this function I'd later make it work like the embassy does. I've worked on how to disable the recruitment of heroes but keeping the guilds intact, it's a shame we can't edit the UI.
My level of coding is not so good, but I've done some big things on some other games like Darkest Dungeon, mostly by being stubborn.
So I tried storing this code on the following function
///////////////////////////////////////////////////////////////////////////////
// This function is called before the first frame of the game
// it is needed to force the palace's upgrade button to be correct
// IT ALSO sets thisagent to title palace if it is an outpost
// This is run AFTER all the birthscripts for units have run
function Palace_Pre_Birth( agent thisagent )
Declare
list Palaces;
agent Palace;
string Hero_Type;
Begin
Palace = $GetPalace (ThisAgent);
if ($isvalidgamepiece(palace))
begin
//Doesn't matter which palace does the spawning;
Palaces = $ListPalaces ();
Foreach Palace in Palaces do
begin
Hero_Type = $Random_Hero_Type ( Palace );
$SpawnUnit ( Palace, Hero_Type, $RandomEdgeCoord ( $randomnumber ( 4 )), $GetUnitPlayerNumber ( Palace ));
end
end
$SetThreadInterval ( $Palace_Pre_Birth, $Random_Time ( 180 ));
End
////////////////////////////////////////////////////////////////////////////////
And it worked but it worked just once, wich means that the function doesn't loop, how can I make it loop? Should I search for another function wich does and insert this code there?
I'd rather learn how to make it loop, since this is one of he only functions that I found that there was no harm in replacing.
function Palace_Pre_Birth( agent thisagent )
Declare
list Palaces;
agent Palace, AIRootAgent;
string Hero_Type;
Begin
Palace = $GetPalace (ThisAgent);
if ($isvalidgamepiece(palace))
begin
//Doesn't matter which palace does the spawning;
Palaces = $ListPalaces ();
Foreach Palace in Palaces do
begin
Hero_Type = $Random_Hero_Type ( Palace );
$SpawnUnit ( Palace, Hero_Type, $RandomEdgeCoord ( $randomnumber ( 4 )), $GetUnitPlayerNumber ( Palace ));
end
end
AIRootAgent = $RetrieveAgent ("GplAIRoot");
AIRootAgent's "SpecialSpawnScript2" = $Palace_Pre_Birth;
$NewThread( AIRootAgent's "SpecialSpawnScript2", 5000,Palace );
End