Jump to content

Au3Irrlicht 2.0


JRowe
 Share

Recommended Posts

Good day, gentlemen.

I'd like to use a "global" skydome. a skydome, which spreads over the whole scene (even under the players position)

It's for a flight simulator and I don't like that slow loading terrains.

do you know how to make this?

Link to comment
Share on other sites

hi :huh2:

I'm here for help again, please help, if you play this thing, you can understand the problem(problem is dying)

Packet

Hi,

Your problem is in your while loop.

While _IrrRunning()
    MouseOku()

    If $Trigger = 1 Then Algila()

    If $NodeHit Then Vurus()
    
    ;If $Trigger = 0 And TimerDiff($Attack) >= 400 And $Playing <> 0 Then AtakBitti() ; <- Calling to animate a node that's not there.
    If $Trigger = 0 And TimerDiff($Attack) >= 400 And $Playing <> 0 And Not $Monster[2][1] = "die" Then AtakBitti()

    If TimerDiff($Bullet) >= 100 Then KursunSil()

    CanKontrol()

    _IrrSetWindowCaption(_IrrGetFPS() & " | " & $blt)
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $vect)
    ;$posi = _IrrGetNodePosition($Monster[2][0]) ; <- trying to get node position to a node that's not there.
    If Not $Monster[2][1] = "die" Then $posi = _IrrGetNodePosition($Monster[2][0])
    _Irr2DFontDraw($BitmapFont, "HP " & $Monster[2][1], $x - 15, $y, $x + 35, $y)
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600)
    _IrrDraw2DImageElement($HUDCharacterTexture, 368, 268, 0, 0, 64, 64, $IRR_USE_ALPHA)
    _IrrEndScene()
WEnd
This just so you can see what I mean, not a good solution for a fix.

Also you might want to try a Fade animator on death instead of _IrrRemoveNode so the death animation can play before the node is removed. Fade animator is a simple set and forget way to remove a node ;)

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    ;_IrrRemoveNode($Monster[$bYaratik][0])
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 800, 0) ;<-- Something like this.
EndFunc

Cheers

Link to comment
Share on other sites

@smashly; thanks a lot for your help, my mistakes are very stupid ; i understand that ;)

edit:

wow! it's working now :huh2:

--deleted

edit2:

wow2! :alien: I like it :

#include "au3Irrlicht2.au3"
#include "array.au3"

HotKeySet("{ESC}", "_exit")

Dim $Scene = 1
_IrrStart($IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON)

Func _exit()
    _IrrStop()
EndFunc   ;==>_exit

Dim $Mesh1, $Node1, $Collision1, $Mesh2, $Node2, $Collision2, $Mesh3, $Node3, $Mesh4, $Mesh4Texture, $Node4, $Collision4, $Camera, $keyStruct, $x, $y
Dim $Distance, $Position, $CollisionState, $CollisionAnimator, $CollisionAnimator2, $CameraNode, $CombinedCollision, $Target, $pMouseEvent, $vect[3]
Dim $NodeHit, $Ray, $Ray1[3], $Ray2[3], $Null, $CrosTex, $Bullethole1, $Trigger, $Playing[50], $Get, $Attack[50], $Bullet, $Camera = -2, $nodea3
Dim $BitmapFont, $beam[199], $blt = 0, $Monster[50][50], $NoHit, $ohMyRet[99], $dummy, $Attacked, $yaratiksayi = 2, $pos = 0, $AttackC = 0, $w, $h
Global $vuruldu
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc1")

Func MyErrFunc1()
    $HexNumber = Hex($oMyError.number, 8)
    $ohMyRet[0] = $HexNumber
    $ohMyRet[1] = StringStripWS($oMyError.description, 3)
    MsgBox(0, "", "Number: " & $HexNumber _
             & "ScriptLine: " & $oMyError.scriptline _
             & "Description: " & $ohMyRet[1])
EndFunc   ;==>MyErrFunc1

For $i = 1 To UBound($Monster) - 1
    $Monster[$i][0] = 999
    $Monster[$i][1] = 999
    $Monster[$i][2] = 0
    $Attack[$i] = 0
Next

$HaritaLoad = _IrrGetMesh("Meshes\1.irrmesh")
$Harita = _IrrAddMeshToSceneAsOcttree($HaritaLoad)
_IrrSetNodeMaterialFlag($Harita, $IRR_EMF_LIGHTING, $IRR_OFF)
$Collision1 = _IrrGetCollisionGroupFromComplexMesh($HaritaLoad, $Harita, 0)
$BitmapFont = _IrrGetFont("Meshes\fonthaettenschweiler.bmp")

$SilahLoad = _IrrGetMesh("Meshes\mar_rifle.3ds")
$SilahTexture = _IrrGetTexture("Meshes\m_rifl.bmp")
$Silah = _IrrAddMeshToScene($SilahLoad)
_IrrSetNodeMaterialTexture($Silah, $SilahTexture, 0)
_IrrSetNodeMaterialFlag($Silah, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodePosition($Silah, 7, -10, 20)
_IrrSetNodeRotation($Silah, 0, 0, 0)
_IrrSetNodeScale($Silah, .5, .5, .35)

YaratikEkle()
YaratikEkle()

$CombinedCollision = _IrrCreateCombinedCollisionGroup()
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision1)
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision2)

$Monster[1][1] = 100
$Monster[1][0] = _IrrAddFPSCamera(0, 150.0, 0.5, -1, __CreatePtrKeyMapArray($keyStruct, $KEY_KEY_W, $KEY_KEY_S, $KEY_KEY_A, $KEY_KEY_D, $KEY_SPACE), 5, 100, 2.0)
$keyStruct = 0
$CameraNode = $Monster[1][0]
_IrrAddChildToParent($Silah, $CameraNode)
$CollisionAnimator = _IrrAddCollisionAnimator($CombinedCollision, $CameraNode, 30.0, 30.0, 30.0, 0.0, -3.0, 0.0, 0.0, 50.0, 0.0)
$CrosTex1 = _IrrGetTexture("Meshes\c1.png")
$CrosTex2 = _IrrGetTexture("Meshes\c2.png")
_IrrHideMouse()

While _IrrRunning()
    While _IrrMouseEventAvailable()
        $pMouseEvent = _IrrReadMouseEvent()
        $Get = __getMouseEvt($pMouseEvent, $EVT_MOUSE_IACTION)
        If $Get = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then $Trigger = 1
        If $Get = $IRR_EMIE_LMOUSE_LEFT_UP Then $Trigger = 0
    WEnd
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then YaratikEkle()
        EndIf
    WEnd
    If $Trigger = 1 Then Algila()
    If $NodeHit Then Vurus()
    AtakBitti()
    If TimerDiff($Bullet) >= 100 Then KursunSil()

    CanKontrol()
    _IrrSetWindowCaption("FPS: " & _IrrGetFPS() & " | Monster Count: " & ($yaratiksayi - 2))
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    CanlariYaz()
    _IrrGetScreenSize($w, $h)

    If $AttackC = 1 Then _IrrDraw2DImageElement($CrosTex2, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    If $AttackC = 0 Then _IrrDraw2DImageElement($CrosTex1, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    _IrrEndScene()
WEnd
_IrrStop()

Func YaratikEkle($HP = 100)
    $Monster[$yaratiksayi][1] = $HP
    $YaratikLoad = _IrrGetMesh("Meshes\zumlin.md2")
    $YaratikTexture = _IrrGetTexture("Meshes\zumlin.pcx")
    $Monster[$yaratiksayi][0] = _IrrAddMeshToScene($YaratikLoad)
    _IrrSetNodeMaterialTexture($Monster[$yaratiksayi][0], $YaratikTexture, 0)
    _IrrSetNodeMaterialFlag($Monster[$yaratiksayi][0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($Monster[$yaratiksayi][0], $IRR_EMAT_STAND)
    _IrrSetNodeScale($Monster[$yaratiksayi][0], 2, 2, 2)
    _IrrSetNodePosition($Monster[$yaratiksayi][0], Random(0, 500, 1), -200, Random(0, 500, 1))
    $Collision4 = _IrrGetCollisionGroupFromMesh($YaratikLoad, $Monster[$yaratiksayi][0]);2
    $yaratiksayi += 1
EndFunc   ;==>YaratikEkle

Func CanlariYaz()
    For $Whp = 2 To UBound($Monster) - 1
        If $Monster[$Whp][1] <> "die" And $Monster[$Whp][0] <> 999 Then
            $posi = _IrrGetNodePosition($Monster[$Whp][0])
            _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $posi)
            _Irr2DFontDraw($BitmapFont, "HP " & $Monster[$Whp][1], $x, $y, $x, $y)
        EndIf
    Next
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600) ;player
EndFunc   ;==>CanlariYaz

Func AtakBitti()
    For $aB = 1 To UBound($Monster) - 1
        If TimerDiff($Attack[$aB]) >= 400 Then
            If $Monster[$aB][2] = 1 Then
                Dim $NodeHit = 0, $AttackC = 0
                $Attack[$aB] = -1
                $Monster[$aB][2] = 0
                If $Monster[$aB][1] <> "die" Then _IrrPlayNodeMD2Animation($Monster[$aB][0], $IRR_EMAT_STAND)
            EndIf
        EndIf
    Next
EndFunc   ;==>AtakBitti

Func KursunSil()
    For $adr = 1 To $blt
        _IrrRemoveNode($beam[$adr])
    Next
    $blt = 0
EndFunc   ;==>KursunSil

Func CanKontrol()
    For $i = 1 To UBound($Monster) - 1
        If $Monster[$i][1] <= 0 And Not $Monster[$i][1] = "die" Then Oldur($i)
    Next
EndFunc   ;==>CanKontrol

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 800, 0)
EndFunc   ;==>Oldur

Func Algila()
    $Target = _IrrGetCameraTarget($CameraNode)
    $Ray = _IrrGetRayFromScreenCoordinates(400, 300, $CameraNode)
    $Ray1[0] = $Ray[0][0]
    $Ray1[1] = $Ray[0][1]
    $Ray1[2] = $Ray[0][2]
    $Ray2[0] = $Ray[1][0]
    $Ray2[1] = $Ray[1][1]
    $Ray2[2] = $Ray[1][2]
    _IrrGetNodeAndCollisionPointFromRay($Ray1, $Ray2, $NodeHit, $Target[0], $Target[1], $Target[2], $Null, $Null, $Null, 0, $IRR_NO_OBJECT)
EndFunc   ;==>Algila

Func Vurus()
    If $NodeHit And $Trigger = 1 Then
        $NoHit = False
        For $i = 1 To UBound($Monster) - 1
            If $i = 49 Then
                $NoHit = True
                ExitLoop
            EndIf
            If $NodeHit = $Monster[$i][0] And $i > 1 Then ExitLoop
        Next
        $Attacked = $i
        If $Monster[$Attacked][1] < 1 Then $NoHit = True
        If $NoHit = True Then
            $Trigger = 0
            Return 0
        Else
            Dim $Bullet = TimerInit(), $Trigger = 0
            $Attack[$Attacked] = TimerInit()
            $Monster[$Attacked][2] = 1
            $blt += 1
            Beam()
            $Monster[$Attacked][1] -= 10
            Global $vuruldu = $Attacked
            _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
            $Monster[$Attacked][2] = 1
            $AttackC = 1
        EndIf
    EndIf
EndFunc   ;==>Vurus

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    $MeshTexture = _IrrGetTexture("Meshes\beam.png")
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 9, $posi[2], $posi[0], $posi[1] + 10, $posi[2])
EndFunc   ;==>Beam

