Thanks Mr. Stalin and Cyrus for explaining.
It works!
One more question, and this is entirely for the sake of understanding for the future:
How come this code works?
But if I change the line "if weight_amount == 1" to "if weight_amount == 2, or anything other then "==1", then it crashes... WTF?
according to the debugger, it crashes when weight_amount==2. (displayed massage is "2")
I know it has something to do with the "destroy_object" function, because if u replace the line, it works.
It works!
One more question, and this is entirely for the sake of understanding for the future:
How come this code works?
Code:
procedure delete_extra_weights(variable weight_amount) begin
hook_stop := true;
if (weight_amount<1) then begin
return;
end
while(weight_amount!= 0) do begin
if obj_carrying_pid_obj(dude_obj, PID_EXTRA_WEIGHT) >0 then begin
if weight_amount == 1 then
destroy_object(obj_carrying_pid_obj(dude_obj, PID_EXTRA_WEIGHT));
display_msg("" + weight_amount);
weight_amount:=weight_amount-1;
end
end
hook_stop := false;
end
But if I change the line "if weight_amount == 1" to "if weight_amount == 2, or anything other then "==1", then it crashes... WTF?
according to the debugger, it crashes when weight_amount==2. (displayed massage is "2")
I know it has something to do with the "destroy_object" function, because if u replace the line, it works.
Last edited: