Game Development Community

Player Invincibility

by Ryan Edmar · in Technical Issues · 11/22/2006 (4:07 am) · 3 replies

This might seem like a stupid question but, does anyone now how I can make a player object not take damage. The reason I for this is I recently added a RPG dialog to my game. The script for this employs an AiPlayer that just stands there(this is temporary) and then the player walks up to it and hits a button to talk to it. The problem is the script also uses the PlayerBody datablock and I don't want my Ai players to take damage as they will be like townsfolk and other things like that. I've tried a few things and searched everywhere with no luck. I remember reading somewhere that this can be done but I can't seem to find the info. Some incite would be helpful please.

#1
11/22/2006 (4:47 am)
Quote:
setInvincibleMode( time , speed )

Purpose
Use the setInvincibleMode method to temporarily make this shape invincible. i.e. Not able to take damage. While the player is invincible, the screen will flicker blue with a varying rate and a varying intensity.

Syntax
time - A floating-point value specifying the time in seconds for this shape to remain invincible.
speed - A floating-point value between 0.0 and 1.0 controlling the rate at which the blue flickering effect occurs.

Returns
No return value.

Notes
The flickering effect is used to indicated to a player that his (or her) avatar is invincible. Furthermore, this flicker rate will change and the flicker will become increasingly translucent as the time elapses. If speed set to 1.0, the flickering is a bit obscene. Generally, lower values are nicer.


that should do it
#2
11/22/2006 (6:20 am)
Greetings.

Personally - I just set isInvulnerable to true on the NPC spawn datablock.

This way I don,t hhave to worry about it expiring and in other areas such as radar or maps I can look at player datablocks and the isInvulnerable flag to change the dot color on the map between players, mob's and NPC's.

Means I can also use an NPC for target practice to test out new spell effects without having to wait for them to respawn each time :)

Regards

Graham
#3
11/22/2006 (8:55 pm)
Thanks Graham and Wolfgang for the help. Both of your answers will come in very helpful to me.


Okay!!! New question. How do I set isInvulnerable to true?


Here is my datablock for my NPC's

datablock PlayerData(NPCPlayer : PlayerBody)
{
shootingDelay = 2000;
}

So basically just a copy of the DemoPlayer datablock in aiplayer.cs with a new name. I added isInvulnerable = ture; to this but it did nothing. This might seem like simple stuff but I quite new and the only coding I've really ever done was in Q-Basic.

Just a side point, do you think I should create a new datablock for my NPC's or just continue to piggyback of the PlayerBody datablock?