ps1: try the 'e' key.

ps2: you need that files-add into meshes folder- [ post-59180-0-32753100-1307880232_thumb.p and post-59180-0-39979400-1307880237_thumb.p ]

Edited by BiliyomKi
An AutoIT user.
Link to comment
Share on other sites

Hi BiliyomKi.

Here's a slight mod to your beam func

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 1.5)
    $MeshTexture = _IrrGetTexture("Meshes\beam.png")
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ALPHA_CHANNEL)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0]  , $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])
EndFunc   ;==>Beam

Cheers

Link to comment
Share on other sites

Hi BiliyomKi.

Here's a slight mod to your beam func

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 1.5)
    $MeshTexture = _IrrGetTexture("Meshes\beam.png")
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ALPHA_CHANNEL)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0]  , $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])
EndFunc   ;==>Beam

Cheers

thats great, I'm working something like this but you did this before me :huh2:

Func Beam1()
    $beam[$blt] = _IrrAddBeamSceneNode()
    $MeshTexture = _IrrGetTexture("Meshes\beam.png")
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 9, $posi[2], $posi[0], $posi[1] + 10, $posi[2])
    $asdf = _IrrGetNodeAbsolutePosition($Monster[$Attacked][0])
    _IrrAddFlyStraightAnimator($beam[$blt], $posi[0], $posi[1] + 9, $posi[2],$asdf[0], $asdf[1], $asdf[2], 400, $IRR_ONE_SHOT)
EndFunc   ;==>Beam

btw; How can i shoot without shooting any zumlin?

An AutoIT user.
Link to comment
Share on other sites

Quick edit on Func Vurus()

If $NoHit = True Then
                $Trigger = 0
                Dim $Bullet = TimerInit(), $Trigger = 0
                $Attack[$Attacked] = TimerInit()
                $blt += 1
                Beam()
                Global $vuruldu = $Attacked
                $AttackC = 0
            Else
                Dim $Bullet = TimerInit(), $Trigger = 0
                $Attack[$Attacked] = TimerInit()
                $Monster[$Attacked][2] = 1
                $blt += 1
                Beam()
                $Monster[$Attacked][1] -= 10
                Global $vuruldu = $Attacked
                _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
                $Monster[$Attacked][2] = 1
                $AttackC = 1
            EndIf

Maby there are some unused lines in there remove them if you need lol

Edit: if you use smashly beam func change

$MeshTexture = _IrrGetTexture("Meshes\beam.png")

to b on top of the script if you already did not do that

and heare is some more fun

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 1.5)
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0]  , $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])
    Local $g = _IrrAddBillBoardToScene(2, 2, $Target[0], $Target[1] + 10, $Target[2])
    _IrrSetNodeMaterialTexture(  $g, $MeshTexture, 0 )
    _IrrSetNodeMaterialFlag($g, $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrSetNodeMaterialType(  $g, $IRR_EMT_TRANSPARENT_ADD_COLOR)
    _IrrAddFadeAnimator($g,1000)
EndFunc   ;==>Beam
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

hohohooww, it's going great, thats amazing :huh2:

edit1:

--deleted

edit2:

If I press the shoot button quickly, this beam stays for ever

$beam[$blt] = _IrrAddBeamSceneNode()

edit3:

solved!

#include "au3Irrlicht2.au3"
#include "array.au3"

HotKeySet("{ESC}", "_exit")

Dim $Scene = 1
_IrrStart($IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON)

Func _exit()
    _IrrStop()
EndFunc   ;==>_exit

Dim $Mesh1, $Node1, $Collision1, $Mesh2, $Node2, $Collision2, $Mesh3, $Node3, $Mesh4, $Mesh4Texture, $Node4, $Collision4, $Camera, $keyStruct, $x, $y
Dim $Distance, $Position, $CollisionState, $CollisionAnimator, $CollisionAnimator2, $CameraNode, $CombinedCollision, $Target[5], $pMouseEvent, $vect[3], $blt1 = 0
Dim $NodeHit, $Ray, $Ray1[3], $Ray2[3], $Null, $CrosTex, $Bullethole1, $Trigger, $Playing[50], $Get, $Attack[50], $Bullet, $Camera = -2, $nodea3, $YaratikHareket
Dim $BitmapFont, $beam[199], $blt = 0, $Monster[50][50], $NoHit, $ohMyRet[99], $dummy, $Attacked, $yaratiksayi = 2, $pos = 0, $AttackC = 0, $w, $h, $g[199]
Global $vuruldu

For $i = 1 To UBound($Monster) - 1
    $Monster[$i][0] = 999
    $Monster[$i][1] = 999
    $Monster[$i][2] = 0
    $Monster[$i][3] = 0
    $Attack[$i] = 0
Next

$HaritaLoad = _IrrGetMesh("Meshes\1.irrmesh")
$Harita = _IrrAddMeshToSceneAsOcttree($HaritaLoad)
_IrrSetNodeMaterialFlag($Harita, $IRR_EMF_LIGHTING, $IRR_OFF)
$Collision1 = _IrrGetCollisionGroupFromComplexMesh($HaritaLoad, $Harita, 0)
$BitmapFont = _IrrGetFont("Meshes\fonthaettenschweiler.bmp")

$SilahLoad = _IrrGetMesh("Meshes\mar_rifle.3ds")
$SilahTexture = _IrrGetTexture("Meshes\m_rifl.bmp")
$Silah = _IrrAddMeshToScene($SilahLoad)
_IrrSetNodeMaterialTexture($Silah, $SilahTexture, 0)
_IrrSetNodeMaterialFlag($Silah, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodePosition($Silah, 7, -10, 20)
_IrrSetNodeRotation($Silah, 0, 0, 0)
_IrrSetNodeScale($Silah, .5, .5, .35)

YaratikEkle()
YaratikEkle()

$CombinedCollision = _IrrCreateCombinedCollisionGroup()
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision1)
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision2)

$MeshTexture = _IrrGetTexture("Meshes\beam.png")
$Monster[1][1] = 100
$Monster[1][0] = _IrrAddFPSCamera(0, 150.0, 0.5, -1, __CreatePtrKeyMapArray($keyStruct, $KEY_KEY_W, $KEY_KEY_S, $KEY_KEY_A, $KEY_KEY_D, $KEY_SPACE), 5, 100, 2.0)
$keyStruct = 0
$CameraNode = $Monster[1][0]
_IrrAddChildToParent($Silah, $CameraNode)
$CollisionAnimator = _IrrAddCollisionAnimator($CombinedCollision, $CameraNode, 30.0, 30.0, 30.0, 0.0, -3.0, 0.0, 0.0, 50.0, 0.0)
$CrosTex1 = _IrrGetTexture("Meshes\c1.png")
$CrosTex2 = _IrrGetTexture("Meshes\c2.png")
_IrrHideMouse()

While _IrrRunning()
    While _IrrMouseEventAvailable()
        $pMouseEvent = _IrrReadMouseEvent()
        $Get = __getMouseEvt($pMouseEvent, $EVT_MOUSE_IACTION)
        If $Get = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then $Trigger = 1
        If $Get = $IRR_EMIE_LMOUSE_LEFT_UP Then $Trigger = 0
    WEnd
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then YaratikEkle()
        EndIf
    WEnd
    If $Trigger = 1 Then Algila()
    If $NodeHit Then Vurus()
    AtakBitti()
    If TimerDiff($YaratikHareket) >= 100 Then YaratikHareket(1)
    If TimerDiff($Bullet) >= 150 Then KursunSil()

    CanKontrol()
    _IrrSetWindowCaption("FPS: " & _IrrGetFPS() & " | Monster Count: " & ($yaratiksayi - 2) & " | Target: " & $Target[0] & "," & $Target[1] & "," & $Target[2])
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    CanlariYaz()
    _IrrGetScreenSize($w, $h)

    If $AttackC = 1 Then _IrrDraw2DImageElement($CrosTex2, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    If $AttackC = 0 Then _IrrDraw2DImageElement($CrosTex1, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    _IrrEndScene()
WEnd
_IrrStop()

Func YaratikEkle($HP = 100)
    $Monster[$yaratiksayi][1] = $HP
    $YaratikLoad = _IrrGetMesh("Meshes\zumlin.md2")
    $YaratikTexture = _IrrGetTexture("Meshes\zumlin.pcx")
    $Monster[$yaratiksayi][0] = _IrrAddMeshToScene($YaratikLoad)
    _IrrSetNodeMaterialTexture($Monster[$yaratiksayi][0], $YaratikTexture, 0)
    _IrrSetNodeMaterialFlag($Monster[$yaratiksayi][0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($Monster[$yaratiksayi][0], $IRR_EMAT_STAND)
    _IrrSetNodeScale($Monster[$yaratiksayi][0], 2, 2, 2)
    _IrrSetNodePosition($Monster[$yaratiksayi][0], Random(-500, 500, 1), -200, Random(-500, 500, 1))
    $Collision4 = _IrrGetCollisionGroupFromMesh($YaratikLoad, $Monster[$yaratiksayi][0]);2
    $yaratiksayi += 1
EndFunc   ;==>YaratikEkle

Func CanlariYaz()
    For $Whp = 2 To UBound($Monster) - 1
        If $Monster[$Whp][1] <> "die" And $Monster[$Whp][0] <> 999 Then
            $posi = _IrrGetNodePosition($Monster[$Whp][0])
            _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $posi)
            _Irr2DFontDraw($BitmapFont, "-Monster " & $Whp - 1 & "-" & @LF & "HP: " & $Monster[$Whp][1], $x,$y, $x, $y)
        EndIf
    Next
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600) ;player
EndFunc   ;==>CanlariYaz

Func AtakBitti()
    For $aB = 1 To UBound($Monster) - 1
        If TimerDiff($Attack[$aB]) >= 400 Then
            If $Monster[$aB][2] = 1 Then
                Dim $NodeHit = 0, $AttackC = 0
                $Attack[$aB] = -1
                $Monster[$aB][2] = 0
                If $Monster[$aB][1] <> "die" Then _IrrPlayNodeMD2Animation($Monster[$aB][0], $IRR_EMAT_STAND)
            EndIf
        EndIf
    Next
EndFunc   ;==>AtakBitti

Func KursunSil()
    For $adr = 1 To $blt
        _IrrRemoveNode($beam[$adr])
    Next
    $blt = 0
EndFunc   ;==>KursunSil

Func CanKontrol()
    For $i = 1 To UBound($Monster) - 1
        If $Monster[$i][1] <= 0 And Not $Monster[$i][1] = "die" Then Oldur($i)
    Next
EndFunc   ;==>CanKontrol

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 800, 0)
EndFunc   ;==>Oldur

Func Algila()
    $Target = _IrrGetCameraTarget($CameraNode)
    $Ray = _IrrGetRayFromScreenCoordinates(400, 300, $CameraNode)
    $Ray1[0] = $Ray[0][0]
    $Ray1[1] = $Ray[0][1]
    $Ray1[2] = $Ray[0][2]
    $Ray2[0] = $Ray[1][0]
    $Ray2[1] = $Ray[1][1]
    $Ray2[2] = $Ray[1][2]
    _IrrGetNodeAndCollisionPointFromRay($Ray1, $Ray2, $NodeHit, $Target[0], $Target[1], $Target[2], $Null, $Null, $Null, 0, $IRR_NO_OBJECT)
EndFunc   ;==>Algila

Func Vurus()
    If $NodeHit And $Trigger = 1 Then
        $NoHit = False
        For $i = 1 To UBound($Monster) - 1
            If $i = 49 Then
                $NoHit = True
                ExitLoop
            EndIf
            If $NodeHit = $Monster[$i][0] And $i > 1 Then ExitLoop
        Next
        $Attacked = $i
        If $Monster[$Attacked][1] < 1 Then $NoHit = True
        If $NoHit = True Then
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            Beam()
        Else
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            $blt1 += 1
            $Attack[$Attacked] = TimerInit()
            $Monster[$Attacked][2] = 1
            Beam()
            $Monster[$Attacked][1] -= 10
            $vuruldu = $Attacked
            _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
            $Monster[$Attacked][2] = 1
            $AttackC = 1
        EndIf
    EndIf
EndFunc   ;==>Vurus

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 2)
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])

    $g[$blt1] = _IrrAddBillBoardToScene(2, 2, $Target[0], $Target[1] + 10, $Target[2])
    _IrrSetNodeMaterialTexture($g[$blt1], $MeshTexture, 0)
    _IrrSetNodeMaterialFlag($g[$blt1], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrSetNodeMaterialType($g[$blt1], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    _IrrAddFadeAnimator($g[$blt1], 1000)
EndFunc   ;==>Beam

Func YaratikHareket($aDurum, $aYaratik = 0, $aX = 0, $bX = 0, $cX = 0)
    Select
        Case $aDurum = 1
            For $i = 1 to UBound($Monster) -1
                if $Monster[$i][3] = 1 Then
                    _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_STAND)
                    $Monster[$i][3] = 0
                EndIf
            Next
            $YaratikHareket = -1
        Case $aDurum = 2
            _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_RUN)
            _IrrSetNodePosition($Monster[$aYaratik][0], $aX, $bX, $cX)
            $Monster[$aYaratik][3] = 1
            $YaratikHareket = TimerInit()
    EndSelect
