Created
July 31, 2018 09:17
-
-
Save cydh/93532d86d152d41ec3c807b4f801869e to your computer and use it in GitHub Desktop.
Sample custom run for Private Airship (Herc's script)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- script private_airship FAKE_NPC,{ | |
end; | |
S_AirShipIsNeedItem: | |
for (.@i = 0; .@i < getarraysize(.needitem); .@i += 2) { | |
if (@airshipitem_id == .needitem[.@i]) { | |
@airshipitem_amount = .needitem[.@i+1]; //<--- Set the amount will be deleted | |
return true; | |
} | |
} | |
return false; | |
OnAirShipRequest: | |
.@delitem = true; | |
if (countitem(.vip_needitem) > 0) { | |
// If player has vip item, use this | |
@airshipitem_id = .vip_needitem; | |
.@delitem = false; | |
} else { | |
// Use normal item | |
@airshipitem_id = @itemid; | |
if (callsub(S_AirShipIsNeedItem) == false) { | |
airship_respond(P_AIRSHIP_ITEM_INVALID); | |
end; | |
} | |
if (countitem(@itemid) < @airshipitem_amount) { | |
airship_respond(P_AIRSHIP_ITEM_NOT_ENOUGH); | |
end; | |
} | |
} | |
if (getmapflag(strcharinfo(PC_MAP), mf_pairship_startable) != true) { //<--- Maybe VIP item can bypass this mapflag check | |
airship_respond(P_AIRSHIP_INVALID_START_MAP); | |
end; | |
} | |
if (getmapflag(@mapname$, mf_pairship_endable) != true) { //<--- Maybe VIP item can bypass this mapflag check | |
airship_respond(P_AIRSHIP_INVALID_END_MAP); | |
end; | |
} | |
if (.@delitem) //<--- Delete item | |
delitem(@airshipitem_id, @airshipitem_amount); | |
warp(@mapname$, 0, 0); //<--- Can be improved with exact coords in mapflag definition | |
end; | |
OnInit: | |
setarray(.needitem, 6909, 1, 25464, 1, 909, 100); | |
.vip_needitem = 11531; //<-- VIP item, won't be deleted. First priority to check | |
end; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment