• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Player (1-5) types message "(1-5)"

Status
Not open for further replies.
Level 7
Joined
Dec 28, 2009
Messages
257
Heya folks, another question of mine :D

Basically, i need Event that fires when player 1,2,3,4 or 5 writes number 1-2-3-4 or 5 as chat message string. And then use that string he wrote as variable in further actions.

One way is to make 25 events, 5 for each player and each one for different number, like
  • Player - Player 1 (Red) types a chat message containing (String(1)) as An exact match
  • Player - Player 1 (Red) types a chat message containing (String(2)) as An exact match
  • Player - Player 1 (Red) types a chat message containing (String(3)) as An exact match
  • Player - Player 1 (Red) types a chat message containing (String(4)) as An exact match
  • Player - Player 1 (Red) types a chat message containing (String(5)) as An exact match
and then repeat for every player, but that seems dumb, so is there any way how to make this work with, up to 5 Events, one for each player, or so?

Thanks!
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,184
I dont know what you mean by seperate but..
If we add the event using loop we run 5 * 5 actions at init
If we use filters we use 2 * 5 conditions per event fired.
JASS:
local player p = GetTriggerPlayer()
local integer i
loop
exitwhen i==5
//check if player p is 1,2,3,4 or 5
//check if entered number is equal to 1,2,3,4 or 5
set I = I + 1
endloop
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Ohh...
Somehow my brain filtered that out.

Then you would need 25 triggers, which could be kinda overkill.

Anyway choose your method depending on how many times the trigger(s) will be run

Sorru for my retardism death wasted like 2-3 posts

its ok dude it happens to everyone.
Thats y we have forums to discuss things between ppl.
 
Status
Not open for further replies.
Top