EndFunc
Edited by BiliyomKi
An AutoIT user.
Link to comment
Share on other sites

_IrrSetWindowCaption sometimes can consume lots of fps on my comp, quick gui edit

marked 5 added lines with ;<===

#include "au3Irrlicht2.au3"
#include "array.au3"

HotKeySet("{ESC}", "_exit")

Dim $Scene = 1
_IrrStart($IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON)

Func _exit()
    _IrrStop()
EndFunc   ;==>_exit

Dim $Mesh1, $Node1, $Collision1, $Mesh2, $Node2, $Collision2, $Mesh3, $Node3, $Mesh4, $Mesh4Texture, $Node4, $Collision4, $Camera, $keyStruct, $x, $y
Dim $Distance, $Position, $CollisionState, $CollisionAnimator, $CollisionAnimator2, $CameraNode, $CombinedCollision, $Target[5], $pMouseEvent, $vect[3], $blt1 = 0
Dim $NodeHit, $Ray, $Ray1[3], $Ray2[3], $Null, $CrosTex, $Bullethole1, $Trigger, $Playing[50], $Get, $Attack[50], $Bullet, $Camera = -2, $nodea3, $YaratikHareket
Dim $BitmapFont, $beam[199], $blt = 0, $Monster[50][50], $NoHit, $ohMyRet[99], $dummy, $Attacked, $yaratiksayi = 2, $pos = 0, $AttackC = 0, $w, $h, $g[199]
Global $vuruldu

For $i = 1 To UBound($Monster) - 1
    $Monster[$i][0] = 999
    $Monster[$i][1] = 999
    $Monster[$i][2] = 0
    $Monster[$i][3] = 0
    $Attack[$i] = 0
Next

$BitmapFont = _IrrGetFont ( "bitmapfont.bmp" );<===
_IrrGUISetFont( $BitmapFont );<===
_IrrSetWindowCaption("My Game");<===

$HaritaLoad = _IrrGetMesh("Meshes\1.irrmesh")
$Harita = _IrrAddMeshToSceneAsOcttree($HaritaLoad)
_IrrSetNodeMaterialFlag($Harita, $IRR_EMF_LIGHTING, $IRR_OFF)
$Collision1 = _IrrGetCollisionGroupFromComplexMesh($HaritaLoad, $Harita, 0)
$BitmapFont = _IrrGetFont("Meshes\fonthaettenschweiler.bmp")

$SilahLoad = _IrrGetMesh("Meshes\mar_rifle.3ds")
$SilahTexture = _IrrGetTexture("Meshes\m_rifl.bmp")
$Silah = _IrrAddMeshToScene($SilahLoad)
_IrrSetNodeMaterialTexture($Silah, $SilahTexture, 0)
_IrrSetNodeMaterialFlag($Silah, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodePosition($Silah, 7, -10, 20)
_IrrSetNodeRotation($Silah, 0, 0, 0)
_IrrSetNodeScale($Silah, .5, .5, .35)

YaratikEkle()
YaratikEkle()

$CombinedCollision = _IrrCreateCombinedCollisionGroup()
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision1)
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision2)

$MeshTexture = _IrrGetTexture("Meshes\beam.png")
$Monster[1][1] = 100
$Monster[1][0] = _IrrAddFPSCamera(0, 130.0, 0.35, -1, __CreatePtrKeyMapArray($keyStruct, $KEY_KEY_W, $KEY_KEY_S, $KEY_KEY_A, $KEY_KEY_D, $KEY_SPACE), 5, 100, 1.6)
$keyStruct = 0
$CameraNode = $Monster[1][0]
_IrrAddChildToParent($Silah, $CameraNode)
$CollisionAnimator = _IrrAddCollisionAnimator($CombinedCollision, $CameraNode, 30.0, 30.0, 30.0, 0.0, -3.0, 0.0, 0.0, 50.0, 0.0)
$CrosTex1 = _IrrGetTexture("Meshes\c1.png")
$CrosTex2 = _IrrGetTexture("Meshes\c2.png")
_IrrHideMouse()
While _IrrRunning()
    While _IrrMouseEventAvailable()
        $pMouseEvent = _IrrReadMouseEvent()
        $Get = __getMouseEvt($pMouseEvent, $EVT_MOUSE_IACTION)
        If $Get = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then $Trigger = 1
        If $Get = $IRR_EMIE_LMOUSE_LEFT_UP Then $Trigger = 0
    WEnd
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then YaratikEkle()
        EndIf
    WEnd
    If $Trigger = 1 Then Algila()
    If $NodeHit Then Vurus()
    AtakBitti()
    If TimerDiff($YaratikHareket) >= 100 Then YaratikHareket(1)
    If TimerDiff($Bullet) >= 150 Then KursunSil()

    CanKontrol()
;~     _IrrSetWindowCaption("FPS: " & _IrrGetFPS() & " | Monster Count: " & ($yaratiksayi - 2) & " | Target: " & $Target[0] & "," & $Target[1] & "," & $Target[2])
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    CanlariYaz()
    _IrrGetScreenSize($w, $h)

    If $AttackC = 1 Then _IrrDraw2DImageElement($CrosTex2, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    If $AttackC = 0 Then _IrrDraw2DImageElement($CrosTex1, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)

    $metrics = "FPS: " & _IrrGetFPS() &@CRLF& "Monster Count: " & ($yaratiksayi - 2) &@CRLF& "Target x: " & $Target[0] &@CRLF& "Target y: " &  $Target[1] &@CRLF& "Target z: " &  $Target[2];<===
    _Irr2DFontDraw ( $BitmapFont, $metrics, 4,4, 250, 52 );<===

    _IrrEndScene()
WEnd
_IrrStop()

Func YaratikEkle($HP = 100)
    $Monster[$yaratiksayi][1] = $HP
    $YaratikLoad = _IrrGetMesh("Meshes\zumlin.md2")
    $YaratikTexture = _IrrGetTexture("Meshes\zumlin.pcx")
    $Monster[$yaratiksayi][0] = _IrrAddMeshToScene($YaratikLoad)
    _IrrSetNodeMaterialTexture($Monster[$yaratiksayi][0], $YaratikTexture, 0)
    _IrrSetNodeMaterialFlag($Monster[$yaratiksayi][0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($Monster[$yaratiksayi][0], $IRR_EMAT_STAND)
    _IrrSetNodeScale($Monster[$yaratiksayi][0], 2, 2, 2)
    _IrrSetNodePosition($Monster[$yaratiksayi][0], Random(-500, 500, 1), -200, Random(-500, 500, 1))
    $Collision4 = _IrrGetCollisionGroupFromMesh($YaratikLoad, $Monster[$yaratiksayi][0]);2
    $yaratiksayi += 1
EndFunc   ;==>YaratikEkle

Func CanlariYaz()
    For $Whp = 2 To UBound($Monster) - 1
        If $Monster[$Whp][1] <> "die" And $Monster[$Whp][0] <> 999 Then
            $posi = _IrrGetNodePosition($Monster[$Whp][0])
            _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $posi)
            _Irr2DFontDraw($BitmapFont, "-Monster " & $Whp - 1 & "-" & @LF & "HP: " & $Monster[$Whp][1], $x,$y, $x, $y)
        EndIf
    Next
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600) ;player
EndFunc   ;==>CanlariYaz

Func AtakBitti()
    For $aB = 1 To UBound($Monster) - 1
        If TimerDiff($Attack[$aB]) >= 400 Then
            If $Monster[$aB][2] = 1 Then
                Dim $NodeHit = 0, $AttackC = 0
                $Attack[$aB] = -1
                $Monster[$aB][2] = 0
                If $Monster[$aB][1] <> "die" Then _IrrPlayNodeMD2Animation($Monster[$aB][0], $IRR_EMAT_STAND)
            EndIf
        EndIf
    Next
EndFunc   ;==>AtakBitti

Func KursunSil()
    For $adr = 1 To $blt
        _IrrRemoveNode($beam[$adr])
    Next
    $blt = 0
EndFunc   ;==>KursunSil

Func CanKontrol()
    For $i = 1 To UBound($Monster) - 1
        If $Monster[$i][1] <= 0 And Not $Monster[$i][1] = "die" Then Oldur($i)
    Next
EndFunc   ;==>CanKontrol

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 800, 0)
EndFunc   ;==>Oldur

