Home   Help Search Login Register  

Author Topic: Trouble with "createVehicle" - makes it possible to kill players  (Read 1572 times)

0 Members and 1 Guest are viewing this topic.

Offline SnowSky

  • Members
  • *
Hey,

do you know how to manage the problem with createVehicle Instruction, if there is a playable unit near you?
I try to explain my problem with an example. I wrote something so that I can build ingame some Buildings alĂ  Warfare. Now if my mouseposition with the building (set by createVehicleLocal) strafes me, I become injured or even worser, it kills me. Till now I did a WorkAround with the boundingBox, so that if a unit or building is near the mousepointer, the position of the building is set to [0,0,0]. The next problem is, that I set the maximal value of the boundingBox [[minX,minY][maxX,maxY] as the radius so where I watch for nearestObjects. Sure it works fine with units because they aren't so huge and giant so they don't die anymore at the moment, but if I built another house, I'm able to set the new building into the other building. Do you have an Idea how this has been managed in CTI or Warfare?

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
You may be interested in a couple of the solutions I was given to a mobile-spawn idea in this thread, regarding intersections with buildings.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
In Warfare there are special models for buildings (the transparent green and red ones) that don't damage vehicles (including units) on collusion.

The following code is used to check if there are any buildings near by:

Code: (Warfare.SaraLite\Client\GUI\GUI_Construct.sqs, Line 126) [Select]
... _obstacles = NearestObjects [_mousePosition,["Building","WarfareBCrate"],17] ...
try { return true; } finally { return false; }

Offline SnowSky

  • Members
  • *
thank you for your Post, I read it. I'll try to handle this problem with a messy function which will take all objects near 50m in its array, then I will check each objects size, and if the distance of the object to my mousepointer - objects maxSize - myPlacements maxsize is bigger then 1.5 meters, it will check the next one. Now I'll try to realise this, I hope it won't crash the performance to much.

+@Worldeater, thanks, I saw this already, but didn't know that these "specialBuildings" (green and red) don't have a CollisionModel, you opened my eyes.

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
In Warfare there are special models for buildings (the transparent green and red ones) that don't damage vehicles (including units) on collusion.

Ahh, well that's definitely worth knowing!  :good:

Offline SnowSky

  • Members
  • *
Hey, ahm - I still have a Question. What happens, if I do setpos the House created with createVehicleLocal on AI units, they don't get hurt, but I become injured. Does this happen only to the Player who executes the createVehicleLocal, or all humanPlayers?

Huhu  :clap: - Hey Guys,

"proudly" I made a solution which was a bit... messy - but it looks like it would work without a high amount of power :). If any one is interested, just tell me :)
« Last Edit: 28 Feb 2009, 18:07:41 by SnowSky »