Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Modding, Customising, Editing » Need help with StrategicEventHandler.lua
Need help with StrategicEventHandler.lua[message #363450] Fri, 02 July 2021 19:15 Go to next message
No-Nothing is currently offline No-Nothing

 
Messages:81
Registered:March 2013
Hello! I need help for my struggle with lua!
I want to understand is it possible for non-coder to at least insert any NPC/RPC on any sector at wish with some simplest script.
I hoped Flugente's Max Payne method would be it, but I failed to exploit it for Eskimo (<uiIndex>65</uiIndex>)
I thought this code were enough
Profil = 
{                   
    FATHER = 100,
    HAMOUS = 63,
    PROF_ICECREAM = 162,
ESK = 65,
    RAT   = 81,
	VINCE = 69,
	STEVE = 80,
	JENNY = 132,
	DARREN = 87,
	TONY = 91,
	DEVIN = 61,
	CARMEN = 78,
	SAL = 99,
	PABLO = 98,
	SPIKE = 93,
	ROBOT = 62,
	JOEY = 90,	
	MADLAB = 146,
	CONRAD = 70,
	KINGPIN = 86,
	MADAME = 107,
	JOHN = 118,
	MARY = 119,
}
	-- Set ESK Payne's location
	if  (not ( ( gWorldSectorX == 2) and ( gWorldSectorY == 2) ) and not MercIsDead(Profil.ESK) ) then
	
--		if ( CheckMiscFlags1(Profil.ESK, Flags1.PROFILE_MISC_FLAG_SAID_HOSTILE_QUOTE) == 0 ) then
		
			AddNPCtoSector (Profil.ESK,2,2,0) 
			SetProfileStrategicInsertionData(Profil.ESK, 12089)
			
		end
		
	end
	-- Set ESK Payne's location

But it seems something else needed
May be this number (SetProfileStrategicInsertionData(Profil.ESK, 12089))?
First I thought it be grid#...
https://freeimage.host/i/oo8OUF
https://freeimage.host/i/oo8Nl1

Report message to a moderator

Corporal 1st Class
Re: Need help with StrategicEventHandler.lua[message #363451 is a reply to message #363450] Sat, 03 July 2021 01:50 Go to previous messageGo to next message
Kitty

 
Messages:466
Registered:October 2017
Location: Germany
No-Nothing wrote on Fri, 02 July 2021 19:15
Hello! I need help for my struggle with lua!
I want to understand is it possible for non-coder to at least insert any NPC/RPC on any sector at wish with some simplest script.
I hoped Flugente's Max Payne method would be it, but I failed to exploit it for Eskimo (<uiIndex>65</uiIndex>)
I thought this code were enough
Profil = 
{                   
    FATHER = 100,
    HAMOUS = 63,
    PROF_ICECREAM = 162,
ESK = 65,
    RAT   = 81,
	VINCE = 69,
	STEVE = 80,
	JENNY = 132,
	DARREN = 87,
	TONY = 91,
	DEVIN = 61,
	CARMEN = 78,
	SAL = 99,
	PABLO = 98,
	SPIKE = 93,
	ROBOT = 62,
	JOEY = 90,	
	MADLAB = 146,
	CONRAD = 70,
	KINGPIN = 86,
	MADAME = 107,
	JOHN = 118,
	MARY = 119,
}
	-- Set ESK Payne's location
	if  (not ( ( gWorldSectorX == 2) and ( gWorldSectorY == 2) ) and not MercIsDead(Profil.ESK) ) then
	
--		if ( CheckMiscFlags1(Profil.ESK, Flags1.PROFILE_MISC_FLAG_SAID_HOSTILE_QUOTE) == 0 ) then
		
			AddNPCtoSector (Profil.ESK,2,2,0) 
			SetProfileStrategicInsertionData(Profil.ESK, 12089)
			
		end
		
	end
	-- Set ESK Payne's location

But it seems something else needed
May be this number (SetProfileStrategicInsertionData(Profil.ESK, 12089))?
First I thought it be grid#...
https://freeimage.host/i/oo8OUF
https://freeimage.host/i/oo8Nl1

My guess would be, that, if you want to achieve something simular as Flugentes Additional Mercs, you'll have to take other files besides StrateticEventHandler.lua in account as well.

His Additional Mercs GameDir2478 also uses AdditionalDialougue, Quest-markers and other sophisticated stuff. This will probably make it harder to track down parts of the addition.

The version from the link is the most up-to-date I'm aware of, but it's for GameDir 2478. You can't just copy the whole lua-script from 2478 to another GameDir, you'll need to transfer the lines you want from 2478 into newer GameDir, as well as all requirements. For instance, I'm not sure if those flags would work 1on1 with other mercs and/or if those may realted to AdditionalDialougue.

There are a few sub-threads at Flugente's Magika Workshop where Flugente describes what he has done for adding this. There is also more on AdditionalDialogue.

Looking at the screenshots, it seems you want to use it on AIMAS and therefore using bigmaps. The GridNo 12089 is likely refering to standard 1.13-maps. Using this on bigmaps probably will be an odd place for adding. Plus, AIMAS is using another vfs-order (the order in which game looks at folders), this may interfere with additions as well and/or would require the lua-script in another Data-Folder to work.

And, I can't see it very well but do may use some increased Teamsize as well? Or is this an AIMAS feature?

What are you planing to do? Can you explain a little more? Maybe there is another way to solve this.







How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: Need help with StrategicEventHandler.lua[message #363452 is a reply to message #363451] Sat, 03 July 2021 13:21 Go to previous messageGo to next message
No-Nothing is currently offline No-Nothing

 
Messages:81
Registered:March 2013
Thank you for respond! I know AIMNAS files structure very well, believe me (did even heavy GUI mods). If I chose wrong location for StrategicEventHandler.lua I wouldn't get that crash!
I used this value first with the same result. It's value of the location of the above screenshot:
SetProfileStrategicInsertionData(Profil.ESK, 88704)
Unfortunately AIMNAS doesn't have increased Teamsize yet and I did no hacks on this! But yes I go there all-out-power with roster full plus some vehicles.
Kitty wrote on Sat, 03 July 2021 01:50
What are you planing to do? Can you explain a little more? Maybe there is another way to solve this.
I'm not fit for learning lua coding top to toe angry , but it is at least doable in text editor without any compilator or similar crap. So I hope to learn this tiny bit coz it's very usefull not only for RPC but also for any kind of NPC, so you have open gates to many tricks & experiments in various JA2mods.
I don't need it exactly in this file. If there is one simpler variant of coding doing the job by means of other files I'd gladly take it! shy
Thus to the point: the task is to insert any character at any place (ideally but probably not possible at any time - so disregard).

[Updated on: Sat, 03 July 2021 13:27]

Report message to a moderator

Corporal 1st Class
Re: Need help with StrategicEventHandler.lua[message #363523 is a reply to message #363452] Tue, 20 July 2021 10:38 Go to previous messageGo to next message
Vritran is currently offline Vritran

 
Messages:199
Registered:February 2020
Location: North East England
Do you actually need to use lua to place an RPC/NPC on the map? Thought placement was MercProfiles.xml and placing the character on the map with map editor.

I've moved Pablo from his Arulco Revisited airport back to the original. Had no issues...

If my understanding is correct the lua stuff would be used to add variables or conditions.

Report message to a moderator

Staff Sergeant
Re: Need help with StrategicEventHandler.lua[message #365619 is a reply to message #363523] Sat, 05 August 2023 21:32 Go to previous messageGo to next message
todd0001 is currently offline todd0001

 
Messages:42
Registered:November 2017
Let's start.
In GAMEINIT.I cut and pasted a section that you see here. I copied and pasted it right after this.
if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.Bob, 8, SectorY.MAP_ROW_F, 0 )
end

So......for you;


if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.Bob, 8, SectorY.MAP_ROW_F, 0 )
end
if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.RPC65, 8, SectorY.MAP_ROW_F, 0 )
end


Worked for me.
Add this to GameInit.lua
Mod location in MercPro.xml
Add with mapeditor( profile I.Id.)

To make recruitable;
You need a portrait in the Faces folder with a "B" in front(90x100).
You need a script to handle recruitment. I copied one that worked(I think 72.maddog be best but I first used 229.EDT AND 229.NPC). These go in the NPCData folder.
Start new game cause of MercPro.xml

[Updated on: Sat, 05 August 2023 21:59]

Report message to a moderator

Corporal
Re: Need help with StrategicEventHandler.lua[message #365621 is a reply to message #365619] Sun, 06 August 2023 08:43 Go to previous messageGo to next message
Kitty

 
Messages:466
Registered:October 2017
Location: Germany
todd0001 wrote on Sat, 05 August 2023 21:32
Let's start.
In GAMEINIT.I cut and pasted a section that you see here. I copied and pasted it right after this.
if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.Bob, 8, SectorY.MAP_ROW_F, 0 )
end

So......for you;


if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.Bob, 8, SectorY.MAP_ROW_F, 0 )
end
if (newGAME_STYLE == 1 and iniENABLE_CREPITUS == 1) then
-- F8
AddNPCtoSector( Profil.RPC65, 8, SectorY.MAP_ROW_F, 0 )
end


Worked for me.
Add this to GameInit.lua
Mod location in MercPro.xml
Add with mapeditor( profile I.Id.)

To make recruitable;
You need a portrait in the Faces folder with a "B" in front(90x100).
You need a script to handle recruitment. I copied one that worked(I think 72.maddog be best but I first used 229.EDT AND 229.NPC). These go in the NPCData folder.
Start new game cause of MercPro.xml
I don't even know where to begin.

The whole GameInit.lua part isn't needed.
Unless you wanted that merc only to appear when you use SciFi and no crepitus, because that's what it will do.

Just copying an existing npc-script and edt isn't advised at all.
The script will not only contain the conditions for being recruitable, but also other important behaviour factors as well.
Better adjust records inside with NPC-Editor to avoid some possible chaos.

Same for edt, those contain text for subtitles. And it matters wether the merc is AIM, MERC, IMP or RPC, those are different types of edt
That stuff is line sensitive and works in combination with the npc-script to trigger the matching text/voice
So, if you randomly choose some npc and edt, that can get ugly.


Edit: "How do I do that?" Adding a new character Guide by Flugente, recruitable mercs are the ones under "RPG"

[Updated on: Sun, 06 August 2023 09:23]




How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN

I need more details. (Didi Hallervorden)

Report message to a moderator

Master Sergeant
Re: Need help with StrategicEventHandler.lua[message #365623 is a reply to message #365621] Sun, 06 August 2023 20:11 Go to previous message
todd0001 is currently offline todd0001

 
Messages:42
Registered:November 2017
"I don't even know where to begin."
I understand.
I have been messing around and not really knowing what I'm doing.

We need your help.
 I have read and reread this whole forum and am still fighting it.
Please show us how to do it...I need it..
I am trying to turn some mercs(from Merc) intp RPCs...

[Updated on: Sun, 06 August 2023 21:32]

Report message to a moderator

Corporal
Previous Topic: Turn NPC or merc into cow..
Next Topic: Civilians behaviour during fights.
Goto Forum:
  


Current Time: Sun Oct 13 17:48:16 GMT+3 2024

Total time taken to generate the page: 0.01221 seconds