Func Algila()
    $Target = _IrrGetCameraTarget($CameraNode)
    $Ray = _IrrGetRayFromScreenCoordinates(400, 300, $CameraNode)
    $Ray1[0] = $Ray[0][0]
    $Ray1[1] = $Ray[0][1]
    $Ray1[2] = $Ray[0][2]
    $Ray2[0] = $Ray[1][0]
    $Ray2[1] = $Ray[1][1]
    $Ray2[2] = $Ray[1][2]
    _IrrGetNodeAndCollisionPointFromRay($Ray1, $Ray2, $NodeHit, $Target[0], $Target[1], $Target[2], $Null, $Null, $Null, 0, $IRR_NO_OBJECT)
EndFunc   ;==>Algila

Func Vurus()
    If $NodeHit And $Trigger = 1 Then
        $NoHit = False
        For $i = 1 To UBound($Monster) - 1
            If $i = 49 Then
                $NoHit = True
                ExitLoop
            EndIf
            If $NodeHit = $Monster[$i][0] And $i > 1 Then ExitLoop
        Next
        $Attacked = $i
        If $Monster[$Attacked][1] < 1 Then $NoHit = True
        If $NoHit = True Then
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            Beam()
        Else
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            $blt1 += 1
            $Attack[$Attacked] = TimerInit()
            $Monster[$Attacked][2] = 1
            Beam()
            $Monster[$Attacked][1] -= 10
            $vuruldu = $Attacked
            _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
            $Monster[$Attacked][2] = 1
            $AttackC = 1
        EndIf
    EndIf
EndFunc   ;==>Vurus

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 2)
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])

    $g[$blt1] = _IrrAddBillBoardToScene(2, 2, $Target[0], $Target[1] + 10, $Target[2])
    _IrrSetNodeMaterialTexture($g[$blt1], $MeshTexture, 0)
    _IrrSetNodeMaterialFlag($g[$blt1], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrSetNodeMaterialType($g[$blt1], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    _IrrAddFadeAnimator($g[$blt1], 1000)
EndFunc   ;==>Beam

Func YaratikHareket($aDurum, $aYaratik = 0, $aX = 0, $bX = 0, $cX = 0)
    Select
        Case $aDurum = 1
            For $i = 1 to UBound($Monster) -1
                if $Monster[$i][3] = 1 Then
                    _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_STAND)
                    $Monster[$i][3] = 0
                EndIf
            Next
            $YaratikHareket = -1
        Case $aDurum = 2
            _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_RUN)
            _IrrSetNodePosition($Monster[$aYaratik][0], $aX, $bX, $cX)
            $Monster[$aYaratik][3] = 1
            $YaratikHareket = TimerInit()
    EndSelect
EndFunc
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

added bogQ's lines and GUI :huh2:

--deleted

edit:

try the new 'q' key ;)

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "au3Irrlicht2.au3"
#include "array.au3"

HotKeySet("{ESC}", "_exit")

_IrrStart($IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON)

Func _exit()
    _IrrStop()
EndFunc   ;==>_exit

Global Enum $MGUI_BTTN_BASLA, _ ;    102
        $MGUI_BTTN_CIKIS ;      103

$BitmapFont = _IrrGetFont("Meshes\fonthaettenschweiler.bmp")
_IrrGUISetFont( $BitmapFont )
_IrrSetWindowCaption("My Game")

_IrrGUISetFont($BitmapFont)
;_IrrGUISetColor($EGDC_3D_FACE, 192, 255, 255, 255)
;_IrrGUISetColor($EGDC_BUTTON_TEXT, 0, 64, 64, 255)

_IrrShowMouse()
$guiStatic = _IrrAddStaticText("UNNAMED WORK", 75, 10, 256, 36, $IRR_GUI_NO_BORDER, $IRR_GUI_NO_WRAP)
_IrrAddButton(16, 36, 112, 64, $MGUI_BTTN_BASLA, "Oyuna BaÅŸla")
_IrrAddButton(128, 36, 224, 64, $MGUI_BTTN_CIKIS, "Çıkış")
_IrrGUIEvents(1)

While _IrrRunning()
    _IrrBeginScene(0, 100, 200)
    _IrrDrawScene()
    _IrrDrawGUI()
    If _IrrGUIEventAvailable() Then
        $pGUIEvent = _IrrReadGUIEvent()
        $gui_ID = __getGuiEvt($pGUIEvent, $EVT_GUI_IID)
        $gui_Event = __getGuiEvt($pGUIEvent, $EVT_GUI_IEVENT)
        Select
            Case $gui_ID = $MGUI_BTTN_CIKIS
                If $gui_Event = $EGET_BUTTON_CLICKED Then
                    _IrrGUIClear()
                    _IrrGUIEvents(0)
                    _IrrEndScene()
                    _IrrStop()
                EndIf

            Case $gui_ID = $MGUI_BTTN_BASLA
                If $gui_Event = $EGET_BUTTON_CLICKED Then
                    _IrrGUIClear()
                    LoadIt()
                    _IrrGUIEvents(0)
                    ExitLoop
                EndIf
        EndSelect
    EndIf
    _IrrEndScene()
WEnd

Func LoadIt()
    $guiStatic = _IrrAddStaticText("[-]",350,290,450,350, $IRR_GUI_NO_BORDER,$IRR_GUI_NO_WRAP )
    _IrrGUISetColor($EGDC_BUTTON_TEXT, 255, 255, 255, 255)
EndFunc

;~ ############# GAME #############
Dim $Mesh1, $Node1, $Collision1, $Mesh2, $Node2, $Collision2, $Mesh3, $Node3, $Mesh4, $Mesh4Texture, $Node4, $Collision4, $Camera, $keyStruct, $x, $y, $moving = 0
Dim $Distance, $Position, $CollisionState, $CollisionAnimator, $CollisionAnimator2, $CameraNode, $CombinedCollision, $Target[5], $pMouseEvent, $vect[3], $blt1 = 0
Dim $NodeHit, $Ray, $Ray1[3], $Ray2[3], $Null, $CrosTex, $Bullethole1, $Trigger, $Playing[50], $Get, $Attack[50], $Bullet, $Camera = -2, $nodea3, $YaratikHareket[50]
Dim $BitmapFont, $beam[199], $blt = 0, $Monster[50][50], $NoHit, $ohMyRet[99], $dummy, $Attacked, $yaratiksayi = 2, $pos = 0, $AttackC = 0, $w, $h, $g[199], $something
Global $vuruldu

_IrrGUISetText($guiStatic, "LOADING %35")
_IrrHideMouse()
_IrrBeginScene(0, 100, 200)
_IrrDrawScene()
_IrrDrawGUI()
_IrrEndScene()

For $i = 1 To UBound($Monster) - 1
    $Monster[$i][0] = 999
    $Monster[$i][1] = 999
    $Monster[$i][2] = 0
    $Monster[$i][3] = 0
    $Attack[$i] = 0
Next

$HaritaLoad = _IrrGetMesh("Meshes\1.irrmesh")
$Harita = _IrrAddMeshToSceneAsOcttree($HaritaLoad)
_IrrSetNodeMaterialFlag($Harita, $IRR_EMF_LIGHTING, $IRR_OFF)
$Collision1 = _IrrGetCollisionGroupFromComplexMesh($HaritaLoad, $Harita, 0)
$BitmapFont = _IrrGetFont("Meshes\bitmapfont.bmp")

_IrrGUISetText($guiStatic, "LOADING %75")
_IrrBeginScene(0, 100, 200)
_IrrDrawScene()
_IrrDrawGUI()
_IrrEndScene()

$SilahLoad = _IrrGetMesh("Meshes\mar_rifle.3ds")
$SilahTexture = _IrrGetTexture("Meshes\m_rifl.bmp")
$Silah = _IrrAddMeshToScene($SilahLoad)
_IrrSetNodeMaterialTexture($Silah, $SilahTexture, 0)
_IrrSetNodeMaterialFlag($Silah, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodePosition($Silah, 7, -10, 20)
_IrrSetNodeRotation($Silah, 0, 0, 0)
_IrrSetNodeScale($Silah, .5, .5, .35)

YaratikEkle()
YaratikEkle()

$CombinedCollision = _IrrCreateCombinedCollisionGroup()
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision1)
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision2)

_IrrGUISetText($guiStatic, "LOADING Complete")
_IrrBeginScene(0, 100, 200)
_IrrDrawScene()
_IrrDrawGUI()
_IrrEndScene()

$MeshTexture = _IrrGetTexture("Meshes\beam.png")
$Monster[1][1] = 100
$Monster[1][0] = _IrrAddFPSCamera(0, 150.0, 0.5, -1, __CreatePtrKeyMapArray($keyStruct, $KEY_KEY_W, $KEY_KEY_S, $KEY_KEY_A, $KEY_KEY_D, $KEY_SPACE), 5, 100, 2.0)
$keyStruct = 0
$CameraNode = $Monster[1][0]
_IrrAddChildToParent($Silah, $CameraNode)
$CollisionAnimator = _IrrAddCollisionAnimator($CombinedCollision, $CameraNode, 30.0, 30.0, 30.0, 0.0, -3.0, 0.0, 0.0, 50.0, 0.0)
$CrosTex1 = _IrrGetTexture("Meshes\c1.png")
$CrosTex2 = _IrrGetTexture("Meshes\c2.png")

