Post new topic    
Slime Knight
Send private message
Plotscript Facial trouble 
 PostThu Sep 01, 2011 1:54 am
Send private message Reply with quote
I just tried to compile the following lines of code into Hspeak, which was supposed to be coding to change the look of the face in thw walkabout scene in my game, but when compiled, I came out with the error:

declaration plotscript is not permitted inside a script. Perhaps walkingdoomguy has an extra begin or (.

Here is the coding:

-------------------------------
Code:
#---------Storyline scripts end here.


#---------Doomguy's walkabout facial sprite info begins here, and with help from JSH357 and James Paige. Thanks, guys.
#---------This line below was made by my buddy, Harlock, and is used to change the look of the doomguy's face when hurt.
plotscript, walkingdoomguy, begin

if (getherostat(hero:doomguy,stat:hp,currentstat) >= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*80), then,
   init face
   end

if ((getherostat(hero:doomguy,stat:hp,currentstat) >= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*50) and (getherostat(hero:doomguy,stat:hp,currentstat) <getherostat>= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*20) and (getherostat(hero:doomguy,stat:hp,currentstat) <getherostat>= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*1) and (getherostat(hero:doomguy,stat:hp,currentstat) <= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*19)), then,
   end
#-----------Thus ends this line of code by Harlock. Thanks, man!   


 
plotscript, new game, begin
  init face
end
 
plotscript, load game, begin
  init face
end
 
script, init face, begin
  face := load small enemy sprite(2)
  realign slice (face, edge:center, edge:bottom, edge:center, edge:bottom)
  face1forward
end
 
script, face1forward, begin
  replace small enemy sprite(face, 2)
  set timer(1, 0, 20, @face1lookleft)
end
 
script, face1lookleft, begin
  replace small enemy sprite(face, 3)
  set timer(1, 0, 15, @face1lookright)
end

script, face1lookright, begin
  replace small enemy sprite(face, 4)
  set timer(1, 0, 15, @face1forward)
end

script, bloodface, begin
  face := load small enemy sprite(5)
  realign slice (face, edge:center, edge:bottom, edge:center, edge:bottom)
  face2forward
end

script, face2forward, begin
  replace small enemy sprite(face, 5)
  set timer(1, 0, 20, @face2lookleft)
end

script, face2lookleft, begin
  replace small enemy sprite(face, 6)
  set timer(1, 0, 20, @face1lookright)
end

script, face2lookright, begin
  replace small enemy sprite(face, 7)
  set timer(1, 0, 20, @face2forward)
end




#----------Doomguy's walkabout facial sprite info ends here.
Liquid Metal King Slime
Send private message
 
 PostThu Sep 01, 2011 4:06 am
Send private message Reply with quote
It's harlock's script.

it should look something closer to this, though I'm still not sure what it's doing.

Code:

plotscript, walkingdoomguy, begin

if (getherostat(hero:doomguy,stat:hp,currentstat) >= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*80) )
 then (init face)

if (
(getherostat(hero:doomguy,stat:hp,currentstat) >= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*50)) and (getherostat(hero:doomguy,stat:hp,currentstat) >= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*20)) and (getherostat(hero:doomguy,stat:hp,currentstat) >= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*1)) and (getherostat(hero:doomguy,stat:hp,currentstat) <= ((getherostat(hero:doomguy,stat:hp,maximumstat)/100)*19))
)
 then (init face)

   end

Slime Knight
Send private message
 
 PostThu Sep 01, 2011 4:11 am
Send private message Reply with quote
Yeah, dude, it looks like the code I sent you somehow got mangled; it definitely shouldn't look like that, haha.

EDIT: To be more specific, you don't want your if-then statements all in one big block like that. You want four separate if-then statements, one for each health "condition" the player can be in. One of them should check for 80%+, another for 50-79%, another for 20-49%, and one last one for 1-19%.

For some reason, when I post the correct code here, it also gets mangled up, so it must be something with the board! If you can't figure it out, we'll meet up in IRC sometime.
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Slime Knight
Send private message
 
 PostThu Sep 01, 2011 4:35 am
Send private message Reply with quote
Here's a simplified version that may be easier to understand (assuming it pastes correctly):

Code:

plotscript, doomguy, begin

variable(currenthp, maxhp)

currenthp := getherostat(hero:doomguy, stat:hp, currentstat)
maxhp := getherostat(hero:doomguy, stat:hp, maximumstat)

