0 Members and 1 Guest are viewing this topic.
-Spawn ( The Unit ID ) ( Value )
-spawn 5 Knights
Now since i've the JNGP again, i've tried and fixed the two syntax errors.The code seems to work as it should, after a short test with these commands :-spawn hfoo 3-spawn hpeaCode: jass library SpawnUnitByChat initializer init requires Ascii globals private constant string KEY = "-spawn" private constant player PLAYER = Player(0) // first player (red) private constant real X = 0 private constant real Y = 0 endglobals private function Actions takes nothing returns nothing local string chat = GetEventPlayerChatString() local integer i = -1 local string s = "" local string unitid = "" local string count = "" set chat = SubString(chat,StringLength(KEY)+1,StringLength(chat)) loop set i = i+1 set s = SubString(chat,i,i+1) exitwhen s == " " or s == null set unitid = unitid+s endloop loop set i = i+1 set s = SubString(chat,i,i+1) exitwhen s == " " or s == null set count= count+s endloop set i = S2I(count) loop set i = i-1 call CreateUnit(PLAYER,S2A(unitid),X,Y,0) exitwhen i <= 0 endloop endfunction private function init takes nothing returns nothing local trigger trig = CreateTrigger() call TriggerRegisterPlayerChatEvent(trig,PLAYER,KEY,false) call TriggerAddAction(trig,function Actions) endfunction endlibraryEnjoy
um.. One last question, sorry damn.How to make spawned units patrol to random points?
That will be the anarchy :s
Started by Chriz.
Started by Kuhneghetz
Started by Callahan
Started by moyack
Started by TeslaTrooper