dennis wrote:Woulnt it be a good idea to have a "Custom commands" for objects, much the same as foor rooms?
Eg. custom commands that would work only when the player has the object or is in the same room as the object.
Or is there allready a better way to do It that I've yet to discover??
do <npc_move;objectname>
define procedure <npc_move>
set numeric <temp2; 0>
set numeric <rand; $rand(1;10)$>
set string <temp; $parameter(1)$>
set string <locob; $locationof(#temp#)$>
if ( %rand% = 1 ) then {
if property <#locob#; north> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;north)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;north)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;north)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 2 ) then {
if property <#locob#; south> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;south)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;south)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;south)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 3 ) then {
if property <#locob#; east> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;east)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;east)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;east)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 4 ) then {
if property <#locob#; west> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;west)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;west)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;west)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 5 ) then {
if property <#locob#; northeast> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;northeast)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;northeast)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;northeast)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 6 ) then {
if property <#locob#; northwest> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;northwest)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;northwest)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;northwest)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 7 ) then {
if property <#locob#; southeast> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;southeast)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;southeast)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;southeast)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 8 ) then {
if property <#locob#; southwest> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;southwest)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;southwest)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;southwest)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 9 ) then {
if property <#locob#; up> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;up)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;up)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;up)$>
set numeric <temp2; 1>
}
}
}
if ( %rand% = 10 ) then {
if property <#locob#; down> then {
if property <#temp#; enemy> and not property <$objectproperty(#locob#;down)$; dungeon> then {
if property <#temp#; city> then {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;down)$>
set numeric <temp2; 1>
}
else do <npc_move(#temp#)>
}
else {
if ( $locationof(#temp#)$ = #quest.currentroom# ) then doaction <#temp#; move>
move <#temp#; $objectproperty(#locob#;down)$>
set numeric <temp2; 1>
}
}
}
if ( %temp2% = 0 ) then do <npc_move($parameter(1)$)>
end define