Saving "YOU" synonym value for using later...

Posted By: Anonymous

Saving "YOU" synonym value for using later... - 06/13/01 22:03

OK, done the search thing - nada...

I know what the "you" synonym is used for, but how do you save it for later use?
Specifically, *what* kind of parm is this, and what *type* of array would I need to create to track the entities that are triggering events.

This is more along the lines of completing level goals - tracking who the player has interacted with, and what level objects have been manipulated by the player.
Another use would be to store the results from a scan explosion - everyone hurt "raise their hands" (so to speak) and the routine takes all the entities within the blast radius, and stores their "names" for processing later on.

I would like the code to be simple, like:

Action Player_track(){
Myarray[ArrayIndex] = YOU;
// Rest of Code
}

Then be able to go through the array when the game dictates, and modify the entity "pointed to" by the array.


Thanks in Advance,

-Neut.

Posted By: Anonymous

Re: Saving "YOU" synonym value for using later... - 06/13/01 23:22

You could easily copy the you synonym to another one by declaring a new synonym in the start like this synonym newsynonym { type entity;} and then copy the first to the second as easily as this: newsynonym=you;

however I haven't tested putting synonyms into arrays yet, and don't know if that can work, but you can always try.

my way of having each guy withing the blast radius get hurt, is toggle a skill of theirs in the scan event and then use that skill in another function runned by every guy, that kills em: if (str_cmpi(my._status,"exploded")==1) {playexplodedanim(); }

Hope that helped
LLaffer

Posted By: Anonymous

Re: Saving "YOU" synonym value for using later... - 06/14/01 03:23

Thanks Larry - good info.

But I really need this to be stored into an array if at all possible, because the routine involved would be too cumbersome if *not* in an array of some kind...

Doug, help... (1 finger from drowning man...)
- *not* the middle one either

-Neut.



Posted By: Doug

Re: Saving "YOU" synonym value for using later... - 06/14/01 04:18

As far as I know, you can not make a simple array of synonyms.

But we are replacing synonyms with 'pointers':

synonym guard { type entity; } // old style <*ick!*>
&entity guard; // new style <*cool!*>

Right now it's "pre-beta" so only JCL can tell us if something like this would work:

&entity targetArray[128]; // an array of 128 entity pointers

Posted By: Anonymous

Re: Saving "YOU" synonym value for using later... - 06/14/01 04:30

You could nave something like var done_this? = 0; and then when the player reaches a certain goal add 1 to this. When the counter reaches say 5 (or how many tasks there are you've finished!
Posted By: Anonymous

Re: Saving "YOU" synonym value for using later... - 06/14/01 09:49

This is for a weather & special effects system involing numerous moving objects and particles.
Particles have a very limited number of variables, but particles are good - cause I can create 10,000 at once, if I want.
(And in a multiplayer game the above number is more probable, than not)
I'm trying to add some AI to the system and there aren't enough user-def vars for the particles.
Overcoming this is my objective.
I need particles to have collision detection, even if I have to code it myself - but I can't do it *without* storing "YOU" someplace.
Partially, this has to do with particle grouping and other stuff I don't want to get into...

(Dang! Seems like everyone's working on a weather system - me and my big mouth! ... ah well...)

-Neut.

[This message has been edited by NeutronBlue (edited 14 June 2001).]

Posted By: Anonymous

Re: Saving "YOU" synonym value for using later... - 06/28/01 06:24

I would really like that pointer based entity system! I was writing a space sim for a while. I got stuck and stoped because I couldn't figure out a good way to cycle the targeting system throught the enemy entities, and retrive info on them. I can't wait for the new feature!
Posted By: WildCat

Re: Saving "YOU" synonym value for using later... - 06/28/01 09:29

Neut,
If you can hold out for the next release, there are some handy new commands coming that will convert "Pointers" to plain-old numbers that can be stored in an array.

Check this out (from the upcoming features list):
var = handle(object)
returns a handle of an object. A handle is a unique number that
internally identifies that object. The object can be an entity, an
action, a string, a bmap, a panel, or any pointer to them.

A handle is similar to a pointer, but is just a number and therefore
can be assigned to any variable or skill. After saving and loading a
game, a handle is guaranteed to reference always the same object -
this is not guaranteed for pointer parameters. For using a handle to
get the referenced object, it can be converted to a pointer, through
the following instruction.

ptr = ptr_for_handle(var)
assigns the object referenced by the given handle to a pointer.
Example:

my.skill40 = handle(you); // store a handle to the YOU entity
...
you = ptr_for_handle(my.skill40) // get the YOU entity back;

This way arbitrary objects can be stored in entity skills or var
arrays.

A lot of us have been waiting for this for a LONG time.

=WildCat

Posted By: MadMark

Re: Saving "YOU" synonym value for using later... - 12/06/02 01:02

Is this storing of arbitrary objects in arrays available in the (5.203) version?

Mark
Posted By: JayG

Re: Saving "YOU" synonym value for using later... - 12/07/02 12:03

I have been able to do it as long I converted the pointer to a handle first, and then back to a pointer when I need it. I think it is ptr_for_handle
© 2024 lite-C Forums