flying bug - down to 1 little issue, then we have a snippet.Still need help pls

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2069 by JTP
Ok if i cast fly on character, then he/she still walks, should be flying.
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2070 by Kewlb
depends on other commands you enter.. type fly to float into the air.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2071 by JTP
it sets AFF fly, but says leaves north instead of flies north

typing just fly dont do anything

a look in room says charname is standng here, even with AFF fly on
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2074 by rudeboyrave
you will have to add some things for the person to show flying when you look at the room.
in act.informative.c there is a function

list_one_char

it has all of the messages for sitting, meditating, sleeping, standing, etc. Add one for flying.
    " is lying here dead",
    " is lying here mortally wounded",
    " is lying here incapacitated",
    " is lying here stunned",
    " is sleeping here",
    " is focusing here",
    " is meditating here",
    " is resting here",
    " is sitting here",
    "!FIGHTING!",
    "is standing here",
   +"is floating in mid air!"
(notice how the final position message has no comma but the one above it now does.)

you have defined flying as a position? if not it would help you to do so in structs.h.
// Positions
#define POS_DEAD            0   /* < Position = dead               */
#define POS_MORTALLYW       1   /* < Position = mortally wounded   */
#define POS_INCAP           2   /* < Position = incapacitated      */
#define POS_STUNNED         3   /* < Position = stunned            */
#define POS_SLEEPING        4   /* < Position = sleeping           */
#define POS_FOCUSING        5   /* < Position = focusing           */
#define POS_MEDITATING      6   /* < Position = meditating         */
#define POS_RESTING         7   /* < Position = resting            */
#define POS_SITTING         8   /* < Position = sitting            */
#define POS_FIGHTING        9   /* < Position = fighting           */
#define POS_STANDING       10   /* < Position = standing           */
+define POS_FLYING         11   /* fly away!!!                     */

Now all you do is have to change the position of the player in your do_fly command or whatever you are using.
simple. just add this.
    GET_POS(ch) = POS_FLYING;

and if you have a land command or something of that nature make sure to add in
    GET_POS(ch) = POS_STANDING;


as for the player leaving the room? check out the function do_simple_move in act.movement.c i think

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.
The following user(s) said Thank You: JTP

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2079 by JTP
hmm there is no do_fly in stock tba, anyone have a do_fly code for fly spell not skill ?

all it does is set the AFF_FLY
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2080 by JTP
Can this be modified to also make a fly message, any ideas ?:

/* Generate the leave message and display to others in the was_in room. */
if (!AFF_FLAGGED(ch, AFF_SNEAK))
{
snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]);
act(leave_message, TRUE, ch, 0, 0, TO_ROOM);
}

Its the only one i found in the code resembling move messages.

And anyone have a fly code for fly spell ? Since fly is a spell in tba and i like it to stay that way
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago - 6 years 9 months ago #2082 by Papaya Pete
Fly and Land Snippet

Check out the link, as it contains a snippet that was shared here for adding a do_fly and do_land command. Hope this helps.
Last edit: 6 years 9 months ago by Papaya Pete.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2083 by JTP
link on snippets site is for a skill, i need it to be a spell like stock tbamud has it, its a spell in stock.

I tryed changing a skill do_fly to a ASPELL(spell_fly)

ASPELL(spell_fly)
{
  int percent, prob;

  if (IS_NPC(ch) || !GET_SKILL(ch, SPELL_FLY)) {
    send_to_char(ch, "You have no idea how.\r\n");
    return; }

  if (GET_POS(ch) == POS_FLYING) {
    act("$n seems to be more down to earth.", TRUE, ch, 0, 0, TO_ROOM);
    act("You stop to fly, the earth seems to be closer to your feet.", TRUE, ch, 0, 0, TO_CHAR);
    GET_POS(ch) = POS_STANDING;
  return; }

  if (GET_MANA(ch) < (GET_LEVEL(ch)) || GET_MOVE(ch) < (GET_LEVEL(ch))) {
    act("You don't have the energy required to fly.", TRUE, ch, 0, 0, TO_CHAR);
  return; }

  percent = number(1, 101);	/* 101% is a complete failure */
  prob = GET_SKILL(ch, SKILL_FLY) / 2 + GET_INT(ch) * 2;

  if (percent > prob) {
    act("$n leeps into the air but quickly hit the ground, $e failed to fly.", TRUE, ch, 0, 0, TO_ROOM);
    act("You leep into the air but unfortunately hit the ground as you fail to fly.", TRUE, ch, 0, 0, TO_CHAR);
    GET_MANA(ch) -= (GET_LEVEL(ch));
    GET_MOVE(ch) -= (GET_LEVEL(ch));
    return;
  } else {
    GET_MANA(ch) -= (GET_LEVEL(ch));
    GET_MOVE(ch) -= (GET_LEVEL(ch));
    act("$n slowly raises towards the sky as $e starts to fly.", TRUE, ch, 0, 0, TO_ROOM);
    act("You slowly raise towards the sky as you start to fly.", TRUE, ch, 0, 0, TO_CHAR);
    GET_POS(ch) = POS_FLYING;
    return;
 }
}
.
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2084 by JTP
It compiles fine, it just doesnt do anything

I neeed a fancy way to have code do
GET_POS(ch) = POS_FLYING; if people are AFF_FLYING, and POS_STANDING, when spell runs out


With stock code people still walk and stand with fly on.

In score im standing even when im flying, if i look in room then the char with fly on is still standing. But that part i found out how to do, i think..It just wont work until i can set GET_POS(ch) = POS_FLYING; <--is defined in structs.h
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2090 by rudeboyrave
are you able to cast the spell? do your act messages show when you perform the spell in-game?

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2091 by JTP
Yes spell works, AFF_FLY sets properly and shows in stat character.
And removes it self when it runs out, and i can move in water areas.

