• 🏆 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!

[Trigger] i need help with substirngs

Status
Not open for further replies.
Level 11
Joined
Sep 12, 2008
Messages
657
hi.. i tryed to make that if a player writes -bt ### it changes the variable BT to ###
i want allso it to create that if the unit has less hp than the ### it says that it doesnt have enought life to proceed.
but what it did when i tested was that if the player writes -bt 9999 it says, you dont have 999 health. and the point was 9999 writes 9999.. heres the trigger:

Code:
Player - Player 1 (Red) types a chat message containing -bt as A substring
(Triggering player) Equal to (Owner of Hero[1])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        (Life of Hero[1]) Greater than (Real((Substring((Entered chat string), 6, 10))))
    Then - Actions
        Set BT = (Integer((Substring((Entered chat string), 6, 10))))
    Else - Actions
        Game - Display to (All players) the text: ((Your medic doesnt have  + (Substring((Entered chat string), 6, 10))) +  health to give.)

Notes: hero1 is a variable i setted up like this:
Code:
Set Hero[1] = Medic Gunner 0001 <gen>
And bt is default 15:
Code:
Set BT = 15
 
Level 11
Joined
Sep 12, 2008
Messages
657
what did you just say? XD i didnt understand nothing.. its just like how the world editor writes it..
and i got no idea what you mean.. i just want it to do this:
write 3 numbers, the 3 numbers is the variable number...
 
Level 11
Joined
Sep 12, 2008
Messages
657
look what i did now:

Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        (Life of Hero[1]) Greater than (Real((Substring((Entered chat string), 5, (Length of (Entered chat string))))))
    Then - Actions
        Set BT = (Integer((Substring((Entered chat string), 5, (Length of (Entered chat string))))))
    Else - Actions
        Game - Display to (All players) the text: ((Your medic doesnt have  + (Substring((Entered chat string), 5, (Length of (Entered chat string))))) +  health to give.)
that did that if i write -bt and 9 till end of chat it gives only 15 health..
it doesnt helps me much..

ohh.. sorry.. my bad.. i did that if the ability level is higer than 1.. and max was 1.. my bad.. anyways. it works
thanks alot :D
 
Last edited:
Status
Not open for further replies.
Top