_IrrGUIClear()
_IrrGUIEvents(0)
While _IrrRunning()
    While _IrrMouseEventAvailable()
        $pMouseEvent = _IrrReadMouseEvent()
        $Get = __getMouseEvt($pMouseEvent, $EVT_MOUSE_IACTION)
        If $Get = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then $Trigger = 1
        If $Get = $IRR_EMIE_LMOUSE_LEFT_UP Then $Trigger = 0
    WEnd
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then YaratikEkle()
        EndIf
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_Q Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then
                For $i = 2 To UBound($Monster) - 1
                    if $Monster[$i][0] <> 999 Then
                        $ewq = _IrrGetNodeAbsolutePosition($Monster[$i][0])
                        YaratikHareket(2,$i, $ewq[0] +10, $ewq[1], $ewq[2])
                    EndIf
                Next
            EndIf
        EndIf
    WEnd
    If $Trigger = 1 Then Algila()
    If $NodeHit Then Vurus()
    AtakBitti()
    If $moving = 1 Then YaratikHareket(1)
    If TimerDiff($Bullet) >= 150 Then KursunSil()

    CanKontrol()
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    CanlariYaz()
    _IrrGetScreenSize($w, $h)

    If $AttackC = 1 Then _IrrDraw2DImageElement($CrosTex2, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    If $AttackC = 0 Then _IrrDraw2DImageElement($CrosTex1, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    $metrics = "FPS: " & _IrrGetFPS() &@CRLF& "MONSTERS: " & ($yaratiksayi - 2)
    _Irr2DFontDraw ( $BitmapFont, $metrics, 4,4, 250, 52 )
    _IrrEndScene()
WEnd
_IrrStop()

Func YaratikEkle($HP = 100)
    $Monster[$yaratiksayi][1] = $HP
    $YaratikLoad = _IrrGetMesh("Meshes\zumlin.md2")
    $YaratikTexture = _IrrGetTexture("Meshes\zumlin.pcx")
    $Monster[$yaratiksayi][0] = _IrrAddMeshToScene($YaratikLoad)
    _IrrSetNodeMaterialTexture($Monster[$yaratiksayi][0], $YaratikTexture, 0)
    _IrrSetNodeMaterialFlag($Monster[$yaratiksayi][0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($Monster[$yaratiksayi][0], $IRR_EMAT_STAND)
    _IrrSetNodeScale($Monster[$yaratiksayi][0], 2, 2, 2)
    _IrrSetNodePosition($Monster[$yaratiksayi][0], Random(-500, 500, 1), -200, Random(-500, 500, 1))
    $Collision4 = _IrrGetCollisionGroupFromMesh($YaratikLoad, $Monster[$yaratiksayi][0]);2
    $yaratiksayi += 1
EndFunc   ;==>YaratikEkle

Func CanlariYaz()
    For $Whp = 2 To UBound($Monster) - 1
        If $Monster[$Whp][1] <> "die" And $Monster[$Whp][0] <> 999 Then
            $posi = _IrrGetNodePosition($Monster[$Whp][0])
            _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $posi)
            _Irr2DFontDraw($BitmapFont, "ID " & $Whp - 1 & @LF & "HP: " & $Monster[$Whp][1], $x,$y, $x, $y)
        EndIf
    Next
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600) ;player
EndFunc   ;==>CanlariYaz

Func AtakBitti()
    For $aB = 1 To UBound($Monster) - 1
        If TimerDiff($Attack[$aB]) >= 400 Then
            If $Monster[$aB][2] = 1 Then
                Dim $NodeHit = 0, $AttackC = 0
                $Attack[$aB] = -1
                $Monster[$aB][2] = 0
                If $Monster[$aB][1] <> "die" Then _IrrPlayNodeMD2Animation($Monster[$aB][0], $IRR_EMAT_STAND)
            EndIf
        EndIf
    Next
EndFunc   ;==>AtakBitti

Func KursunSil()
    For $adr = 1 To $blt
        _IrrRemoveNode($beam[$adr])
    Next
    $blt = 0
    $blt1 = 0
EndFunc   ;==>KursunSil

Func CanKontrol()
    For $i = 1 To UBound($Monster) - 1
        If $Monster[$i][1] <= 0 And Not $Monster[$i][1] = "die" Then Oldur($i)
    Next
EndFunc   ;==>CanKontrol

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 800, 0)
EndFunc   ;==>Oldur

Func Algila()
    $Target = _IrrGetCameraTarget($CameraNode)
    $Ray = _IrrGetRayFromScreenCoordinates(400, 300, $CameraNode)
    $Ray1[0] = $Ray[0][0]
    $Ray1[1] = $Ray[0][1]
    $Ray1[2] = $Ray[0][2]
    $Ray2[0] = $Ray[1][0]
    $Ray2[1] = $Ray[1][1]
    $Ray2[2] = $Ray[1][2]
    _IrrGetNodeAndCollisionPointFromRay($Ray1, $Ray2, $NodeHit, $Target[0], $Target[1], $Target[2], $Null, $Null, $Null, 0, $IRR_NO_OBJECT)
EndFunc   ;==>Algila

Func Vurus()
    If $NodeHit And $Trigger = 1 Then
        $NoHit = False
        For $i = 1 To UBound($Monster) - 1
            If $i = 49 Then
                $NoHit = True
                ExitLoop
            EndIf
            If $NodeHit = $Monster[$i][0] And $i > 1 Then ExitLoop
        Next
        $Attacked = $i
        If $Monster[$Attacked][1] < 1 Then $NoHit = True
        If $NoHit = True Then
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            Beam()
        Else
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            $blt1 += 1
            $Attack[$Attacked] = TimerInit()
            $Monster[$Attacked][2] = 1
            Beam()
            $Monster[$Attacked][1] -= 10
            $vuruldu = $Attacked
            _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
            $Monster[$Attacked][2] = 1
            $AttackC = 1
        EndIf
    EndIf
EndFunc   ;==>Vurus

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 2)
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])

    $g[$blt1] = _IrrAddBillBoardToScene(2, 2, $Target[0], $Target[1] + 10, $Target[2])
    _IrrSetNodeMaterialTexture($g[$blt1], $MeshTexture, 0)
    _IrrSetNodeMaterialFlag($g[$blt1], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrSetNodeMaterialType($g[$blt1], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    _IrrAddFadeAnimator($g[$blt1], 1000)
EndFunc   ;==>Beam

Func YaratikHareket($aDurum, $aYaratik = 0, $aX = 0, $bY = 0, $cZ = 0)
    Select
        Case $aDurum = 1
            For $i = 2 To UBound($Monster) - 1
                If TimerDiff($YaratikHareket[$i]) >= 100 And $Monster[$i][0] <> 999 Then
                    _IrrPlayNodeMD2Animation($Monster[$i][0], $IRR_EMAT_STAND)
                    $Monster[$i][3] = 0
                    $YaratikHareket[$i] = -1
                    $something = 1
                EndIf
            Next
            if $something = 1 Then
                $moving = 0
                $something = 0
            EndIf
        Case $aDurum = 2
            if $Monster[$aYaratik][3] = 0 Then
                _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_RUN)
            EndIf
            _IrrSetNodePosition($Monster[$aYaratik][0], $aX, $bY, $cZ)
            $Monster[$aYaratik][3] = 1
            $YaratikHareket[$aYaratik] = TimerInit()
            $moving = 1
    EndSelect
EndFunc   ;==>YaratikHareket
Edited by BiliyomKi
An AutoIT user.
Link to comment
Share on other sites

'q' key? did i miss something, what is supose to happend on q key?

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

hext time tellme to hold it, i was pressing it like maniac and did not seen anything xD

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Fun with Oldur()-kill- func

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    ;_IrrXEffectsStart( $IRR_ON, $IRR_ON , $IRR_ON)
    $Monster[$bYaratik][1] = "die"
    $SmokeParticles = _IrrAddParticleSystemToScene($IRR_NO_EMITTER)
    $SmokeEmitter = __CreateParticleSettings(0, 0, 0, 0, 0, 0, 0, 0.04, 0, 80, 100, 255, 255, 255, 255, 255, 255, 800, 2000, 5.0, 5.0, 15.0, 15.0, 15)
    _IrrAddAnimatedMeshSceneNodeEmitter($SmokeParticles, $Monster[$bYaratik][0], True, 0.25, False, $SmokeEmitter)
    $ParticleTexture = _IrrGetTexture("Meshes\ParticleGrey.bmp")
    _IrrSetNodeMaterialTexture($SmokeParticles, $ParticleTexture, 0)
    _IrrSetNodeMaterialFlag($SmokeParticles, $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrAddFadeOutParticleAffector($SmokeParticles, 2000, 16, 8, 0)
    $asdf = _IrrGetNodeAbsolutePosition($Monster[$bYaratik][0])
    _IrrAddParticleAttractionAffector($SmokeParticles, $asdf[0], $asdf[1], $asdf[2], 20.0, $IRR_REPEL)
    _IrrSetNodePosition($SmokeParticles, $asdf[0], $asdf[1], $asdf[2])
    _IrrSetNodeMaterialType($SmokeParticles, $IRR_EMT_TRANSPARENT_VERTEX_ALPHA)
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 1000, 500)
    _IrrAddFadeAnimator($SmokeParticles, 1000, 0)
EndFunc   ;==>Oldur

PS: you need that particle file

[ ParticleGrey.bmp ]

edit:

fix at YaratikHareket() Func:

Func YaratikHareket($aDurum, $aYaratik = 0, $aX = 0, $bY = 0, $cZ = 0)
    Select
        Case $aDurum = 1
            For $i = 2 To UBound($Monster) - 1
                If TimerDiff($YaratikHareket[$i]) >= 100 And $Monster[$i][0] <> 999 And $Monster[$i][1] <> "die" Then ;<==
                    _IrrPlayNodeMD2Animation($Monster[$i][0], $IRR_EMAT_STAND)
                    $Monster[$i][3] = 0
                    $YaratikHareket[$i] = -1
                    $something = 1
                EndIf
            Next
            If $something = 1 Then
                $moving = 0
                $something = 0
            EndIf
        Case $aDurum = 2
            If $Monster[$aYaratik][3] = 0 Then
                _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_RUN)
            EndIf
            _IrrSetNodePosition($Monster[$aYaratik][0], $aX, $bY, $cZ)
            $Monster[$aYaratik][3] = 1
            $YaratikHareket[$aYaratik] = TimerInit()
            $moving = 1
    EndSelect
EndFunc   ;==>YaratikHareket

edit 2:

fix at while _IrrRunning() section:

...
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then YaratikEkle()
        EndIf
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_Q Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then
                For $i = 2 To UBound($Monster) - 1
                    If $Monster[$i][0] <> 999 And $Monster[$i][1] <> "die" Then ;<==
                        $ewq = _IrrGetNodeAbsolutePosition($Monster[$i][0])
                        YaratikHareket(2, $i, $ewq[0] + 10, $ewq[1], $ewq[2])
                    EndIf
                Next
            EndIf
        EndIf
    WEnd
...
Edited by BiliyomKi
An AutoIT user.
Link to comment
Share on other sites

Its hard for me to realise in my head _getKeyEv func, for how exactly do they work, im still using ispressed :huh2:

newer the less there is some bug in YaratikEkle() that sometimes add monsters and you cant target them, and i cant finde it :/

another bug is when you hold the "e" key for some time, youl get

Warehouse Script.au3 (181) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$Monster[$yaratiksayi][1] = $HP

^ ERROR

maby if you try to limit max monsters and every time you kill one and when the user try to add one more monster, it will populate his old place in array.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

I understand the _getKetEvt func with the examples, it's not too hard; just have to get used to :huh2:

yes, I'm looking for a fix the target bug but I can't find me too but I dont have any idea for the second bug :|

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "au3Irrlicht2.au3"
#include "array.au3"

HotKeySet("{ESC}", "_exit")

_IrrStart($IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON)

Func _exit()
    _IrrStop()
EndFunc   ;==>_exit

Global Enum $MGUI_BTTN_BASLA, _ ;    102
        $MGUI_BTTN_CIKIS ;      103

$BitmapFont = _IrrGetFont("Meshes\fonthaettenschweiler.bmp")
_IrrGUISetFont($BitmapFont)
_IrrSetWindowCaption("My Game")

_IrrGUISetFont($BitmapFont)
;_IrrGUISetColor($EGDC_3D_FACE, 192, 255, 255, 255)
;_IrrGUISetColor($EGDC_BUTTON_TEXT, 0, 64, 64, 255)

_IrrShowMouse()
$guiStatic = _IrrAddStaticText("UNNAMED WORK", 75, 10, 256, 36, $IRR_GUI_NO_BORDER, $IRR_GUI_NO_WRAP)
_IrrAddButton(16, 36, 112, 64, $MGUI_BTTN_BASLA, "Oyuna BaÅŸla")
_IrrAddButton(128, 36, 224, 64, $MGUI_BTTN_CIKIS, "Çıkış")
_IrrGUIEvents(1)

While _IrrRunning()
    _IrrBeginScene(0, 100, 200)
    _IrrDrawScene()
    _IrrDrawGUI()
    If _IrrGUIEventAvailable() Then
        $pGUIEvent = _IrrReadGUIEvent()
        $gui_ID = __getGuiEvt($pGUIEvent, $EVT_GUI_IID)
        $gui_Event = __getGuiEvt($pGUIEvent, $EVT_GUI_IEVENT)
        Select
            Case $gui_ID = $MGUI_BTTN_CIKIS
                If $gui_Event = $EGET_BUTTON_CLICKED Then
                    _IrrGUIClear()
                    _IrrGUIEvents(0)
                    _IrrEndScene()
                    _IrrStop()
                EndIf

            Case $gui_ID = $MGUI_BTTN_BASLA
                If $gui_Event = $EGET_BUTTON_CLICKED Then
                    _IrrGUIClear()
                    LoadIt()
                    _IrrGUIEvents(0)
                    ExitLoop
                EndIf
        EndSelect
    EndIf
    _IrrEndScene()
WEnd

Func LoadIt()
    $guiStatic = _IrrAddStaticText("[-]", 350, 290, 450, 350, $IRR_GUI_NO_BORDER, $IRR_GUI_NO_WRAP)
    _IrrGUISetColor($EGDC_BUTTON_TEXT, 255, 255, 255, 255)
EndFunc   ;==>LoadIt

;~ ############# GAME #############
Dim $Mesh1, $Node1, $Collision1, $Mesh2, $Node2, $Collision2, $Mesh3, $Node3, $Mesh4, $Mesh4Texture, $Node4, $Collision4, $Camera, $keyStruct, $x, $y, $moving = 0
Dim $Distance, $Position, $CollisionState, $CollisionAnimator, $CollisionAnimator2, $CameraNode, $CombinedCollision, $Target[5], $pMouseEvent, $vect[3], $blt1 = 0
Dim $NodeHit, $Ray, $Ray1[3], $Ray2[3], $Null, $CrosTex, $Bullethole1, $Trigger, $Playing[50], $Get, $Attack[50], $Bullet, $Camera = -2, $nodea3, $YaratikHareket[50]
Dim $BitmapFont, $beam[199], $blt = 0, $Monster[50][50], $NoHit, $ohMyRet[99], $dummy, $Attacked, $yaratiksayi = 2, $pos = 0, $AttackC = 0, $w, $h, $g[199], $something
Dim $vuruldu

_IrrHideMouse()
ilerleme("%0")

For $i = 1 To UBound($Monster) - 1
    $Monster[$i][0] = 999
    $Monster[$i][1] = 999
    $Monster[$i][2] = 0
    $Monster[$i][3] = 0
    $Attack[$i] = 0
Next
ilerleme("%15")
$HaritaLoad = _IrrGetMesh("Meshes\1.irrmesh")
$Harita = _IrrAddMeshToSceneAsOcttree($HaritaLoad)
_IrrSetNodeMaterialFlag($Harita, $IRR_EMF_LIGHTING, $IRR_OFF)
$Collision1 = _IrrGetCollisionGroupFromComplexMesh($HaritaLoad, $Harita, 0)
$BitmapFont = _IrrGetFont("Meshes\bitmapfont.bmp")

ilerleme("%30")
$SilahLoad = _IrrGetMesh("Meshes\mar_rifle.3ds")
$SilahTexture = _IrrGetTexture("Meshes\m_rifl.bmp")
$Silah = _IrrAddMeshToScene($SilahLoad)
_IrrSetNodeMaterialTexture($Silah, $SilahTexture, 0)
_IrrSetNodeMaterialFlag($Silah, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodePosition($Silah, 7, -10, 20)
_IrrSetNodeRotation($Silah, 0, 0, 0)
_IrrSetNodeScale($Silah, .5, .5, .35)

ilerleme("%45")
YaratikEkle()
YaratikEkle()

ilerleme("%60")
$SmokeEmitter = __CreateParticleSettings(0, 0, 0, 0, 0, 0, 0, 0.04, 0, 80, 100, 255, 255, 255, 255, 255, 255, 800, 2000, 5.0, 5.0, 15.0, 15.0, 15)
$ParticleTexture = _IrrGetTexture("Meshes\ParticleGrey.bmp")
$CombinedCollision = _IrrCreateCombinedCollisionGroup()
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision1)
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision2)


ilerleme("%75")
$MeshTexture = _IrrGetTexture("Meshes\beam.png")
$Monster[1][1] = 100
$Monster[1][0] = _IrrAddFPSCamera(0, 150.0, 0.5, -1, __CreatePtrKeyMapArray($keyStruct, $KEY_KEY_W, $KEY_KEY_S, $KEY_KEY_A, $KEY_KEY_D, $KEY_SPACE), 5, 100, 2.0)
$keyStruct = 0
$CameraNode = $Monster[1][0]
_IrrAddChildToParent($Silah, $CameraNode)
$CollisionAnimator = _IrrAddCollisionAnimator($CombinedCollision, $CameraNode, 30.0, 30.0, 30.0, 0.0, -3.0, 0.0, 0.0, 50.0, 0.0)
$CrosTex1 = _IrrGetTexture("Meshes\c1.png")
$CrosTex2 = _IrrGetTexture("Meshes\c2.png")

ilerleme("%100")
_IrrGUIEvents(0)
_IrrGUIClear()

