Last active
November 1, 2020 16:27
-
-
Save blurymind/047fea6375ce258743bac655bea0ab2d to your computer and use it in GitHub Desktop.
Ags reusable methods
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
//// This is ags script, not javascript - C like, but not quite | |
//////////// walk to and pick ////////////////// | |
/// https://adventuregamestudio.github.io/ags-manual/Object.html | |
function walkToAndPick(this Object*, InventoryItem* addObject ,const string say){ | |
player.Walk(this.X, this.Y, eBlock, eWalkableAreas); | |
String toSay = ""; | |
if (String.Format("%d",say) =="0") { | |
toSay = String.Format("Found a %s", addObject.Name); | |
} | |
else { | |
toSay = say; | |
} | |
player.Say(toSay); | |
player.AddInventory(addObject); | |
this.Visible = false; | |
} | |
function walkToAndLook(this Object* ,const string say){ | |
player.Walk(this.X, this.Y, eBlock, eWalkableAreas); | |
String toSay = ""; | |
if (String.Format("%d",say) =="0") { | |
toSay = this.GetTextProperty("Description"); // add this to Object schema | |
} | |
else { | |
toSay = say; | |
} | |
player.Say(toSay); | |
} | |
import function walkToAndPick(this Object*, InventoryItem* addObject, String say=0); | |
import function walkToAndLook(this Object*, String say=0); | |
//then use on objects | |
function cup_PickUp() | |
{ | |
// cup.walkToAndPick(); | |
cup.walkToAndLook(); | |
} | |
/////////////////////////// |
Author
blurymind
commented
Nov 1, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment