Hearts of Iron IV

Hearts of Iron IV

View Stats:
spitfire Jul 13, 2022 @ 10:11am
event moding
Hi
I am currently trying to do my first mod and i am trying to to do a news event.
I am doing event WW2 and i want it to trigger when germany is at war with major country or poland. But i dont know how to do it. I created the event and everything but I dont not how to make it trigger when that action happens. Can somebody helps?
Thanks
< >
Showing 1-8 of 8 comments
Burch Jul 25, 2022 @ 7:07am 
The best thing to do is look at how the original game is coded for events and use this code to help guide you. Start off with just a single short event and get that to work, then you will learn and be able to expand. Do not change the original coding - make a copy to work from.
spitfire Jul 25, 2022 @ 10:22am 
Thanks for the answer
I already did this. I looked at the original game event (even some modded) and I coded it
It worked when i triggered it via the console. But the problem is to how to trigger it when germany declares war on poland. I looked at the game events (and mods) and I noticed the "trigger" command. So I wrote trigger (and the requirements) and launched the game. But when i declared war on poland nothing happens. I am not sure if this the right command but i didnt find anything else.
So i want to know how to trigger it when this or curtain action happen.
thanks for the reply though
Gamer Maid Jul 25, 2022 @ 10:35am 
Did you check the console output while you manually trigger the event ? If I remember correctly it should show the requered conditions in details. Maybe you can see what didn't work properly.
Last edited by Gamer Maid; Jul 25, 2022 @ 10:35am
Fedmahn Kassad Jul 25, 2022 @ 1:01pm 
Well i'm just a beginner when it comes to modding in hoi4 but i think that's how trigger stuff works.

country_event = { id = germany.1 title = germany.1.t desc = germany.1.desc trigger = { GER = { has_war_with = POL } } fire_only_once = yes #up to you option { name = germany.1.a #effect } }
Burch Jul 25, 2022 @ 1:26pm 
add_namespace = germany.1

country_event = {
id = germany.1
title = germany.1.t
desc = germany.1.desc

trigger = {
GER = {
has_war_with = POL
}
}

fire_only_once = yes #up to you

option {
name = germany.1.a
#effect
}
}
spitfire Jul 29, 2022 @ 7:34am 
I see you coded it as a "country event" but i coded as "news_event" because i want everyone to see it. Is there a big difference between it?
Fedmahn Kassad Jul 29, 2022 @ 9:11am 
Allright, then try this one

add_namespace = news news_event = { id = news.1 title = news.1.t desc = news.1.desc picture = #picture major = yes #yes if you want everyone to see trigger = { OR = { GER = { has_war_with = POL } any_country = { is_major = yes has_war_with = GER } } } option = { name = news.1.a #effect } }

Plus, just to remind you again

Event: https://imgur.com/a/jrMiwgv
News: https://imgur.com/a/hnuWipu

So yes, there's a difference.
Burch Jul 29, 2022 @ 10:16am 
Yes a different display but the coding structure is the same. I was showing you what works - the main thing I wanted you to see was - add_namespace = germany.1.

I re-read your post and you are asking about triggers, check out the wikis for full details. Try some trial and error coding, think outside the box, you can learn a lot this way, mostly how not to do something, but it is rewarding when you discover the correct code and the lesson would be well learned.

https://hoi4.paradoxwikis.com/Conditions

Conditions

This is a community maintained wiki. If you spot a mistake then you are welcome to fix it.

Conditions (also known as triggers) are used to specify when the execution of effects occurs. When a trigger returns true, then the execution will continue, otherwise it stops. Several triggers, including the default AND-trigger, allow nesting to create more complex expression.

The list of triggers may be outdated. A complete, but unsorted, list of triggers can be found in /Hearts of Iron IV/documentation/triggers_documentation.html or /Hearts of Iron IV/documentation/triggers_documentation.md.

The following video should help, it is possible that some of the things discussed might be outdated but you will lean a lot from them.

Hearts of Iron IV: Modding In Depth: Events - #15
https://www.youtube.com/watch?v=AXyANZ7pS64&list=PLBGZyYzya9TUnpm8XTmbIbSabungljqzk&index=16


[HOI4 Modding] - Creating new events
https://www.youtube.com/watch?v=Z1r4_KZbrL4&list=PLt_7vUaEvaGTJ0ISBqY2v4EyfmPALiVS7&index=15

Welcome to fun and rewarding world of modding.
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: Jul 13, 2022 @ 10:11am
Posts: 8