Why is it the snake that falls asleep :)

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 6 months ago - 2 years 6 months ago #5788 by JTP
Last edit: 2 years 6 months ago by JTP.

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

More
2 years 6 months ago #5792 by thomas
Replied by thomas on topic Why is it the snake that falls asleep :)
You must make a choice here - either you let the snake use the sleep spell, or you code your own. You're close to have made your own, by the way.
   call_magic(ch, FIGHTING(ch), 0, SPELL_SLEEP, GET_LEVEL(ch), CAST_SPELL);
+   GET_POS(FIGHTING(ch)) = POS_SLEEPING;
   stop_fighting(FIGHTING(ch));
   stop_fighting(ch);
-   GET_POS(ch) = POS_SLEEPING;

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 6 months ago #5794 by JTP
Ok atleast the snake didnt fall asleep now. But the character doesnt sleep either.

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #6187 by JTP
Hmm trying to get this to Work..But it says the char goes to sleep, the char is affected by sleep. But isnt in POS_SLEEPING.


Casting 'sleep' spell Works just fine, so whats up ?

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

More
2 years 1 month ago #6188 by thomas
Replied by thomas on topic Why is it the snake that falls asleep :)
My bad - github.com/tbamud/tbamud/blob/2f12752373...8a4/src/fight.c#L151 stop_fighting() will reset the opponent to standing position.

I suggest doing something in this vein:
  struct *char_data fighting = FIGHTING(ch); // at top of function
...
  call_magic(ch, FIGHTING(ch), 0, SPELL_SLEEP, GET_LEVEL(ch), CAST_SPELL);
  stop_fighting(FIGHTING(ch));
  stop_fighting(ch);
  GET_POS(fighting) = POS_SLEEPING;

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #6189 by JTP
That seems to Work...thanks alot

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #6190 by JTP
Was alittle to fast...some times my test char is just placed in pos_sleeping, and he can just wake up...other times the spell actually make him sleep, and then he cant wake up until spell is gone.

But were closer at least

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

More
2 years 1 month ago #6191 by thomas
Replied by thomas on topic Why is it the snake that falls asleep :)
you may need a call to update_pos(fighting)

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

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 years 1 month ago #6192 by JTP
before or after the stop_fighting or after GET_POS ?

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

More
2 years 1 month ago #6193 by thomas
Replied by thomas on topic Why is it the snake that falls asleep :)
at the end.

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

Time to create page: 1.509 seconds