He Heals! He finally heals!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

He Heals! He finally heals!

Post by Alcoholic »

My medic finally heals! Here is how i made him heal...

(Note: it may not be the best way, and somethings might have nothing to do with it, but it works and thats all i care about.)


1. after "level waittill spawn" put "level.medic waitthread global/friendly.scr::heal $player"

2. somewhere after that put "thread medicsetup"

3. for medicsetup thread put this.

Code: Select all

medicsetup:

   if (isalive level.medic)
      level.medic thread medicstart
   end


4. for medicstart thread put this.

Code: Select all

medicstart:

   self.avoidplayer = 1
   
   self.friendtype = 5
   self thread global/friendly.scr::friendlythink
   
   self waittill death
   end


then poof your medic should be a lean mean healin machine.

p.s. this assumes your medic has an alias of "level.medic"

i just looked at the basic format for the medic in m5l1b and this is what it was like. a thread in a thread and that thread had self waittill death after it. you may not need it but it was there so i used it and it worked.



also, jv_map: i used that script you helped me make for when the soldiers follow the leader. i tweaked it a bit and it works great! the way it's setup now, they will run to the leader, but they'll stop before they get close enough to merge into him. when they merge into him, he doesnt advance, and hes on major grillo behaviour, but thats all fixed now! thanks!

heres my script if you wanted to see what it looks like now...

Code: Select all

main:

level waittill prespawn

   exec global/ai.scr
   exec global/friendly.scr
   exec global/loadout.scr maps/test_alliedraid.scr

   level.captain = level.friendly1
   level.medic = level.friendly5 //HE HEALS! YES!!!!!!
   
   level.script = maps/test_alliedraid.scr

level waittill spawn
   
   $player item weapons/bar.tik
   $player item weapons/colt45.tik
   $player ammo mg 200
   $player ammo pistol 70
   $player useweaponclass mg
   $player item weapons/m2frag_grenade.tik
   $player ammo grenade 4
   
   level.medic waitthread global/friendly.scr::heal $player
   level.friendly2 thread friendly2followleader
   level.friendly3 thread friendly3followleader
   level.friendly4 thread friendly4followleader

//Threads
thread friendlysetup
thread medicsetup
thread germansfound
end

germansfound:

   level.captain say dfr_sighted_01e_1 //GERMANS!
   level.captain waittill saydone
   wait 1
   level.captain say actor_M1L1_102 //cmon get moving! go! go!
   end

friendly2followleader:

while (isalive level.friendly2)
{
  if (isalive level.captain)
  {
     if (vector_within level.friendly2.origin level.captain.origin 256 == 0)
     {
        self runto level.captain
        wait 1
     }
     else
        self runto NULL
  }
  else
  {
     self runto NULL
     break
  }
  waitframe
}
end

friendly3followleader:

while (isalive level.friendly3)
{
  if (isalive level.captain)
  {
     if (vector_within level.friendly3.origin level.captain.origin 256 == 0)
     {
        self runto level.captain
        wait 1
     }
     else
        self runto NULL
  }
  else
  {
     self runto NULL
     break
  }
  waitframe
}
end

friendly4followleader:

while (isalive level.friendly4)
{
  if (isalive level.captain)
  {
     if (vector_within level.friendly4.origin level.captain.origin 256 == 0)
     {
        self runto level.captain
        wait 1
     }
     else
        self runto NULL
  }
  else
  {
     self runto NULL
     break
  }
  waitframe
}
end

friendlysetup:

   level.captain thread global/friendly.scr::friendlythink
   level.friendly2 thread global/friendly.scr::friendlythink
   level.friendly3 thread global/friendly.scr::friendlythink
   level.friendly4 thread global/friendly.scr::friendlythink

   level.captain.friendtype = 4
   level.friendly2.friendtype = -1
   level.friendly3.friendtype = -1
   level.friendly4.friendtype = -1
   
   level.captain.avoidplayer = 1
   level.friendly2.avoidplayer = 1
   level.friendly3.avoidplayer = 1
   level.friendly4.avoidplayer = 1

   level.captain.health = 1000
   level.friendly2.health = 1000
   level.friendly3.health = 1000
   level.friendly4.health = 1000
   level.medic.health = 1000
   
   level.friendly2.interval = 64
   level.friendly3.interval = 64
   level.friendly4.interval = 64
   
   level.captain thread deathleader
   level.friendly2 thread deathfriend2
   level.friendly3 thread deathfriend3
   level.friendly4 thread deathfriend4
   level.medic thread deathmedic
   end

medicsetup:

   if (isalive level.medic)
      level.medic thread medicstart
   end

deathleader:
   
   self waittill death
   iprintlnbold_noloc "Captain Smith has been killed in action. You are the new leader."
   thread newleader
   end

deathfriend2:

   self waittill death
   iprintlnbold_noloc "Private Duncan has been killed in action."
   end

deathfriend3:

   self waittill death
   iprintlnbold_noloc "Private Jordan has been killed in action."
   end

deathfriend4:

   self waittill death
   iprintlnbold_noloc "Sharpshooter Jones has been killed in action."
   end

deathmedic:

   self waittill death
   iprintlnbold_noloc "Medic Henry has been killed in action."
   end

newleader:

   iprintlnbold_noloc "The Captain has died. You are the new leader."
   thread newleadersetup
   end

medicstart:

   self.avoidplayer = 1
   
   self.friendtype = 5
   self thread global/friendly.scr::friendlythink
   
   self waittill death
   end

newleadersetup:
   
   level.friendly2.friendtype = 0
   level.friendly3.friendtype = 0
   level.friendly4.friendtype = 0
   
   level.friendly2.mins = -128
   level.friendly2.maxs = -512
   
   level.friendly3.mins = -128
   level.friendly3.maxs = -512
   
   level.friendly4.mins = -128
   level.friendly4.maxs = -512
   end
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

:wink:
Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

good job!
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

since its a problem for some people having non healing medics, maybe you could make this a short tut for people having probs with their medics. :D
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Hey Alcoholic if you send me a pk3 example of this I will place it on my site as a tut.

Tut by Alcoholic.

:)
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

cool ill make one as soon as i can
Trinculo
Corporal
Posts: 25
Joined: Fri May 23, 2003 8:32 pm
Location: Brisbane, Australia
Contact:

Post by Trinculo »

is it possible to impliment this into a mp map?
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

never worked with mp it might work though

i finished the .pk3 file

the map in it is actually a map i never finished. i had some nifty stuff in there...

just run to the nazis and get all shot up and the medic will heal you.

sometimes one of your teammates will get wounded enough for the medic to come but the airbones usually clear out the nazis before then.
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

I'm ready when you are Corporal Alcoholic.

:)
Trinculo
Corporal
Posts: 25
Joined: Fri May 23, 2003 8:32 pm
Location: Brisbane, Australia
Contact:

Post by Trinculo »

would love to see this implemented into a mp script :) like randomly select a player on each team and turn him into the medic for the team?

does that sound possible or am i dreaming?
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The friendly script will go nuts if there's more than one player I think :?
Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

hmm i dont knwo maybe if you selected a randomint and modified a weapon so it was a medkit... it might work
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

whats ur email small sumo
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

small_sumo34@hotmail.com , if what your sending me is too big for hotmail just drop me a line and I will mail you my proper address.

Thanks mate
Post Reply