While _IrrRunning()
    While _IrrMouseEventAvailable()
        $pMouseEvent = _IrrReadMouseEvent()
        $Get = __getMouseEvt($pMouseEvent, $EVT_MOUSE_IACTION)
        If $Get = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then $Trigger = 1
        If $Get = $IRR_EMIE_LMOUSE_LEFT_UP Then $Trigger = 0
    WEnd
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then
                If $yaratiksayi < 50 And $yaratiksayi <> "MAX" Then
                    YaratikEkle()
                Else
                    $yaratiksayi = "MAX"
                EndIf
            EndIf
        EndIf
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_Q Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then
                For $i = 2 To UBound($Monster) - 1
                    If $Monster[$i][0] <> 999 And $Monster[$i][1] <> "die" Then
                        $ewq = _IrrGetNodeAbsolutePosition($Monster[$i][0])
                        YaratikHareket(2, $i, $ewq[0] + 10, $ewq[1], $ewq[2])
                    EndIf
                Next
            EndIf
        EndIf
    WEnd
    If $Trigger = 1 Then Algila()
    If $NodeHit Then Vurus()
    AtakBitti()
    If $moving = 1 Then YaratikHareket(1)
    If TimerDiff($Bullet) >= 150 Then KursunSil()

    CanKontrol()
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    CanlariYaz()
    _IrrGetScreenSize($w, $h)

    If $AttackC = 1 Then _IrrDraw2DImageElement($CrosTex2, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    If $AttackC = 0 Then _IrrDraw2DImageElement($CrosTex1, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    $metrics = "FPS: " & _IrrGetFPS() & @CRLF & "MONSTERS: " & $yaratiksayi
    _Irr2DFontDraw($BitmapFont, $metrics, 4, 4, 250, 52)
    _IrrEndScene()
WEnd
_IrrStop()

Func ilerleme($yuzde)
    _IrrGUISetText($guiStatic, "LOADING " & $yuzde)
    _IrrBeginScene(0, 100, 200)
    _IrrDrawScene()
    _IrrDrawGUI()
    _IrrEndScene()
    Sleep(10)
EndFunc   ;==>ilerleme

Func YaratikEkle($HP = 100)
    $Monster[$yaratiksayi][1] = $HP
    $YaratikLoad = _IrrGetMesh("Meshes\zumlin.md2")
    $YaratikTexture = _IrrGetTexture("Meshes\zumlin.pcx")
    $Monster[$yaratiksayi][0] = _IrrAddMeshToScene($YaratikLoad)
    _IrrSetNodeMaterialTexture($Monster[$yaratiksayi][0], $YaratikTexture, 0)
    _IrrSetNodeMaterialFlag($Monster[$yaratiksayi][0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($Monster[$yaratiksayi][0], $IRR_EMAT_STAND)
    _IrrSetNodeScale($Monster[$yaratiksayi][0], 2, 2, 2)
    _IrrSetNodePosition($Monster[$yaratiksayi][0], Random(-500, 500, 1), -200, Random(-500, 500, 1))
    $Collision4 = _IrrGetCollisionGroupFromMesh($YaratikLoad, $Monster[$yaratiksayi][0]);2
    $yaratiksayi += 1
EndFunc   ;==>YaratikEkle

Func CanlariYaz()
    For $Whp = 2 To UBound($Monster) - 1
        If $Monster[$Whp][1] <> "die" And $Monster[$Whp][0] <> 999 Then
            $posi = _IrrGetNodePosition($Monster[$Whp][0])
            _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $posi)
            _Irr2DFontDraw($BitmapFont, "ID " & $Whp - 1 & @LF & "HP: " & $Monster[$Whp][1], $x, $y, $x, $y)
        EndIf
    Next
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600) ;player
EndFunc   ;==>CanlariYaz

Func AtakBitti()
    For $aB = 1 To UBound($Monster) - 1
        If TimerDiff($Attack[$aB]) >= 400 Then
            If $Monster[$aB][2] = 1 Then
                Dim $NodeHit = 0, $AttackC = 0
                $Attack[$aB] = -1
                $Monster[$aB][2] = 0
                If $Monster[$aB][1] <> "die" Then _IrrPlayNodeMD2Animation($Monster[$aB][0], $IRR_EMAT_STAND)
            EndIf
        EndIf
    Next
EndFunc   ;==>AtakBitti

Func KursunSil()
    For $adr = 1 To $blt
        _IrrRemoveNode($beam[$adr])
    Next
    $blt = 0
    $blt1 = 0
EndFunc   ;==>KursunSil

Func CanKontrol()
    For $i = 1 To UBound($Monster) - 1
        If $Monster[$i][1] <= 0 And Not $Monster[$i][1] = "die" Then Oldur($i)
    Next
EndFunc   ;==>CanKontrol

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    $SmokeParticles = _IrrAddParticleSystemToScene($IRR_NO_EMITTER)
    _IrrAddAnimatedMeshSceneNodeEmitter($SmokeParticles, $Monster[$bYaratik][0], True, 0.25, False, $SmokeEmitter)
    _IrrSetNodeMaterialTexture($SmokeParticles, $ParticleTexture, 0)
    _IrrSetNodeMaterialFlag($SmokeParticles, $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrAddFadeOutParticleAffector($SmokeParticles, 2000, 16, 8, 0)
    $asdf = _IrrGetNodeAbsolutePosition($Monster[$bYaratik][0])
    _IrrAddParticleAttractionAffector($SmokeParticles, $asdf[0], $asdf[1], $asdf[2], 20.0, $IRR_REPEL)
    _IrrSetNodePosition($SmokeParticles, $asdf[0], $asdf[1], $asdf[2])
    _IrrSetNodeMaterialType($SmokeParticles, $IRR_EMT_TRANSPARENT_VERTEX_ALPHA)
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 1000, 500)
    _IrrAddFadeAnimator($SmokeParticles, 1000, 0)
EndFunc   ;==>Oldur

Func Algila()
    $Target = _IrrGetCameraTarget($CameraNode)
    $Ray = _IrrGetRayFromScreenCoordinates(400, 300, $CameraNode)
    $Ray1[0] = $Ray[0][0]
    $Ray1[1] = $Ray[0][1]
    $Ray1[2] = $Ray[0][2]
    $Ray2[0] = $Ray[1][0]
    $Ray2[1] = $Ray[1][1]
    $Ray2[2] = $Ray[1][2]
    _IrrGetNodeAndCollisionPointFromRay($Ray1, $Ray2, $NodeHit, $Target[0], $Target[1], $Target[2], $Null, $Null, $Null, 0, $IRR_NO_OBJECT)
EndFunc   ;==>Algila

Func Vurus()
    If $NodeHit And $Trigger = 1 Then
        $NoHit = False
        For $i = 1 To UBound($Monster) - 1
            If $i = 49 Then
                $NoHit = True
                ExitLoop
            EndIf
            If $NodeHit = $Monster[$i][0] And $i > 1 Then ExitLoop
        Next
        $Attacked = $i
        If $Monster[$Attacked][1] < 1 Then $NoHit = True
        If $NoHit = True Then
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            Beam()
        Else
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            $blt1 += 1
            $Attack[$Attacked] = TimerInit()
            $Monster[$Attacked][2] = 1
            Beam()
            $Monster[$Attacked][1] -= 10
            $vuruldu = $Attacked
            _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
            $Monster[$Attacked][2] = 1
            $AttackC = 1
        EndIf
    EndIf
EndFunc   ;==>Vurus

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 2)
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])

    $g[$blt1] = _IrrAddBillBoardToScene(2, 2, $Target[0], $Target[1] + 10, $Target[2])
    _IrrSetNodeMaterialTexture($g[$blt1], $MeshTexture, 0)
    _IrrSetNodeMaterialFlag($g[$blt1], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrSetNodeMaterialType($g[$blt1], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    _IrrAddFadeAnimator($g[$blt1], 1000)
EndFunc   ;==>Beam

Func YaratikHareket($aDurum, $aYaratik = 0, $aX = 0, $bY = 0, $cZ = 0)
    Select
        Case $aDurum = 1
            For $i = 2 To UBound($Monster) - 1
                If TimerDiff($YaratikHareket[$i]) >= 100 And $Monster[$i][0] <> 999 And $Monster[$i][1] <> "die" Then
                    _IrrPlayNodeMD2Animation($Monster[$i][0], $IRR_EMAT_STAND)
                    $Monster[$i][3] = 0
                    $YaratikHareket[$i] = -1
                    $something = 1
                EndIf
            Next
            If $something = 1 Then
                $moving = 0
                $something = 0
            EndIf
        Case $aDurum = 2
            If $Monster[$aYaratik][3] = 0 Then
                _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_RUN)
            EndIf
            _IrrSetNodePosition($Monster[$aYaratik][0], $aX, $bY, $cZ)
            $Monster[$aYaratik][3] = 1
            $YaratikHareket[$aYaratik] = TimerInit()
            $moving = 1
    EndSelect
EndFunc   ;==>YaratikHareket

is it fix the second bug?

edit:

I think both bugs are fixed:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_Tidy_Stop_OnError=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "au3Irrlicht2.au3"
#include "array.au3"

HotKeySet("{ESC}", "_exit")

_IrrStart($IRR_EDT_OPENGL, 800, 600, $IRR_BITS_PER_PIXEL_32, $IRR_WINDOWED, $IRR_SHADOWS, $IRR_CAPTURE_EVENTS, $IRR_VERTICAL_SYNC_ON)

Func _exit()
    _IrrStop()
EndFunc   ;==>_exit

Global Enum $MGUI_BTTN_BASLA, _ ;    102
        $MGUI_BTTN_CIKIS ;      103

$BitmapFont = _IrrGetFont("Meshes\fonthaettenschweiler.bmp")
_IrrGUISetFont($BitmapFont)
_IrrSetWindowCaption("My Game")

_IrrGUISetFont($BitmapFont)
;_IrrGUISetColor($EGDC_3D_FACE, 192, 255, 255, 255)
;_IrrGUISetColor($EGDC_BUTTON_TEXT, 0, 64, 64, 255)

_IrrShowMouse()
$guiStatic = _IrrAddStaticText("UNNAMED WORK", 75, 10, 256, 36, $IRR_GUI_NO_BORDER, $IRR_GUI_NO_WRAP)
_IrrAddButton(16, 36, 112, 64, $MGUI_BTTN_BASLA, "Oyuna BaÅŸla")
_IrrAddButton(128, 36, 224, 64, $MGUI_BTTN_CIKIS, "Çıkış")
_IrrGUIEvents(1)

While _IrrRunning()
    _IrrBeginScene(0, 100, 200)
    _IrrDrawScene()
    _IrrDrawGUI()
    If _IrrGUIEventAvailable() Then
        $pGUIEvent = _IrrReadGUIEvent()
        $gui_ID = __getGuiEvt($pGUIEvent, $EVT_GUI_IID)
        $gui_Event = __getGuiEvt($pGUIEvent, $EVT_GUI_IEVENT)
        Select
            Case $gui_ID = $MGUI_BTTN_CIKIS
                If $gui_Event = $EGET_BUTTON_CLICKED Then
                    _IrrGUIClear()
                    _IrrGUIEvents(0)
                    _IrrEndScene()
                    _IrrStop()
                EndIf

            Case $gui_ID = $MGUI_BTTN_BASLA
                If $gui_Event = $EGET_BUTTON_CLICKED Then
                    _IrrGUIClear()
                    LoadIt()
                    _IrrGUIEvents(0)
                    ExitLoop
                EndIf
        EndSelect
    EndIf
    _IrrEndScene()
WEnd

Func LoadIt()
    $guiStatic = _IrrAddStaticText("[-]", 350, 290, 450, 350, $IRR_GUI_NO_BORDER, $IRR_GUI_NO_WRAP)
    _IrrGUISetColor($EGDC_BUTTON_TEXT, 255, 255, 255, 255)
EndFunc   ;==>LoadIt

;~ ############# GAME #############
Dim $Mesh1, $Node1, $Collision1, $Mesh2, $Node2, $Collision2, $Mesh3, $Node3, $Mesh4, $Mesh4Texture, $Node4, $Collision4, $Camera, $keyStruct, $x, $y, $moving = 0
Dim $Distance, $Position, $CollisionState, $CollisionAnimator, $CollisionAnimator2, $CameraNode, $CombinedCollision, $Target[5], $pMouseEvent, $vect[3], $blt1 = 0
Dim $NodeHit, $Ray, $Ray1[3], $Ray2[3], $Null, $CrosTex, $Bullethole1, $Trigger, $Playing[50], $Get, $Attack[50], $Bullet, $Camera = -2, $nodea3, $YaratikHareket[50]
Dim $BitmapFont, $beam[199], $blt = 0, $Monster[50][50], $NoHit, $ohMyRet[99], $dummy, $Attacked, $yaratiksayi = 1, $pos = 0, $AttackC = 0, $w, $h, $g[199], $something
Dim $vuruldu

_IrrHideMouse()
ilerleme("%0")

For $i = 1 To UBound($Monster) - 1
    $Monster[$i][0] = 999
    $Monster[$i][1] = 999
    $Monster[$i][2] = 0
    $Monster[$i][3] = 0
    $Attack[$i] = 0
Next
ilerleme("%15")
$HaritaLoad = _IrrGetMesh("Meshes\1.irrmesh")
$Harita = _IrrAddMeshToSceneAsOcttree($HaritaLoad)
_IrrSetNodeMaterialFlag($Harita, $IRR_EMF_LIGHTING, $IRR_OFF)
$Collision1 = _IrrGetCollisionGroupFromComplexMesh($HaritaLoad, $Harita, 0)
$BitmapFont = _IrrGetFont("Meshes\bitmapfont.bmp")
$YaratikLoad = _IrrGetMesh("Meshes\zumlin.md2")
$YaratikTexture = _IrrGetTexture("Meshes\zumlin.pcx")

ilerleme("%30")
$SilahLoad = _IrrGetMesh("Meshes\mar_rifle.3ds")
$SilahTexture = _IrrGetTexture("Meshes\m_rifl.bmp")
$Silah = _IrrAddMeshToScene($SilahLoad)
_IrrSetNodeMaterialTexture($Silah, $SilahTexture, 0)
_IrrSetNodeMaterialFlag($Silah, $IRR_EMF_LIGHTING, $IRR_OFF)
_IrrSetNodePosition($Silah, 7, -10, 20)
_IrrSetNodeRotation($Silah, 0, 0, 0)
_IrrSetNodeScale($Silah, .5, .5, .35)

ilerleme("%45")
YaratikEkle()
YaratikEkle()

ilerleme("%60")
$SmokeEmitter = __CreateParticleSettings(0, 0, 0, 0, 0, 0, 0, 0.04, 0, 80, 100, 255, 255, 255, 255, 255, 255, 800, 2000, 5.0, 5.0, 15.0, 15.0, 15)
$ParticleTexture = _IrrGetTexture("Meshes\ParticleGrey.bmp")
$CombinedCollision = _IrrCreateCombinedCollisionGroup()
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision1)
_IrrAddCollisionGroupToCombination($CombinedCollision, $Collision2)


ilerleme("%75")
$MeshTexture = _IrrGetTexture("Meshes\beam.png")
$Monster[1][1] = 100
$Monster[1][0] = _IrrAddFPSCamera(0, 150.0, 0.5, -1, __CreatePtrKeyMapArray($keyStruct, $KEY_KEY_W, $KEY_KEY_S, $KEY_KEY_A, $KEY_KEY_D, $KEY_SPACE), 5, 100, 2.0)
$keyStruct = 0
$CameraNode = $Monster[1][0]
_IrrAddChildToParent($Silah, $CameraNode)
$CollisionAnimator = _IrrAddCollisionAnimator($CombinedCollision, $CameraNode, 30.0, 30.0, 30.0, 0.0, -3.0, 0.0, 0.0, 50.0, 0.0)
$CrosTex1 = _IrrGetTexture("Meshes\c1.png")
$CrosTex2 = _IrrGetTexture("Meshes\c2.png")

ilerleme("%100")
_IrrGUIEvents(0)
_IrrGUIClear()

