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.
Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.
New to the forum? Say hello in this topic! Also make sure to read the rules.
New to the forum? Say hello in this topic! Also 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.
-
- 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: 24
- Gurt
- Lead Programmer
- Posts: 1885
- Joined: Sun Feb 28, 2016 3:22 pm
- Title: Lead programmer
- Started SFD: Made it!
- Location: Sweden
- Gender:
- Age: 34
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: 18
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.
-
- 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: 24
forget it, I already solved the problem by putting together triggers in an ingenious way, anyway thanks for the help
0 x