• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger Help

Status
Not open for further replies.
Level 2
Joined
Sep 1, 2005
Messages
34
dont do it like "exact mach"(that empty string) but with "as substring" then that condition (Endtered string == sth)
 
Level 5
Joined
Mar 11, 2006
Messages
195
I think he means that a certain part of a string has to be a number, and he wants to pick that number. for exampe -give playerA XX gold. But Shados please explain it some more.
 
Level 2
Joined
Sep 1, 2005
Messages
34
so whats up man?

E: Player entered msg containing "sth" as substring (there sth is that what u want and it is followed with that number)

to get the number use function:

A: number==CovertStringToInteger(Substring(EnteredSubString,lenght of "sth", end of string ))

i hope it helped
 

Ralle

Owner
Level 77
Joined
Oct 6, 2004
Messages
10,101
[trigger:1:055442324b]DoSomething
Events
Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
Conditions
Actions
Set String = -give
Set Start = (Length of String)
Set End = (Start + 7)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), 1, Start)) Equal to String
(Integer((Substring((Entered chat string), Start, End)))) Greater than or equal to 1
(Integer((Substring((Entered chat string), Start, End)))) Less than or equal to 1000000
Then - Actions
Set Value = (Integer((Substring((Entered chat string), Start, End))))
Else - Actions[/trigger:1:055442324b]
So write something the "Then" after the "set value" the value will be the outputted string.
 
Level 5
Joined
Jan 4, 2006
Messages
139
I also need trigger help, but this is different.
How is it that i can make a trigger that says:
"If region _ has greater or equal then X (specified destructibles)-Then turn off trigger. Else do nothing."
Later on I want the game to recheck the trigger every 1 second
"If region _ has less then X (specified destructibles)-Then turn on tigger. Re-run checks for destructible limit"

In english, I want to create a specified destructible/"tree" that will continously spawn UNLESS there are X number already in the specified region. When these trees are harvested so that there is LESS then X number of destructibles, I want it to start spawning them again in the region. I have already got the trigger to spawn destructibles and special ground, fog etc, but this i cannot find the correct condition.
Please help! Thanks a lot :)
 

Ralle

Owner
Level 77
Joined
Oct 6, 2004
Messages
10,101
I am not sure what you mean..

NOTE: This trigger can cause the game to crash, if the region is too small to contain the max amount of trees so the trees will spawn outside the region and then they wont be counted so it thinks that the limit haven't been reached.
[trigger:1:b10dd3af5a]Untitled Trigger 001
Events
Time - Every 5.00 seconds of game time
Conditions
Actions
-------- reset count --------
Set DestructibleCount = 0
-------- this is the max amount of trees/whatever that should be in your region --------
Set DestructibleMax = 20
-------- count all destructibles --------
Destructible - Pick every destructible in Region 000 <gen> and do (Actions)
Loop - Actions
Set DestructibleCount = (DestructibleCount + 1)
-------- check if the amount of destructibles is maxed out --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DestructibleCount Less than DestructibleMax
Then - Actions
-------- create trees until max is reached --------
For each (Integer A) from 1 to (DestructibleMax - DestructibleCount), do (Actions)
Loop - Actions
Destructible - Create a Summer Tree Wall at (Random point in Region 000 <gen>) facing (Random angle) with scale 1.00 and variation 0
Else - Actions[/trigger:1:b10dd3af5a]

So this is what I think is the answer of your question

I think the [trigger:1:b10dd3af5a]Destructible - Pick every destructible in Region 000 <gen> and do (Actions)[/trigger:1:b10dd3af5a] can max pick 64 destructibles but just try it out
 
Level 5
Joined
Jan 4, 2006
Messages
139
If you want I can send you the map I'm working on, I'd prefer it wasn't sent to anyone else...but in words:
I have a field that I want to spawn a never-ending supply of trees. Yet I do not want it to be so overcrowded that the region is chocker-blocked. therefore I want a limit of 15 destructibles spawned in this region at any one time. So i want the game to keep spawning trees in this region until 15 is reached then stop. If however some trees are chopped down and the amount of trees in the region is under 15, then I want it to spawn trees again until 15 is reached and so on...I am rather poor with triggers, as I prefer terrain making (not that good at it :p) and object editing, so I was wondering if this is possible.
Thanks
 
Level 5
Joined
Jan 4, 2006
Messages
139
It's not working at the moment because I can't quite get it to count the number of destructibles. It's only had 2 tests though, so I may just need to fiddle with it more.
 
Status
Not open for further replies.
Top