PID adding into CRITRPID.H

The-Smallest

First time out of the vault
Hi guys. I have a big problem with adding new PID into CRITRPID.H.

For example: I have new character named Charlie. I created proto, set him to a map. I wrote new PID - PID_CHARLIE with right number in CRITRPID.H. That is alright.

But if I want write a script with new PID (PID_CHARLIE), it does not work. :( This is serious problem and I would like to know how to figure it out.

Thanks for answers...
 
The-Smallest said:
But if I want write a script with new PID (PID_CHARLIE), it does not work. :( This is serious problem and I would like to know how to figure it out.
What do you mean by "does not work"? Is an error thrown when you try to compile it? Does the critter just not appear in game?
 
My script contains these lines:

procedure Sequence begin
reg_anim_clear(PID_CHARLIE);
reg_anim_begin();
animate_move_obj_to_tile(PID_CHARLIE, CHARLIE_WATCH_TILE, ANIMATE_WALK);
reg_anim_end();
end

For now I am just trying to move Charlie from hex, where he stands at the beginning, to hex, which is described by CHARLIE_WATCH_TILE...

Compilation runs without problems. I set the script to Charlie but when I start a game, nothing happens. I wonder where the problem is...
 
The-Smallest said:
My script contains these lines:

procedure Sequence begin
reg_anim_clear(PID_CHARLIE);
reg_anim_begin();
animate_move_obj_to_tile(PID_CHARLIE, CHARLIE_WATCH_TILE, ANIMATE_WALK);
reg_anim_end();
end

For now I am just trying to move Charlie from hex, where he stands at the beginning, to hex, which is described by CHARLIE_WATCH_TILE...

Compilation runs without problems. I set the script to Charlie but when I start a game, nothing happens. I wonder where the problem is...

The problem is that you don't want to use PID_CHARLIE in the calls you are trying to make. PIDs are only used when you use the create_object call (for objects) and the create_object_sid call (for critters). Once you have an object/critter created you then refer to it in the script via the variable you had the above two calls return to.

In your case, you appear to be in the script physcially attached to Charlie. In this case you want to use self_obj in the places where you are using PID_CHARLIE.

Thus if the code you pasted is from Charlie's script, you will want your code to look as follows:

Code:
procedure Sequence begin
reg_anim_clear(self_obj);
reg_anim_begin(); 
animate_move_obj_to_tile(self_obj CHARLIE_WATCH_TILE,  ANIMATE_WALK); 
reg_anim_end();
end
 
Back
Top