if (currenthp >= (maxhp/100)*80), then,
begin
#healthy portrait
end

if ((currenthp >= (maxhp/100)*50), and,
(currenthp <= (maxhp/100)*79)), then,
begin
#wounded portrait
end

if ((currenthp >= (maxhp/100)*20), and,
(currenthp <= (maxhp/100)*49)), then,
begin
#more wounded portrait
end

if (currenthp <= (maxhp/100)*19), then,
begin
#hamburger portrait
end

end   

SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Slime Knight
Send private message
 
 PostThu Sep 01, 2011 9:39 pm
Send private message Reply with quote
Well, here's the next stage of my little dilemma. I DO have the other facial sprites working, however, whenever the player stands still, the sprite reverts back to the original 100-80% state. If this is a glitch of the engine, I'm not sure. But anyway, here's the graphics:

Code:
#---------Doomguy's walkabout facial sprite info begins here, and with help from JSH357 and James Paige. Thanks, guys.
#---------This line below was made by my buddy, Harlock, and is used to change the look of the doomguy's face when hurt.

plotscript, walkingdoomguy, begin
variable(currenthp, maxhp)

currenthp := getherostat(hero:flynn, stat:health, currentstat)
maxhp := getherostat(hero:flynn, stat:health, maximumstat)

if (currenthp >= (maxhp/100)*80), then,
begin
init face
end

if ((currenthp >= (maxhp/100)*50), and,
(currenthp <maxhp>= (maxhp/100)*20), and,
(currenthp <= (maxhp/100)*49)), then,
begin
#more wounded portrait
end

if (currenthp <= (maxhp/100)*19), then,
begin
#hamburger portrait
end

end

#-----------Thus ends this line of code by Harlock. Thanks, man!   


 
plotscript, new game, begin
  init face
end
 
plotscript, load game, begin
  init face
end
 
script, init face, begin
  face := load small enemy sprite(2)
  realign slice (face, edge:center, edge:bottom, edge:center, edge:bottom)
  face1forward
end
 
script, face1forward, begin
  replace small enemy sprite(face, 2)
  set timer(1, 0, 20, @face1lookleft)
end
 
script, face1lookleft, begin
  replace small enemy sprite(face, 3)
  set timer(1, 0, 15, @face1lookright)
end

script, face1lookright, begin
  replace small enemy sprite(face, 4)
  set timer(1, 0, 15, @face1forward)
end

script, bloodface, begin
  face := load small enemy sprite(5)
  realign slice (face, edge:center, edge:bottom, edge:center, edge:bottom)
  face2forward
end

script, face2forward, begin
  replace small enemy sprite(face, 5)
  set timer(1, 0, 20, @face2lookleft)
end

script, face2lookleft, begin
  replace small enemy sprite(face, 6)
  set timer(1, 0, 20, @face1lookright)
end

script, face2lookright, begin
  replace small enemy sprite(face, 7)
  set timer(1, 0, 20, @face2forward)
end




#----------Doomguy's walkabout facial sprite info ends here.
Metal King Slime
Send private message
 
 PostFri Sep 02, 2011 12:06 pm
Send private message Reply with quote
I don't know why you're experiencing the problem you are because your walkingdoomguy doesn't make much sense to me, instead I'll just point out some perhaps unrelated mistakes in your scripts:

Firstly, don't write "currenthp >= (maxhp/100)*80". Hamsterspeak doesn't yet support floating point, so if maxhp is less than 100, then maxhp/100 is equal to 0. Write "currenthp >= maxhp*80/100" instead, it's literally 100 times more accurate.

Next,
Code:
if ((currenthp >= (maxhp/100)*50), and,
(currenthp <maxhp>= (maxhp/100)*20), and,
(currenthp <= (maxhp/100)*49)), then,

is completely muddled. This is apparently a bug in the forum software, you have to tick "Disable HTML in this post" for it to post correctly. Anyway, it looks like you meant to write
Code:
if (currenthp << (maxhp*80)/100 && currenthp >> (maxhp*19)/100) then, begin

instead.
Liquid Metal King Slime
Send private message
 
 PostFri Sep 02, 2011 3:33 pm
Send private message Reply with quote
I manually went in and fixed his script for him. Problem solved.
Slime Knight
Send private message
 
 PostFri Sep 02, 2011 5:24 pm
Send private message Reply with quote
Thanks again spoon. It's working out quite fine now. just need to slightly reposition some of the slices. Other than that, it's kewl.
Display posts from previous: