• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Got a problem

Status
Not open for further replies.

adamhun

A

adamhun

Hi all!
I'm a not a pro at triggers but I can make some easy things. Well, this thing got me a headache. So I want to make a switchable uniform. This is the uniform on.
  • uniform on
    • Events
      • Player - Player 1 (Red) types a chat message containing -uniform on as An exact match
    • Conditions
      • (Entered chat string) Equal to -uniform on
    • Actions
      • Set playerpos = (Position of Villager (Male) 0209 <gen>)
      • Game Cache - Create a game cache from MahRPG.w3v
      • Game Cache - Store Villager (Male) 0209 <gen> as Player(civilian) of Unit in (Last created game cache)
      • Unit - Remove Villager (Male) 0209 <gen> from the game
      • Unit - Create 1 soldier for Player 1 (Red) at playerpos facing Default building facing degrees
      • Set soldier = (Last created unit)
      • Trigger - Turn on uniform off <gen>
      • Trigger - Turn off (This trigger)
Uniform off
  • uniform off
    • Events
      • Player - Player 1 (Red) types a chat message containing -uniform off as An exact match
    • Conditions
      • (Entered chat string) Equal to -uniform off
    • Actions
      • Set playerpossoldier = (Position of (Last created unit))
      • Unit - Remove soldier from the game
      • Game Cache - Restore player(civilian) of Unit from (Last created game cache) for Player 1 (Red) at playerpossoldier facing (Position of (Triggering unit))
      • Trigger - Turn on uniform on <gen>
      • Trigger - Turn off (This trigger)
It works well until the second change. When I want to get on the uniform second time, it not works. Someone could help me with this?(and before you say, I can't make it in JASS because I'm epic noob with it)
 
Last edited by a moderator:
First off, make it a substring, not an exact match and also "-uniform", not "-uniform on", so that we don't use seperate triggers.
  • uniform on
  • Events
    • Player - Player 1 (Red) types a chat message containing -uniform as A substring
The condition should look like this:
  • (Substring((Entered chat string), 10, (Length of (Entered chat string))
It's a String Comparison, scroll to Substring.

New trigger shoud look like this:
  • uniform on
  • Events
    • Player - Player 1 (Red) types a chat message containing -uniform as A substring
  • Conditions
  • Actions
    • Set Text = (Substring((Entered chat string), 10, (Length of (Entered chat string))
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • Text Equal to on
      • Then - Actions
        • //Actions
      • Else - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • Text Equal to off
          • Then - Actions
            • //Actions
          • Else - Actions
 
Pharaoh_: allright, I'll try it :smile:

Rednek: "Why do you save it in a Game Cache? Normal variable is not good enough?" - A variable can store inventory? If yes, then will make it a variable.
 
A variable can store inventory? If yes, then will make it a variable.

A variable can store anything that the game-cache can.

JASS:
boolean
integer
real
string
handle

These are the primary data-types provided by Warcraft III, and they can be used to store data of the associated type. For example, set someStringVar = "This is a string". In any situation where you need to use game-cache you can alternatively use a global variable, or a global array variable.
 
Status
Not open for further replies.
Back
Top