SetObjectEnabled("cr1", nil);\nSetObjectEnabled("cr2", nil);\n\nTrigger(OBJECT_TOUCH_TRIGGER, "cr1", "fn");\nTrigger(OBJECT_TOUCH_TRIGGER, "cr2", "fn);\n\nfunction fn(heroName, objectName)\n\tif (objectName == "cr1") then\n\tdo\n\t\tlocal sulfur = GetPlayerResource(PLAYER_1, 4);\n\t\tMessageBox(path.."text1.txt);\n\t\tSetPlayerResource(PLAYER_1, 4, sulfur + 10);\n\tend else\n\tdo\n\t\tlocal gem = GetPlayerResource(PLAYER_1, 5);\n\t\tMessageBox(path.."text1.txt);\n\t\tSetPlayerResource(PLAYER_1, 5, gem + 10);\n\tend;\n\tend;\nend;\nAnd yes, I would be very grateful to anyone who explains to me what parameters are actually passed to the function associated with the touch trigger:smile20:
Auto-translated
Hello, hello fellow experts in this thread! :)\n\nActually, I just started learning scripting today and decided to try my hand at something small.\n\nSo, there are two objects named cr1 and cr2. The idea is that when a hero touches the first one, they receive 10 units of sulfur, and when they touch the second one, they receive 10 gems.\n\nSo, here's the question: what's wrong here? :/\n