Post 31 Aug 2014, 13:47 by Lewin
you made a mistake in your script Lewin. but i after modifing your script it finally works:)
- Code:
procedure OnHouseDestroyed(aHouseID : Integer; aHouseOwnerIndex : Integer);
begin
if (States.HouseType(aHouseID) = 17) and (States.HouseOwner(aHouseID) = 0) then
begin
Actions.GiveGroup(1, 14, 56, 21, 4, 12, 4);
end;
end;
in the procedure line you had OnHouseDestroyed and aDestroyerIndex.
while in the if states line you had OnHouseDestroyed and HouseOwner. wich was wrong. i changed aDestroyerIndex for Houseowner and now it works.
thanks for the help so far.
and if i want this only to happen when a building in certain postion in destoyed i must change (states.houseowner(ahouseid) for (states.houseat(10,16).
No, that is not a mistake. It is correct for OnHouseDestroyed to have aDestroyerIndex as a parameter, check the definition of OnHouseDestroyed
here. The function States.HouseOwner is completely unrelated to the procedure parameter aDestroyerIndex. Of course, it doesn't matter what you name those parameters (aHouseID and aDestroyerIndex), the script will run the same if you rename parameters or variables everywhere that they are used. But it's best to give them their correct names otherwise it is confusing.
Do you know any other programming languages? Maybe I can explain these concepts to you in a way which you are more familiar with?