• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Trigger] Help

Status
Not open for further replies.
Level 10
Joined
Sep 7, 2008
Messages
744
I cant seem to get this trigger to work.

Player-Player 1 (Red) types a chat message containing (secret) is an exact match

Player 1 (Red) Equal to (PlayerName)

Unit-Create 1 (Unit) for Player 1 (Red) at (Center of region) facing Default building facing degrees.

A little help please.
 
Last edited by a moderator:
Level 3
Joined
Feb 13, 2008
Messages
65
I'm assuming that the goal of this trigger is to have player red type a message and a unit spawns for player red as a result of this event.

Im a bit confused on what your condition is checking, maybe if you clarified on exactly what your goal of this trigger is we could help you more
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,264
Player 1 (Red) Equal to (PlayerName)
Is impossiable. You can not compair a player object to a string.

I think what you are after is a string comparision with pesudo code of.
If player name of Player(0) (Red) is equal to (PlayerName) then

And remember that string comparisons are case sensitive. Thus I advise converting the player's name to eithor pure upper or lower case before running the comparison on the string of the same case.

This is to compensate with the fact Battlenet kindly lets you change the case of the letters in your player name without having to create a new account as you know. Incase you did not, basically someone like me can log on as "dRsUPERgOOD" instead of my normal "DrSuperGood" without having to do nothing more than change the name I log on with. Many fools who make save systems completly ignore this obvious and vital fact resulting in people not being able to use the same codes when on the same account with different caseing. DarkDeeds 6 (the final version) suffered from a bug where upper case characters resulted in curropted codes which had to be fixed with this.
 
Level 8
Joined
Mar 12, 2008
Messages
437
  • depositin' cans
    • Events
      • Player - Player 1 types a message containing Secret as An exact match
      • Player - Player 2 types a message containing Secret as An exact match
      • Player - Player 3 types a message containing Secret as An exact match
      • Player - Player 4 types a message containing Secret as An exact match
      • --- Do the same as above with all players. ---
    • Conditions
    • Actions
      • Set Point_Var = (Center of Region)
      • Unit - Create 1 Unit for (Triggering player) at Point_Var facing Default building facing degrees
      • Custom script: call removeLocation( udg_PointVar )
Point_Var is a point variable.

I didn't quite understand if you wanted only Player 1 to be able to get the unit, or all players.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,264
...... Like I said.

set namestring to the player name of the triggering player
set namestring to lowercase namestring
if namestring is equal to your account name in lower case then
create your unit
endif

If you seriously can not make this, you should reconsider making a map in the first place and perhapse go back to fidgeting around with triggers until you can make this.
 
Level 10
Joined
Sep 7, 2008
Messages
744
Events
Player - Player 1 (Red) types a chat message containing -my loves heart is my own as An exact match
Conditions
Player 1 (Red) Equal to sirandrews
Actions
Unit - Create 1 The Dead Knight for Player 1 (Red) at (Center of Spawning Zone <gen>) facing Default building facing degrees

Theres my trigger...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,264
Code:
if StringCase(GetPlayerName(GetTriggerPlayer()),false) == "drsupergood" then
    //Create your unit here. . . 
else
    //Inform the user that it only works for you to be helpful (else is not required but advisable)
endif

Replace drsupergood with your account name (all letters in lower case) and you are good to go and can log in as any form of your account name casing and still use the command.

If you still can not use this code which will save / compile, I advise eithor giving up mapping or stopping your map project and learning how to trigger. It is pointless even trying to make a map if you are not familar with the basics as it is impossiable to make anything high quality without understanding it.
 
Level 14
Joined
Mar 4, 2009
Messages
1,156
Thx it workers great,+ rep
i could also ban some idiots :D

some people know how to edit maps but they just don´t work on JASS triggers

btw do you know why is WE so "stupid" to crash if you type custom script code wrong?
why not turning off trigger always?
 
Last edited:
Level 10
Joined
Sep 7, 2008
Messages
744
  • Events
    • Player - Player 1 (Red) types a chat message containing -my loves heart is my own as An exact match
  • Conditions
    • (Name of (Triggering player)) Equal to SirAndrews
  • Actions
    • Unit - Create 1 The Dead Knight for Player 1 (Red) at (Center of Spawning Zone <gen>) facing Default building facing degrees
You have been proven wrong! Haha.
 
Level 15
Joined
Mar 31, 2009
Messages
1,397
I don't really think we should be helping him really, seems like he is adding cheats to a map.

But anyways, do what Dr.Supergood said, save the location to a variable, create unit at variable, and destroy variable

Yes I am a leak hore.

(Nazi isn't "appropriate")
 
Level 4
Joined
Jul 31, 2008
Messages
109
Try this using string array str[]
  • set str[1] = (entered chat string)
  • set str[2] = (name of (typing player))
  • if
  • str[1] = str[2]
  • then
  • unit - create big and angry unit
  • else
  • do nothing
if i understand right
 
Status
Not open for further replies.
Top