Home   Help Search Login Register  

Author Topic: Count objects (ID)  (Read 975 times)

0 Members and 1 Guest are viewing this topic.

Offline RT-SuperTron

  • Members
  • *
  • Prey...you will be
Count objects (ID)
« on: 17 Jun 2003, 19:00:24 »
So I see that prime has some questions about counting units..and I allso see that there is a new command called CountType...but it dosnt seem to be able to count stationary items like trees, buildings, rocks..etc.

So I have to find an alternate route around my problem. I need to check if a random Object ID is placed inside a trigger.
A script will launch and make some units choose a random Object ID number, between the lowest and the biggest I can find on a map exampl. (0 and 70000), and then use them as WPÂ's.
How ever there are some places on the map where I dont want the units to go, like some towns, remote islands and no fireing zones, and the will be marked with triggers.
I guess I could use a marker called "CheckWP", but how do I check if the Marker is inside a TriggerZone....

[RT]SuperTron

+- PAIN IS YOUR FRIEND, IT WILL REMIND YOU THAT YOU ARE ALIVE -+

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Count objects (ID)
« Reply #1 on: 17 Jun 2003, 19:16:06 »
Hi SuperTron,

Just one thing : careful when you check Object IDs, because some of them are NOT on the map, and if they're spotted by the script, the game might just CTD !

As to the marker issue, couldn't you use a gamelogic ? It'd be simpler because triggers can be defined to activate only when GLs are in (it's in the anybody/west/.../radio alpha/.../game logic menu).

« Last Edit: 17 Jun 2003, 19:17:18 by Igor Drukov »

Offline RT-SuperTron

  • Members
  • *
  • Prey...you will be
Re:Count objects (ID)
« Reply #2 on: 17 Jun 2003, 20:02:16 »
Well thanks for the heads up abput the IDÂ's not on the map, that do explain some of the really wicked issues like CTD. :D

And you might be on to something about the gamelogics, but I need the triggers to be awake (or do they??) since they have to make the _units in the script pick a new number if the GL or Marker is in the trigger zone.

[RT]SuperTron
+- PAIN IS YOUR FRIEND, IT WILL REMIND YOU THAT YOU ARE ALIVE -+

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Count objects (ID)
« Reply #3 on: 17 Jun 2003, 20:26:05 »
So there are some places where you don't want the loons to patrol, right ?
You could create triggers covering those areas, which get activated by logics, and which will choose another random position when activated.

Each time a random position is chosen, you could just setpos the logic there, and if that random position is a no-go area, then another one will be chosen by the trigger.

If you need more info about GLs (which can move, too), see here (reply #7).



« Last Edit: 17 Jun 2003, 20:29:49 by Igor Drukov »

deaddog

  • Guest
Re:Count objects (ID)
« Reply #4 on: 17 Jun 2003, 20:59:56 »

Just one thing : careful when you check Object IDs, because some of them are NOT on the map, and if they're spotted by the script, the game might just CTD !

It does crash.  I just tried it.   :P

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Count objects (ID)
« Reply #5 on: 18 Jun 2003, 02:42:16 »
..and I allso see that there is a new command called CountType...but it dosnt seem to be able to count stationary items like trees, buildings, rocks..etc.

This is due to the fact that most (not all) buildings and rocks do not have class names. Unfortunately, this means that you can't use counttype on them.... ;)

So I have to find an alternate route around my problem. I need to check if a random Object ID is placed inside a trigger.

The other problem you will have is that inanimate objects will not show up inside a trigger... eg. try placing a tent in a trigger and checking if the trigger sees it. You'll find it won't.

The same goes for map objects, unfortunately...

Anyway, having said all that, there is no reason for you to stop trying. There may well be a work around that I haven't thought of (or I may simply be wrong! ;D). Good Luck, but it's not going to be easy... ;)

Offline RT-SuperTron

  • Members
  • *
  • Prey...you will be
Re:Count objects (ID)
« Reply #6 on: 18 Jun 2003, 03:49:24 »
Thanks Sui, I think i might have to refrase the line
Quote
So I have to find an alternate route around my problem. I need to check if a random Object ID is placed inside a trigger.

I have allready figured out that there will be now way to check for MAPobjects since there is no class, so therefor by "other way around" I thought of making trigger zones like those NoFireZones in the SP/MP pack from Snypier. A few Examples..

This Example from [RT]FatherBob chooses a predifined ID and uses it as WP..
Quote
#Start

_unit = _this select 0
_obj1 = getpos (object 79954)
_obj2 = getpos (object 79958)
_obj3 = getpos (object 79895)
_obj4 = getpos (object 79966)

_pool  = [_obj1,_obj2,_obj3,_obj4]
_choose = _pool select (random 3)
[_unit,1] SetWPPos _choose

@ UnitReady [_unit,1]
Goto "start"

This altered experiment chooses a complete random WP..
Quote
#Start

_Unit = _this select 0

#Loop
_Xnum = Random (50000)
_Xnum = _Xnum -(_Xnum Mod1)

[_Unit,1] SetWPPos _Xnum
@ UnitReady [_unit,1]
Goto "Loop"

#End
Exit

Case one is no problem at all, since it works with predefined IDs there is no need to check up on it, but Case two -the altered and funny one- I have to place a Marker og GL on the map that makes a check to see if it is a legal or NoGo number..I know that it would be easy to make the extra line in the Case Two script above the line:
Quote
[_Unit,1] SetWPPos _Xnum
"MyMarker" SetMarkerPos GetPos (object _Xnum)

That would make the Marker jump to the selected ID before it assigns the WP to _Unit, but what syntax/line should be added to make it check up on the NoGo zones,..
and should I make/add the NoGo triggers to an Array..

[RT]SuperTron[/Color]
+- PAIN IS YOUR FRIEND, IT WILL REMIND YOU THAT YOU ARE ALIVE -+