killap said:
Darek said:
killap, how would one go about using "obj_on_screen" or "obj_can_see_obj" if said object is an item?
Hmm, never tried something like that before. I suppose any function that returns a pointer to the item should suffice. For example, you could use create_object and place an item on a map somewhere. Then use the return value of create_obj as one of the params for the two function you mention above. This might work...
Basically I want the dude to see if an armed explosive has been placed on the map.
That's item pids 206 and 209. Could you please write out the whole if statement, cause I don't quite understand what you mean?
What I'm trying to do is fix the dynamite crash. This is what I have so far...
It only crash when someone dies, wounded is not enough.
It will not crash on a map you just loaded from a savegame.
If you start combat mode and then exit, no crash will happen as long as you stay on the current map.
So something happens when a map is entered (that will not happen when you load that map from a save), something that is removed/corrected when combat mode is started. Maybe the game loads something in memory that is not saved in a normal map save, and combat mode clears it?
Anyway, I cleared a map in the Mapper, it was completely empty save for one critter. No scripts. When I went there in-game and blew her up the game still managed to crash. So it's nothing to do with any map enter scripts.
I have a crude solution for this but I'm not sure it's suitable for the patch. An alternative fix would be preferable.
Anyway, the idea is to start combat and force exit on every map you enter:
Code:
Obj_dude
procedure map_enter_p_proc
begin
set_local_var(6, 1);
attack_complex(dude_obj, 0, 1, 0, 0, 30000, 0, 0);
end
procedure combat_p_proc
begin
if (local_var(6) == 1) then begin
terminate_combat;
set_local_var(6, 0);
end
else begin
Basically you start a fight against yourself and without the terminate_combat call there, you will hurt yourself.
This ain't so good as it gets rather annoying with start/exit combat all the time, and it interferes with "multiple" random encounters (I think). Map exceptions can obviously be made for those.
I want to improve this by only start/exit combat when you have a dynamite set to blow in your inventory. But only once at a time per map. I've got "procedure is_dropping_p_proc" working, the "obj_carrying_pid_obj" in "procedure critter_p_proc" is still a bit iffy, and finally I need to be able to tell if an explosive is on the ground as using a dynamite in your active inventory slot bypasses the first two checks.
So what do you think, would this be possible?