Jump to content
LordRahl3000

Please help me with my custom spawner script?

Recommended Posts

I was recently watching a tutorial on spawning and I'd like to revise the way I do it. In the video, he used a collision trigger which is unfortunately useless in my game. I'm trying to write my own script and trigger it via flow graph. The FPSPlayer.lua fortunately has a tab within the flowchart that says "On Dead". I'd like to use it to trigger my player spawner. This is my very first attempt at writing my own. Having an issue with signifying the player as the entity to be spawned.

post-18536-0-00152400-1484981977_thumb.png

post-18536-0-54024800-1484986937_thumb.png

Share this post


Link to post

Your first function is not in a correct syntax at all.

 

You need something more like this. Note that it is not complete.

function Script:Respawn()--in
    --get spawnPos

    --get player entity

   --place the player entity at the spawn pos
   player:SetPosition(spawnPos)
end

Share this post


Link to post

Thankyou Aggror! That gives me an idea anyway. I appreciate it!

 

The reason I don't want a collision trigger deciding my respawn is because I'm not worried about just falling. When the player falls, HP drops to 0. So using the on death trigger takes care of everything in one go I would think. It allows the player to respawn when a collision trigger isn't viable. For instance, An FPS game may have a collision trigger set for deep water or a deep chasm but what about when they are killed by an enemy npc? You'd be stuck laying there...I havn't been using any custom scripts. I havn't been able to find any except for what's in the workshop, even those don't work...

Share this post


Link to post

The collision trigger is just a simple example. If the Dead trigger from the FPS player is usefull for you, you go for it.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...