While _IrrRunning()
    While _IrrMouseEventAvailable()
        $pMouseEvent = _IrrReadMouseEvent()
        $Get = __getMouseEvt($pMouseEvent, $EVT_MOUSE_IACTION)
        If $Get = $IRR_EMIE_LMOUSE_PRESSED_DOWN Then $Trigger = 1
        If $Get = $IRR_EMIE_LMOUSE_LEFT_UP Then $Trigger = 0
    WEnd
    While _IrrKeyEventAvailable()
        $pKeyEvent = _IrrReadKeyEvent()
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_E Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then
                If $yaratiksayi < 48 And $yaratiksayi <> "MAX" Then
                    YaratikEkle()
                Else
                    $yaratiksayi = "MAX"
                EndIf
            EndIf
        EndIf
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_Q Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then
                For $i = 2 To UBound($Monster) - 1
                    If $Monster[$i][0] <> 999 And $Monster[$i][1] <> "die" Then
                        $ewq = _IrrGetNodeAbsolutePosition($Monster[$i][0])
                        YaratikHareket(2, $i, $ewq[0] + 10, $ewq[1], $ewq[2])
                    EndIf
                Next
            EndIf
        EndIf
        If __getKeyEvt($pKeyEvent, $EVT_KEY_IKEY) = $KEY_KEY_F Then
            If __getKeyEvt($pKeyEvent, $EVT_KEY_IDIRECTION) = $IRR_KEY_DOWN Then HepsiniOldur()
        EndIf
    WEnd
    If $Trigger = 1 Then Algila()
    If $NodeHit Then Vurus()
    AtakBitti()
    If $moving = 1 Then YaratikHareket(1)
    If TimerDiff($Bullet) >= 150 Then KursunSil()

    CanKontrol()
    _IrrBeginScene(0, 0, 0)
    _IrrDrawScene()
    CanlariYaz()
    _IrrGetScreenSize($w, $h)

    If $AttackC = 1 Then _IrrDraw2DImageElement($CrosTex2, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    If $AttackC = 0 Then _IrrDraw2DImageElement($CrosTex1, ($h + 101) / 2, ($w - 303) / 2, 0, 0, 64, 64, $IRR_USE_ALPHA)
    $metrics = "FPS: " & _IrrGetFPS() & @CRLF & "MONSTERS: " & $yaratiksayi
    _Irr2DFontDraw($BitmapFont, $metrics, 4, 4, 250, 52)
    _IrrEndScene()
WEnd
_IrrStop()

Func HepsiniOldur()
    For $i = 2 To UBound($Monster) - 1
        If $Monster[$i][1] <> "die" And $Monster[$i][0] <> 999 Then
            $Monster[$i][1] = 0
        EndIf
    Next
    $yaratiksayi = 2
EndFunc

Func ilerleme($yuzde)
    _IrrGUISetText($guiStatic, "LOADING " & $yuzde)
    _IrrBeginScene(0, 100, 200)
    _IrrDrawScene()
    _IrrDrawGUI()
    _IrrEndScene()
    Sleep(10)
EndFunc   ;==>ilerleme

Func YaratikEkle($HP = 100)
    $yaratiksayi += 1
    $Monster[$yaratiksayi][0] = _IrrAddMeshToScene($YaratikLoad)
    $Monster[$yaratiksayi][1] = $HP
    _IrrSetNodeMaterialTexture($Monster[$yaratiksayi][0], $YaratikTexture, 0)
    _IrrSetNodeMaterialFlag($Monster[$yaratiksayi][0], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrPlayNodeMD2Animation($Monster[$yaratiksayi][0], $IRR_EMAT_STAND)
    _IrrSetNodeScale($Monster[$yaratiksayi][0], 2, 2, 2)
    _IrrSetNodePosition($Monster[$yaratiksayi][0], Random(-500, 500, 1), -200, Random(-500, 500, 1))
    $Collision = _IrrGetCollisionGroupFromMesh($YaratikLoad, $Monster[$yaratiksayi][0]);2
EndFunc   ;==>YaratikEkle

Func CanlariYaz()
    For $Whp = 2 To UBound($Monster) - 1
        If $Monster[$Whp][1] <> "die" And $Monster[$Whp][0] <> 999 Then
            $posi = _IrrGetNodePosition($Monster[$Whp][0])
            _IrrGetScreenCoordinatesFrom3DPosition($x, $y, $posi)
            _Irr2DFontDraw($BitmapFont, "ID " & $Whp - 1 & @LF & "HP: " & $Monster[$Whp][1], $x, $y, $x, $y)
        EndIf
    Next
    _Irr2DFontDraw($BitmapFont, "HP: " & $Monster[1][1], 10, 580, 800, 600) ;player
EndFunc   ;==>CanlariYaz

Func AtakBitti()
    For $aB = 1 To UBound($Monster) - 1
        If TimerDiff($Attack[$aB]) >= 400 Then
            If $Monster[$aB][2] = 1 Then
                Dim $NodeHit = 0, $AttackC = 0
                $Attack[$aB] = -1
                $Monster[$aB][2] = 0
                If $Monster[$aB][1] <> "die" Then _IrrPlayNodeMD2Animation($Monster[$aB][0], $IRR_EMAT_STAND)
            EndIf
        EndIf
    Next
EndFunc   ;==>AtakBitti

Func KursunSil()
    For $adr = 1 To $blt
        _IrrRemoveNode($beam[$adr])
    Next
    $blt = 0
    $blt1 = 0
EndFunc   ;==>KursunSil

Func CanKontrol()
    For $i = 1 To UBound($Monster) - 1
        If $Monster[$i][1] <= 0 And Not $Monster[$i][1] = "die" Then Oldur($i)
    Next
EndFunc   ;==>CanKontrol

Func Oldur($bYaratik)
    _IrrPlayNodeMD2Animation($Monster[$bYaratik][0], $IRR_EMAT_CROUCH_DEATH)
    $Monster[$bYaratik][1] = "die"
    $SmokeParticles = _IrrAddParticleSystemToScene($IRR_NO_EMITTER)
    _IrrAddAnimatedMeshSceneNodeEmitter($SmokeParticles, $Monster[$bYaratik][0], True, 0.25, False, $SmokeEmitter)
    _IrrSetNodeMaterialTexture($SmokeParticles, $ParticleTexture, 0)
    _IrrSetNodeMaterialFlag($SmokeParticles, $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrAddFadeOutParticleAffector($SmokeParticles, 2000, 16, 8, 0)
    $asdf = _IrrGetNodeAbsolutePosition($Monster[$bYaratik][0])
    _IrrAddParticleAttractionAffector($SmokeParticles, $asdf[0], $asdf[1], $asdf[2], 20.0, $IRR_REPEL)
    _IrrSetNodePosition($SmokeParticles, $asdf[0], $asdf[1], $asdf[2])
    _IrrSetNodeMaterialType($SmokeParticles, $IRR_EMT_TRANSPARENT_VERTEX_ALPHA)
    _IrrAddFadeAnimator($Monster[$bYaratik][0], 1000, 500)
    _IrrAddFadeAnimator($SmokeParticles, 1000, 0)
EndFunc   ;==>Oldur

Func Algila()
    $Target = _IrrGetCameraTarget($CameraNode)
    $Ray = _IrrGetRayFromScreenCoordinates(400, 300, $CameraNode)
    $Ray1[0] = $Ray[0][0]
    $Ray1[1] = $Ray[0][1]
    $Ray1[2] = $Ray[0][2]
    $Ray2[0] = $Ray[1][0]
    $Ray2[1] = $Ray[1][1]
    $Ray2[2] = $Ray[1][2]
    _IrrGetNodeAndCollisionPointFromRay($Ray1, $Ray2, $NodeHit, $Target[0], $Target[1], $Target[2], $Null, $Null, $Null, 0, $IRR_NO_OBJECT)
EndFunc   ;==>Algila

Func Vurus()
    If $NodeHit And $Trigger = 1 Then
        $NoHit = False
        For $i = 1 To UBound($Monster)
            If $i = 49 Then
                $NoHit = True
                ExitLoop
            EndIf
            If $NodeHit = $Monster[$i][0] And $i > 1 Then ExitLoop
        Next
        $Attacked = $i
        If $Monster[$Attacked][1] < 1 Then $NoHit = True
        If $NoHit = True Then
            Dim $Bullet = TimerInit(), $Trigger = 0
            $blt += 1
            Beam()
        Else
            Dim $Bullet = TimerInit()
            $Trigger = 0
            $blt += 1
            $blt1 += 1
            $Attack[$Attacked] = TimerInit()
            $Monster[$Attacked][2] = 1
            Beam()
            $Monster[$Attacked][1] -= 10
            $vuruldu = $Attacked
            _IrrPlayNodeMD2Animation($Monster[$Attacked][0], $IRR_EMAT_PAIN_A)
            $Monster[$Attacked][2] = 1
            $AttackC = 1
        EndIf
    EndIf
EndFunc   ;==>Vurus

Func Beam()
    $beam[$blt] = _IrrAddBeamSceneNode()
    _IrrSetBeamSize($beam[$blt], 2)
    _IrrSetNodeMaterialTexture($beam[$blt], $MeshTexture, 0)
    _IrrSetNodeMaterialType($beam[$blt], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    $posi = _IrrGetNodeAbsolutePosition($Silah)
    _IrrSetBeamPosition($beam[$blt], $posi[0], $posi[1] + 2, $posi[2], $Target[0], $Target[1] + 10, $Target[2])

    $g[$blt1] = _IrrAddBillBoardToScene(2, 2, $Target[0], $Target[1] + 10, $Target[2])
    _IrrSetNodeMaterialTexture($g[$blt1], $MeshTexture, 0)
    _IrrSetNodeMaterialFlag($g[$blt1], $IRR_EMF_LIGHTING, $IRR_OFF)
    _IrrSetNodeMaterialType($g[$blt1], $IRR_EMT_TRANSPARENT_ADD_COLOR)
    _IrrAddFadeAnimator($g[$blt1], 1000)
EndFunc   ;==>Beam

Func YaratikHareket($aDurum, $aYaratik = 0, $aX = 0, $bY = 0, $cZ = 0)
    Select
        Case $aDurum = 1
            For $i = 2 To UBound($Monster) - 1
                If TimerDiff($YaratikHareket[$i]) >= 100 And $Monster[$i][0] <> 999 And $Monster[$i][1] <> "die" Then
                    _IrrPlayNodeMD2Animation($Monster[$i][0], $IRR_EMAT_STAND)
                    $Monster[$i][3] = 0
                    $YaratikHareket[$i] = -1
                    $something = 1
                EndIf
            Next
            If $something = 1 Then
                $moving = 0
                $something = 0
            EndIf
        Case $aDurum = 2
            If $Monster[$aYaratik][3] = 0 Then
                _IrrPlayNodeMD2Animation($Monster[$aYaratik][0], $IRR_EMAT_RUN)
            EndIf
            _IrrSetNodePosition($Monster[$aYaratik][0], $aX, $bY, $cZ)
            $Monster[$aYaratik][3] = 1
            $YaratikHareket[$aYaratik] = TimerInit()
            $moving = 1
    EndSelect
EndFunc   ;==>YaratikHareket

PS: try the new 'F' key -BogQ ; don't need to hold that key ;) -

Edited by BiliyomKi
An AutoIT user.
Link to comment
Share on other sites

no, the bug is still there, the beam hit the nude but nude dont react, even c1.png dont change to c2.png so the bug is probably in some "if then else"

on test '$metrics = "FPS: " & _IrrGetFPS() & @CRLF & "MONSTERS: " & $yaratiksayi & @CRLF & $NodeHit' is working correctly i think and the beam trace stay no mesh, and still no mesh reaction on hit

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...