I just need the final touch, like:
I need people to be set to:
GET_POS(ch) = POS_FLYING;

So i can see:
$n flies %s

and when people look in the room they see:
jtp is flying here. instead of jtp is standing here.
/* for score */
  case POS_FLYING:
    strcat(buf, "You are flying.\r\n");
    break;

/* fly move */
  if (GET_POS(ch) == POS_FLYING) {
    sprintf(buf2, "$n flies away to the %s.", dirs[dir]);
    act(buf2, TRUE, ch, 0, 0, TO_ROOM);
.

From stat:
AFF: FLY
SPL: ( 25hr) fly sets FLY,
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2092 by rudeboyrave
if you added pos_fly to structs.h make sure you ticked #define NUM_POSITIONS up by one.

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2093 by JTP
I did that also...

i only need to change a players POS_STANDING to POS_FLYING

ergo the ASPELL(spell_fly)
dunno what code should be, tryed the skill do_fly and changed to ASPELL

that compiled but people still walked and was standing, and score still says: you are standing.
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2098 by thomas
Adding a new position to the mud is a rather large endavour. ("grep -ne "POS_|GET_POS\(" *.[ch]" to see what I mean).

However, to change a charaters position, just do "GET_POS(ch) = POS_FLYING;".

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago - 6 years 9 months ago #2099 by Fizban
I don't think adding POS_FLYING is worth the effort, I'd just check for AFF_FLYING, instead. Otherwise anything that checks for POS_STANDING will return as false when FLYING, which probably isn't ideal since generally the checks for POS_STANDING are made with the assumption that any non-sitting/sleeping position is standing.

As such you'd need to change most instances of:

if (GET_POS(ch) == POS_STANDING)

to:

if ((GET_POS(ch) == POS_STANDING) || (GET_POS(ch) == POS_FLYING))

or else things would break.
Last edit: 6 years 9 months ago by Fizban.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2100 by JTP
Well i was able to use AFF_FLYING some places, but this needs POS_FLYING for do_score see below:

Also look, to see whats in a room is made of POS_STANDING like jtp is standing here.
  switch (GET_POS(ch)) {
  case POS_DEAD:
    send_to_char(ch, "You are DEAD!\r\n");
    break;
  case POS_MORTALLYW:
    send_to_char(ch, "You are mortally wounded!  You should seek help!\r\n");
    break;
  case POS_INCAP:
    send_to_char(ch, "You are incapacitated, slowly fading away...\r\n");
    break;
  case POS_STUNNED:
    send_to_char(ch, "You are stunned!  You can't move!\r\n");
    break;
  case POS_SLEEPING:
    send_to_char(ch, "You are sleeping.\r\n");
    break;
  case POS_RESTING:
    send_to_char(ch, "You are resting.\r\n");
    break;
  case POS_SITTING:
    send_to_char(ch, "You are sitting.\r\n");
    break;
  case POS_FIGHTING:
    send_to_char(ch, "You are fighting %s.\r\n", FIGHTING(ch) ? PERS(FIGHTING(ch), ch) : "thin air");
    break;
  case POS_STANDING:
    send_to_char(ch, "You are standing.\r\n");
    break;
  case POS_FLYING:
    send_to_char(ch, "You are flying.\r\n");
    break;
  default:
    send_to_char(ch, "You are floating.\r\n");
    break;
  }
.
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 years 9 months ago - 6 years 9 months ago #2101 by JTP
also rest, sit, sleep etc uses POS_ like do_sleep, would need POS_FLYING so people cant sleep while flying:

ACMD(do_sleep)
{
  switch (GET_POS(ch)) {
  case POS_STANDING:
  case POS_SITTING:
  case POS_RESTING:
    send_to_char(ch, "You go to sleep.\r\n");
    act("$n lies down and falls asleep.", TRUE, ch, 0, 0, TO_ROOM);
    GET_POS(ch) = POS_SLEEPING;
    break;
  case POS_SLEEPING:
    send_to_char(ch, "You are already sound asleep.\r\n");
    break;
  case POS_FIGHTING:
    send_to_char(ch, "Sleep while fighting?  Are you MAD?\r\n");
    break;
  case POS_FLYING:
    send_to_char(ch, "Sleep while flying?  Are you MAD?\r\n");
    break;
  default:
    send_to_char(ch, "You stop floating around, and lie down to sleep.\r\n");
    act("$n stops floating around, and lie down to sleep.",
	TRUE, ch, 0, 0, TO_ROOM);
    GET_POS(ch) = POS_SLEEPING;
    break;
  }
}
.
Last edit: 6 years 9 months ago by JTP.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2108 by Fizban
Neither of those things require adding POS_FLYING to achieve.

For the first:
  case POS_STANDING:
+    if (AFF_FLAGGED(ch, AFF_FLYING))
+      send_to_char(ch, "You are flying.\r\n");
+    else
      send_to_char(ch, "You are standing.\r\n");
    break;

For the second:
ACMD(do_sleep)
{
+  if (AFF_FLAGGED(ch, AFF_FLYING))
+  {
+    send_to_char(ch, "You need to land before you can do that!\r\n");
+    return;
+  }
  switch (GET_POS(ch)) {

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2111 by rudeboyrave
he also wants movement messages "bob flys south" and bob is flying here (to room)

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

Please Log in or Create an account to join the conversation.

More
6 years 9 months ago #2116 by Fizban
Same thing can be done for those though, just as easy to check for the AFF flag as it is for POS_FLYING. Seems more sensible IMO than having to add checks for FLYINGto everything that checks for standing, both current and anything you add in the future.

Please Log in or Create an account to join the conversation.

Time to create page: 0.342 seconds