Triggers

As requested here are some trigger implementation details. They will need to be typed directly into the map file as the GalaxyForge GUI is not wired correctly.

Example:
triggerCount 1
trigger
event
type "ON_PLAYER_DEFEATED"
playerName "NewPlayer0"
conditionCount 0
actionCount 1
action
type "MESSAGE_ALL_PLAYERS_X"
message "Too bad so sad"

Events:

ON_GAME_START,
ON_PLAYER_DEFEATED,
ON_RESEARCH_X_FINISHED_BY_A,
ON_ENTITY_A_DEATH,
ON_ENTITY_A_GAINING_BUFF_X,
ON_ENTITY_A_LOSING_BUFF_X,
ON_ENTITYTYPE_DEATH,
ON_ENTITYTYPE_CREATED,

Event Parameters:

case TriggerEventType::ON_PLAYER_DEFEATED:
archive->Read(_T("playerName"), &paramStdFxdString);
break;
case TriggerEventType::ON_RESEARCH_X_FINISHED_BY_A:
archive->Read(_T("researchName"), &paramStdFxdString);
archive->Read(_T("researchLevel"), &paramInt_2);
archive->Read(_T("playerName"), &paramStdFxdString_2nd);
break;
case TriggerEventType::ON_ENTITY_A_DEATH:
archive->Read(_T("targetEntity"), &paramStdFxdString);
break;
case TriggerEventType::ON_ENTITY_A_GAINING_BUFF_X:
archive->Read(_T("targetEntity"), &paramStdFxdString_2nd);
archive->Read(_T("buffName"), &paramStdFxdString);
archive->Read(_T("buffLevel"), &paramInt_2);
break;
case TriggerEventType::ON_ENTITY_A_LOSING_BUFF_X:
archive->Read(_T("targetEntity"), &paramStdFxdString_2nd);
archive->Read(_T("buffName"), &paramStdFxdString);
archive->Read(_T("buffLevel"), &paramInt_2);
break;
case TriggerEventType::ON_ENTITYTYPE_DEATH:
archive->Read(_T("entityType"), &paramStdFxdString);
break;
case TriggerEventType::ON_ENTITYTYPE_CREATED:
archive->Read(_T("entityType"), &paramStdFxdString);
break;


Conditions:
Not Implemented.

Actions:

END_CURRENT_GAME,
MESSAGE_ALL_PLAYERS_X,
DEFEAT_PLAYER_A,
ADD_BOUNTY_X_TO_PLAYER_A,
SEND_MESSAGE_X_TO_PLAYER_A,
APPLY_BUFF_X_TO_TARGET_UNIT_A,
ADD_X_XP_TO_TARGET_UNIT_A,
APPLY_BUFF_X_TO_UNITTYPE_A,
SPAWN_UNITTYPE_A_NEAR_B,

Action Parameters:
case TriggerActionType::MESSAGE_ALL_PLAYERS_X:
archive->Read(_T("message"), &paramStdFxdString);
break;
case TriggerActionType:DEFEAT_PLAYER_A:
archive->Read(_T("playerName"), &paramStdFxdString);
break;
case TriggerActionType::ADD_BOUNTY_X_TO_PLAYER_A:
archive->Read(_T("bounty"), &paramFloat);
archive->Read(_T("playerName"), &paramStdFxdString);
break;
case TriggerActionType::SEND_MESSAGE_X_TO_PLAYER_A:
archive->Read(_T("message"), &paramStdFxdString);
archive->Read(_T("toPlayer"), &paramStdFxdString_2nd);
archive->Read(_T("fromPlayer"), &paramStdFxdString_3rd);
break;
case TriggerActionType::APPLY_BUFF_X_TO_TARGET_UNIT_A:
archive->Read(_T("buffName"), &paramStdFxdString);
archive->Read(_T("buffLevel"), &paramFloat);
archive->Read(_T("targetName"), &paramStdFxdString_2nd);
break;
case TriggerActionType::ADD_X_XP_TO_TARGET_UNIT_A:
archive->Read(_T("xpValue"), &paramFloat);
archive->Read(_T("targetName"), &paramStdFxdString);
break;
case TriggerActionType::APPLY_BUFF_X_TO_UNITTYPE_A:
archive->Read(_T("buffName"), &paramStdFxdString);
archive->Read(_T("buffLevel"), &paramFloat);
archive->Read(_T("unitType"), &paramStdFxdString_2nd);
break;
case TriggerActionType::SPAWN_UNITTYPE_A_NEAR_B:
archive->Read(_T("unitType"), &paramStdFxdString_2nd);
archive->Read(_T("targetName"), &paramStdFxdString);
archive->Read(_T("ownerName"), &paramStdFxdString_3rd);
break;

22,869 views 11 replies
Reply #1 Top

Your list is missing ON_GAME_START and END_CURRENT_GAME?

Reply #2 Top

Those are valid event/action types however the code doesn't need parameters for them (which is what I was outlining above).

I've edited my original post to show how it breaks down.

Reply #3 Top

I plan to try and make some working maps to show off this weekend with this information.  :thumbsup:

Reply #4 Top

Anyone know exactly how to format the various actions/events that require a specific entity (ADD_X_XP_TO_TARGET_UNIT_A, ON_ENTITY_A_DEATH)? Tried messing around with a map with a tigger for ending the when a titan is destroyed, but neither the entity name or the design name (the map names) seemed to get it to work.

Reply #5 Top

Tried adding one to the map to see if that triggers it where a built one doesn't?

Reply #6 Top

I dug into it further and a number of them are not wired up properly. It just so happens that the one I gave an example of was done correctly. I will see if I can fix them.

Reply #7 Top

Quoting Blair, reply 6

I dug into it further and a number of them are not wired up properly. It just so happens that the one I gave an example of was done correctly. I will see if I can fix them.

I'd hate to ask you to fix some Intern's bad code on a feature that was never really used. ;) But anything you can do would be fantastic.

Reply #9 Top

Quoting Blair, reply 8

I'll see what's required. Did you catch the other changes I made as listed here: https://forums.sinsofasolarempire.com/426813/page/19/#3600271 ?

I did. Thank you very much!   :grin:  If you have to choose between trigger stuff and the other modding stuff, I think most modders would prefer more general improvements. I'll try to ask around to be sure.

Reply #10 Top

Yeah, I'll probably focus on all those other requests before going back to triggers.

Reply #11 Top

you know what, a 'playsound' action would be awesome for making some mini-campaign maps.