Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

geckoo

Moderators
  • Content Count

    2,818
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by geckoo

  1. Really? So i am in a master class Даже глупый человек (как я) понял. Попробуй другой лабиринт... Thx for sharing ++
  2. Right! I forgot this case. I apologize for this trouble Vlad222, but i think you can understand my idea. themars2011 - ты таракан! Без обид
  3. I don't understand how you can ask this question if you wanna create a game. Score manager - it's just a counter. You can consider the problem like this : ApplyDamage script : var pointsToAdd = 100; function ApplyDamage (damage : float) { if (hitPoints > 0.0) return; scoreManager.addScore(pointsToAdd); (...) scoreManager script : function addScore(value : int){ currentScore += value; } See the managerScore script and EnnemyDamageRagDoll script in PremiumFPSkit 0.8 But perhaps you got another request. It's not clear for me. I recommend you read this next scrip "spawnerWithWaves" script : function RecountEnemiesInGame(){ if(allEnemiesInGame){ enemiesInGame--; }else{ tempKilledEnemies ++; } if(enemiesInGame == 0){ if( waveNr == enemiesToInstantiate.length){ Application.LoadLevel(Application.loadedLevel); print ("gameComplete"); //Here you can load Stats or anything else. return; } allEnemiesInGame = false; cTimer = 30.0; countdown = true; showRoundCompleted = true; } } It's a counter. When all zombies are dead, it launches another round... One week? Good luck ++
  4. geckoo

    Fps Maps

    This blue color for text is very ugly What it means? Construct a map for a game - the most easier part of work. With Unity and without problems, you can import assets, create a terrain or an island with trees, integrate some weather and interactives triggers, etc. Sure! this work is very long, but it's ours... Do you know Unity? This is not a criticism on my part - just an encouragement. You can found many tutorials on YT and web. Try friend ++
  5. geckoo

    inaccurancy

    Really? I thought you were making fun of me. I'm suspicious. If you learned something, I'm very happy ++
  6. geckoo

    inaccurancy

    You are sarcastic. I like it I think those who come here asking the same question. I know that you know... Ты коварный человек
  7. geckoo

    inaccurancy

    I found it. We must apply 3 values - X,Y and Z to create a randomized "vector3". Z is static. Now i understand... private var shotSpread = 0.03; // it's just an example function SprayDirection() { var vx = (1 - 2 * Random.value) * shotSpread; var vy = (1 - 2 * Random.value) * shotSpread; var vz = 1.0; return transform.TransformDirection(Vector3(vx,vy,vz)); } function Fire () { var direction = SprayDirection(); (...) It works fine. THX for the help ++
  8. geckoo

    inaccurancy

    function Fire () { var direction = transform.TransformDirection(Vector3.forward); var hit : RaycastHit; if (Physics.Raycast (transform.position, direction, hit, range)) { if (hit.rigidbody) hit.rigidbody.AddForceAtPosition(force * direction, hit.point); In this code, i got an absolute accurancy because i specify vector3.forward. I wanna a little inaccurancy. How can I add a random value on this vector ? I search this impossible result : var direction = transform.TransformDirection(Vector3.forward + random.value(-3.0,3.0)); Is it possible ? THX for support ++
  9. geckoo

    Recoil Script

    Я задал себе вопрос сегодня Спасибо ++
  10. Yeah ! it's works. Спаcибо большое тебе за помощь. Ты исправил мою ошибку ++
  11. Oops! I did it again. I corrected it. What do you think about my problem? Thx ++
  12. no weapon no salvation
  13. I got (again) a problem with some code JS. I'm trying to develop a script object retrieval. I created a table to differentiate objects, and although there are only two, everything is reversed. When I pick up a rocket, nothing happens and when I pick up a bonus of life, the number of rocket increases. Would you kindly help me? Thank you friends + enum PickupType { Health = 0, Rocket = 1}; var amountHealth = 20; var amountRocket = 1; function ApplyPickup (player : FPSPlayer) { if (PickupType.Health) { if (player.hitPoints >= player.maximumHitPoints) return false; player.hitPoints += amountHealth; player.hitPoints = Mathf.Min(player.hitPoints, player.maximumHitPoints); } else if (PickupType.Rocket) { var launcher : RocketLauncher = player.GetComponentInChildren(RocketLauncher); if (launcher) launcher.ammoCount += amountRocket; } return true; }
  14. I found a little bug in Unity 4. Audio clip length (audio.clip.length) not equal than wav or mp3 length. I don't know why. For example, this code didn't work properly. I heard an annoying echo : AudioSource.PlayClipAtPoint(sound, transform.position); yield WaitForSeconds(audio.clip.lenght); You must find the good length and declare it in a variable : var soundLength = 1.0 AudioSource.PlayClipAtPoint(sound, transform.position); yield WaitForSeconds(soundLength); Maybe you know an other method to automatize this sequence?
  15. Cамо собой разумеется. Спасибо за совет. Попробую очень скоро ++
  16. geckoo

    Code JV for dummies

    I did not presume to judge the work of others. I try to understand some methods, best among the others. What you tell me is very relevant, and I imagine the need to monitor the behavior of functions when debugging. It makes sense. Thank you for these explanations + +
  17. geckoo

    Script help.

    It's cool for an ambiant sound like a music... There is an alternative if your player (or collider) emit a localized sound when he passes nearby the trigger. var sound : AudioClip; function OnTriggerEnter(otherObj: Collider){ if (otherObj.tag == "Player"){ AudioSource.PlayClipAtPoint(sound, transform.position); yield WaitForSeconds(audio.clip.length); }
  18. geckoo

    Code JV for dummies

    I have several questions about the code in package FPS tutorial. They concern the way in which some functions are coded. It seems to me that an alternative is possible, but since the coders behind the project are professionals, I was surprised. I don't understand. For example: (...) // Are we dead? if (hitPoints < 0.0) Die(); } function Die () { if (die) // ??? why this condition ??? AudioSource.PlayClipAtPoint(die, transform.position); var coms : Component[] = GetComponentsInChildren(MonoBehaviour); for (var b in coms) { var p : MonoBehaviour = b as MonoBehaviour; if (p) p.enabled = false; } yield WaitForSeconds(3); Application.LoadLevel (1); } Why was it necessary to introduce a second condition in the Die function? If you get on this feature, the player is already dead? : hitPoints < 0 !!! It's a fact... I tried without this condition - I have not seen any change. A second example : if (!CanSeeTarget ()) return; var targetPoint = target.position; var targetRotation = Quaternion.LookRotation (targetPoint - transform.position, Vector3.up); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0); alertOn(); (...) Why declare the variable Targetpoint? Is it not easier to avoid the variable inside the function? var targetRotation = Quaternion.LookRotation (target.position - transform.position, Vector3.up); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, Time.deltaTime * 2.0); These are not errors, but I was wondering - why? I know that the clarity of the code is very important and that we get lost in the maze quickly. Therefore, why must code these functions by this way? Maybe it is not a problem - just a way of working. Thank you for sharing your opinion with the dummie that I am ++
  19. If you had a bit searched on the forum, you would have seen that I wrote a text about this script yesterday. http://armedunity.com/topic/5002-loop-in-update-function/?hl=loop
  20. Спасибо за предложения. Я сталкивался с трудностями, пробуя определить некоторые слова из твоего текста, но мне кажется, что я понял самое главно - практиковать каждый день "чуть-чуть" и в конце концов можно достичь своей цели - владеть кодом JV. На самом деле, читать/понять его очень легко. Можно ещё изменить некоторые аспекты кода и попробовать разные варианты. Но к сожалению, создать какой-то полный код - то есть размышлять точно и обрести логику, чтоб созидать сложный код - это другое дело. Они говорят по-русски свободно в Латвии. Я не знал. Огромное спасибо тебе за советы ++ I found a really good example. It's very explicite : function PlayStepSounds () { var controller : CharacterController = GetComponent(CharacterController); while (true) { if (controller.isGrounded && controller.velocity.magnitude > 0.3) { audio.clip = walkSounds[Random.Range(0, walkSounds.length)]; audio.Play(); yield WaitForSeconds(audioStepLength); } else { yield; } } }
  21. Трудно мне уже отличать этот метод от других. Даже если я понял теорию, есть ещё практическое упражнение. Продолжаю искать и вы знаете выражение - кто ищёт, тот найдёт... Прежде всего, я решил исследовать аккуратно код из fps_tutorial. Этот исходник очень интересен ++
  22. На самом деле, я только попробовал понять этот принцип. Я не создал ничего особенного. Я исследовал код и я заметил много аспектов, которые можно изменить/совершенствовать. Чтоб сделать эти изменения, я должен обязательно понять как всё идёт - как один код соединяется с другими... вот почему я задал вам такой вопрос. Спасибо за помощь ++ I try to understand how this code was developed and how i can modify many details (it's a begining). It so confused for me and i have so many questions... I was coder - ASM and C/C++ - rootkit, BOF, backdoor, shellcode - an another world, but I forgot many lessons. I work on it. Thanks boys because you helped me.
  23. That will work only if both script are attached to the same gameobject. ...and this is why I did not understand your explanation. Thanks you very much for help ++
  24. Ok I understood : var lol : scriptX = GetComponent(scriptX); lol.functionX(); lol.variableX ++; etc... Thx for support. It's a new language for me ++
  25. NullReferenceException: Object reference not set to an instance of an object Hum... i don't understand something I read the tutorial ++
×
×
  • Create New...