Forum
Stranded II Scripts How to get unit's name?How to get unit's name?
3 replies 1
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
on:event {
$id="command to get the unit id (will depend on the event)";
if ($id==x) {
"event you want with the unit name";
}elseif ($id==y) {
"event for the other unit";
}
}
If you want to receive a message with the unit name when using it, for example, it would be like this:
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
on:use {
$id=currentid;
id ($id==9) {
msg "name of the unit with the id=9 (I don't remember which is)";
}elseif ($id==10) {
msg "name of the unit with the id=10";
}
}
1
2
3
4
5
6
7
2
3
4
5
6
7
on:use {
$id=currentid();
$type=type("unit", $id);
$name=name("unit", $type);
msg "This is a $name."; //e.g. "This is a lion."
}
edited 1×, last 06.03.13 10:13:49 pm
edited 1×, last 07.03.13 08:32:14 am
1