I would like to know how to develop an accountant.
Example: when an activator is activated, the number 1 will be shown in (some part of the map without covering a lot of space), if it is activated again, the number 2 is displayed, if it is activated again, the number 3 is displayed and then It is activated until you reach number 15 fifteen.
This forum is going to be locked at the end of this year and eventually going offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk
Make sure to read the rules.
Make sure to read the rules.
problem to create a counter [help for map]
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
-
Classic Fighter
- Meatbag
- Posts: 4
- Joined: Wed May 01, 2019 9:25 am
- Title: My name is frog
- SFD Account: Classic Fighter
- SFD Alias: froagialias
- Gender:
- Age: 25
- Gurt
- Lead Programmer

- Posts: 1885
- Joined: Sun Feb 28, 2016 3:22 pm
- Title: Lead programmer
- Started SFD: Made it!
- Location: Sweden
- Gender:
- Age: 35
For your trigger that shall increase the counter you need to call a custom Script Method.
Mark your trigger responsible for increasing your counter and the Script Method property and type in a name of the function you want to call, for example "IncreaseCounter".
In the map script create a public method with the name "IncreaseCounter" with the correct signature and increase your custom counter. For each time it increases update a Text marker by a custom ID and check if you have reached 15.
Mark your trigger responsible for increasing your counter and the Script Method property and type in a name of the function you want to call, for example "IncreaseCounter".
In the map script create a public method with the name "IncreaseCounter" with the correct signature and increase your custom counter. For each time it increases update a Text marker by a custom ID and check if you have reached 15.
Code: Select all
int myCounter = 0;
public void IncreaseCounter(TriggerArgs args) {
myCounter += 1;
// update text on an "IObjectText" tile (Text marker for example) named "MyTextCounter"
IObjectText textObj = Game.GetSingleObjectByCustomID<IObjectText>("MyTextCounter");
if (textObj != null) {
textObj.SetText(myCounter.ToString());
}
if (myCounter == 15) {
// Do whatever you want. For example, let's activate some known trigger by name "MyTriggerAt15."
// counter reached 15. Let's activate a trigger by name "MyTriggerAt15"
IObjectTrigger trigger = Game.GetSingleObjectByCustomID<IObjectTrigger>("MyTriggerAt15");
if (trigger != null) {
trigger.Trigger();
}
}
}
0 x
Gurt
- hyper copter
- Superfighter

- Posts: 117
- Joined: Thu Aug 31, 2017 11:38 am
- Title: Leave my profile alone.
- SFD Account: Hyper
- SFD Alias: Hyper
- Gender:
- Age: 20
I think it can be done with triggers. It'd just be very infuriating to do because you'dmaybeneed to place 15 duplicates in the exact same location.
0 x
''The great thing about multitasking is that several things can go wrong at once."
- Andrew B. Sweger.
- Andrew B. Sweger.
-
Classic Fighter
- Meatbag
- Posts: 4
- Joined: Wed May 01, 2019 9:25 am
- Title: My name is frog
- SFD Account: Classic Fighter
- SFD Alias: froagialias
- Gender:
- Age: 25
forget it, I already solved the problem by putting together triggers in an ingenious way, anyway thanks for the help
0 x