← 목록

mLua · 문서 코드 예제

총 794개 · 페이지 10/27
🔀 랜덤
불러오는 중…

[source] | guide_examples [title] | 엔티티를 탐색하는 EntityService [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=201 [code] | Method: [server only] void OnBeginPlay() { local monsterTemplate = _EntityService:GetEntityByPath("/maps/map01/monster-1") -- "spawnedMonster"라는 이름의 몬스터 엔티티 스폰 _SpawnService:SpawnByEntityTemplate(monsterTemplate, "spawnedMonster", Vector3(0,0,0), true, true, true, true) } Event Handler

[source] | guide_examples [title] | 엔티티를 탐색하는 EntityService [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=201 [code] | Method: [server only] void OnBeginPlay() { local monsterTemplate = _EntityService:GetEntityByPath("/maps/map01/monster-1") -- "spawnedMonster"라는 이름의 몬스터 엔티티 스폰 local spawnedEntity = _SpawnService:SpawnByEntityTemplate(monsterTemplate, "spawnedMonster", Vector3(0,0,0), true, true, tr

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] string StringProperty = "Hello" Method: [Server Only] void OnBeginPlay() { self.StringProperty = self.StringProperty .. " World!!" log(self.StringProperty) --콘솔 창에 문자열 "Hello World!!" 출력 self.StringProperty = "Hello MSW!!" log(self.StringProperty) --콘솔 창에 문자열 "Hell

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] number NumberProperty = 100 Method: [Server Only] void OnBeginPlay() { self.NumberProperty = self.NumberProperty + 83 log(self.NumberProperty) --콘솔 창에 숫자 183 출력 self.NumberProperty = 3.28 log(self.NumberProperty) --콘솔 창에 숫자 3.28 출력 }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] integer IntegerProperty = 100 Method: [Server Only] void OnBeginPlay() { self.IntegerProperty = self.IntegerProperty + 83 log(self.IntegerProperty) --콘솔 창에 숫자 183 출력 self.IntegerProperty = 3.28 log(self.IntegerProperty) --콘솔 창에 숫자 3 출력 }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] boolean BooleanProperty = false Method: [Server Only] void OnBeginPlay() { self.BooleanProperty = true if self.BooleanProperty == true then self.BooleanProperty = false log("Hello MSW!!") end }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] table TableProperty = {1,2,3,4,5} Method: [Server Only] void OnBeginPlay() { local tmpTable = self.TableProperty self.TableProperty[1] = 10 log("tmpTable : "..tmpTable[1]) --콘솔 창에 "tmpTable : 10" 출력 log("TableProperty : "..self.TableProperty[1]) --콘솔 창에 "TablePrope

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] Vector2 Vector2Property = Vector2(0,0) Method: [Server Only] void OnBeginPlay() { local tmpVector2 = Vector2(10,10) --벡터를 생성하여 지역변수 tmpVector2에 할당 self.Vector2Property = tmpVector2 --tmpVector2의 값을 프로퍼티 Vector2Property에 할당 log(tmpVector2) --콘솔 창에 (10.000, 10.000)으로 출력

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Method: [Server Only] void OnBeginPlay() { local tmpVector3 = Vector3(10,10,10) --벡터를 생성하여 지역변수 tmpVector3에 할당 local Vt1 = tmpVector3 local Vt2 = tmpVector3 log(Vt1) --콘솔 창에 (10.000, 10.000, 10.000)으로 출력 log(Vt2) --콘솔 창에 (10.000, 10.000, 10.000)으로 출력 tmpVector3.x =

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Method: [Server Only] void OnBeginPlay() { local tmpVector4 = Vector4(10,10,10,10) --벡터를 생성하여 지역변수 tmpVector3에 할당 local Vt1 = tmpVector4 local Vt2 = tmpVector4 log(Vt1) --콘솔 창에 (10.000, 10.000, 10.000, 10.000)으로 출력 log(Vt2) --콘솔 창에 (10.000, 10.000, 10.000, 10.000)으로 출력

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] Entity EntityProperty = EntityPath [None] EntityRef EntityRefProperty = EntityPath Method: [Client Only] void OnBeginPlay() { log(self.EntityProperty.Name) log(self.EntityRefProperty.Name) }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] TransformComponent ComponentProperty = EntityPath [None] TransformComponentRef ComponentRefProperty = EntityPath Method: [client only] void OnBeginPlay() { log(self.ComponentProperty.Position) log(self.ComponentRefProperty.Position) }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] any EntityProperty = nil any ComponentProperty = nil Method: [Server Only] void OnBeginPlay() { self.EntityProperty = _EntityService:GetEntityByPath("/maps/map01/entityA") self.ComponentProperty = self.EntityProperty.TransformComponent log(self.EntityProperty.Name) --콘솔

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] string StringProperty = "Hello!!" Method: [Server Only] void OnBeginPlay() { local getStringProperty = self.StringProperty --self.StringProperty의 값인 "Hello!!"를 getStringProperty에 대입 log(getStringProperty) --콘솔 창에 "Hello!!" 출력 }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] string StringProperty = "Hello!!" Method: [Server Only] void OnBeginPlay() { local stringProperty = self.StringProperty --"self.프로퍼티명"으로 해당 프로퍼티를 가져옴 }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] string PropertyA = "HelloMSW!!"

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [None] string PropertyB = "" Method: [Server Only] void OnBeginPlay() { local entityA = _EntityService:GetEntityByPath("/maps/map01/A") local componentA = entityA.ComponentA self.PropertyB = componentA.PropertyA log(self.PropertyB) --콘솔 창에 HelloMSW!!로 출력되는 것을 확인합니다. }

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] number AccTime = 0 Method: [Server Only] void OnUpdate(delta) { self.AccTime = self.AccTime + delta --OnUpdate가 호출될 때마다 AccTime 프로퍼티에 delta 값을 더합니다. if self.AccTime >= 3 then -- AccTime 프로퍼티의 누적값이 3 이상인지 체크, 3 이상이면 콘솔 창에 "HelloMSW"를 출력 self.AccT

[source] | guide_examples [title] | 프로퍼티 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=205 [code] | Property: [Sync] number AccTime = 0 -- 이 프로퍼티 대신 _T 프로퍼티를 사용 Method: [Server Only] void OnUpdate(delta) { if self._T.accTime == nil then self._T.accTime = 0 end --_T 프로퍼티는 쓰는 시점에 바로 선언됨. 내부 컴포넌트에서 선언되었기 때문에 앞에 self를 붙임 self._T.accTime = self._T.accTime + delta --OnUpdate가 호출

[source] | guide_examples [title] | 공격과 피격 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=206 [code] | override boolean IsAttackTarget(Entity defender) { return true }

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | Event Handler: [service: InputService] HandleKeyDownEvent(KeyDownEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters local key = event.ke

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | Method: [client only] void OnUpdate(number delta) { local enterKeyPressed = _InputService:IsKeyPressed(KeyboardKey.Return) local anyKeyPressed = _InputService:IsAnyKeyPressed() if enterKeyPressed == true then log ("Enter key pressed.") end if anyKeyPressed == true then

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | [service: InputService] HandleKeyUpEvent(KeyUpEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters local key = event.key -------------

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | [service: InputService] HandleKeyHoldEvent(KeyHoldEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters local key = event.key ---------

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | [service: InputService] HandleKeyReleaseEvent(KeyReleaseEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters local key = event.key ---

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | [service: InputService] HandleScreenTouchEvent(ScreenTouchEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters -- local TouchId = event.To

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | [service: InputService] HandleScreenTouchHoldEvent(ScreenTouchHoldEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters -- local TouchId =

[source] | guide_examples [title] | InputService를 활용한 입력과 액션 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=209 [code] | [service: InputService] HandleScreenTouchReleaseEvent(ScreenTouchReleaseEvent event) { --------------- Native Event Sender Info ---------------- -- Sender: InputService -- Space: Client --------------------------------------------------------- -- Parameters -- local Touc

[source] | guide_examples [title] | 실행 제어 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=210 [code] | void CallPlaySoundEffect() { if isClient == true then --PlaySoundEffect를 실행하라! elseif isServer == true then --클라이언트의 PlaySoundEffect를 실행하라! end }

[source] | guide_examples [title] | 실행 제어 [page] | https://maplestoryworlds-creators.nexon.com/ko/docs?postId=210 [code] | [ServerOnly] void CallPlaySoundEffect() { self:PlaySoundEffect() -- 어떤 공간에서든 같은 공간의 함수를 호출하듯이 사용할 수 있다. } [client] --각 함수별로 어떤 공간에서 호출하고 실행할지를 설정할 수 있다. void PlaySoundEffect() { --코드 작성 공간입니다. }

← → 방향키로 페이지 이동 · 숫자 입력 후 Enter로 점프